﻿namespace WinApiNet.Shell.Console
{
    using System;

    /// <summary>
    /// Represents console mode option flags.
    /// </summary>
    [Flags]
    public enum ConsoleMode : uint
    {
        /// <summary>
        /// Empty flag set.
        /// </summary>
        NONE = 0x0000,

        /// <summary>
        /// For input handle:
        /// CTRL+C is processed by the system and is not placed in the input buffer. If the input buffer is being
        /// read by <c>ReadFile</c> or <c>ReadConsole</c>, other control keys are processed by the system and are
        /// not returned in the <c>ReadFile</c> or <c>ReadConsole</c> buffer. If the <see cref="ENABLE_LINE_INPUT"/>
        /// mode is also enabled, backspace, carriage return, and line feed characters are handled by the system.
        /// For output handle:
        /// Characters written by the <c>WriteFile</c> or <c>WriteConsole</c> function or echoed by the
        /// <c>ReadFile</c> or <c>ReadConsole</c> function are parsed for ASCII control sequences, and the correct
        /// action is performed. Backspace, tab, bell, carriage return, and line feed characters are processed.
        /// </summary>
        ENABLE_PROCESSED_INPUT_OUTPUT = 0x0001,

        /// <summary>
        /// For input handle:
        /// The <c>ReadFile</c> or <c>ReadConsole</c> function returns only when a carriage return character is read.
        /// If this mode is disabled, the functions return when one or more characters are available.
        /// For output handle:
        /// When writing with <c>WriteFile</c> or <c>WriteConsole</c> or echoing with <c>ReadFile</c> or
        /// <c>ReadConsole</c>, the cursor moves to the beginning of the next row when it reaches the end of the
        /// current row. This causes the rows displayed in the console window to scroll up automatically when the
        /// cursor advances beyond the last row in the window. It also causes the contents of the console screen
        /// buffer to scroll up (discarding the top row of the console screen buffer) when the cursor advances
        /// beyond the last row in the console screen buffer. If this mode is disabled, the last character in the row
        /// is overwritten with any subsequent characters.
        /// </summary>
        ENABLE_LINE_INPUT = 0x0002,

        /// <summary>
        /// Characters read by the <c>ReadFile</c> or <c>ReadConsole</c> function are written to the active screen
        /// buffer as they are read. This mode can be used only if the <see cref="ENABLE_LINE_INPUT"/> mode is also
        /// enabled.
        /// </summary>
        ENABLE_ECHO_INPUT = 0x0004,

        /// <summary>
        /// User interactions that change the size of the console screen buffer are reported in the console's input
        /// buffer. Information about these events can be read from the input buffer by applications using the
        /// <c>ReadConsoleInput</c> function, but not by those using <c>ReadFile</c> or <c>ReadConsole</c>.
        /// </summary>
        ENABLE_WINDOW_INPUT = 0x0008,

        /// <summary>
        /// If the mouse pointer is within the borders of the console window and the window has the keyboard focus,
        /// mouse events generated by mouse movement and button presses are placed in the input buffer. These events
        /// are discarded by <c>ReadFile</c> or <c>ReadConsole</c>, even when this mode is enabled.
        /// </summary>
        ENABLE_MOUSE_INPUT = 0x0010,

        /// <summary>
        /// When enabled, text entered in a console window will be inserted at the current cursor location and all
        /// text following that location will not be overwritten. When disabled, all following text will be
        /// overwritten.
        /// </summary>
        ENABLE_INSERT_MODE = 0x0020,

        /// <summary>
        /// This flag enables the user to use the mouse to select and edit text.
        /// </summary>
        ENABLE_QUICK_EDIT_MODE = 0x0040,
    }
}