xtd 0.2.0
Loading...
Searching...
No Matches
xtd::native::console Class Referencefinal

Definition

Contains console native API.

Namespace
xtd::native
Library
xtd.core.native
Warning
Internal use only

Protected Static Methods

static int32_t background_color ()
 Gets the background color of the console.
 
static bool background_color (int32_t color)
 Sets the background color of the console.
 
static bool beep (uint32_t frequency, uint32_t duration)
 Plays the sound of a beep of a specified frequency and duration through the console speaker.
 
static int32_t buffer_height ()
 Gets the height of the buffer area.
 
static bool buffer_height (int32_t height)
 Sets or sets the height of the buffer area.
 
static int32_t buffer_width ()
 Gets the width of the buffer area.
 
static bool buffer_width (int32_t width)
 Sets the width of the buffer area.
 
static bool caps_lock ()
 Gets a value indicating whether the CAPS LOCK keyboard toggle is turned on or turned off.
 
static bool clear ()
 Clears the console buffer and corresponding console window of display information.
 
static int32_t cursor_left ()
 Gets the column position of the cursor within the buffer area.
 
static int32_t cursor_size ()
 Gets or sets the height of the cursor within a character cell.
 
static bool cursor_size (int32_t size)
 Sets the height of the cursor within a character cell.
 
static int32_t cursor_top ()
 Gets the row position of the cursor within the buffer area.
 
static bool cursor_visible ()
 Gets a value indicating whether the cursor is visible.
 
static bool cursor_visible (bool visible)
 Sets a value indicating whether the cursor is visible.
 
static bool echo (bool on)
 Sets the echo of the console on or off.
 
static int32_t foreground_color ()
 Gets the foreground color of the console.
 
static bool foreground_color (int32_t color)
 Sets the foreground color of the console.
 
static int32_t input_code_page ()
 Gets the code page the console uses to read input.
 
static bool input_code_page (int32_t codePage)
 Sets the code page the console uses to read input.
 
static bool key_available ()
 Gets a value indicating whether a key press is available in the input stream.
 
static int32_t largest_window_height ()
 Gets the largest possible number of console window rows, based on the current font and screen resolution.
 
static int32_t largest_window_width ()
 Gets the largest possible number of console window columns, based on the current font and screen resolution.
 
static bool number_lock ()
 Gets a value indicating whether the NUM LOCK keyboard toggle is turned on or turned off.
 
static int32_t output_code_page ()
 Gets the code page the console uses to write output.
 
static bool output_code_page (int32_t codePage)
 Sets the code page the console uses to write output.
 
static void read_key (char32_t &key_char, char32_t &key_code, bool &alt, bool &shift, bool &ctrl)
 Obtains the next character or function key pressed by the user.
 
static void register_user_cancel_callback (std::function< bool(int32_t)> user_cancel_callback)
 Register the user cancel callback.
 
static bool reset_color ()
 Sets the foreground and background console colors to their defaults.
 
static bool set_cursor_position (int32_t left, int32_t top)
 Sets the position of the cursor.
 
static std::string title ()
 Gets the title to display in the console title bar.
 
static bool title (const std::string &title)
 Sets the title to display in the console title bar.
 
static bool treat_control_c_as_input ()
 Gets a value indicating whether the combination of the Control modifier key and C console key (Ctrl+C) is treated as ordinary input or as an interruption that is handled by the operating system.
 
static bool treat_control_c_as_input (bool treat_control_c_as_input)
 Sets a value indicating whether the combination of the Control modifier key and C console key (Ctrl+C) is treated as ordinary input or as an interruption that is handled by the operating system.
 
static int32_t window_height ()
 Gets the height of the console window area.
 
static bool window_height (int32_t height)
 Sets the height of the console window area.
 
static int32_t window_left ()
 Gets the left of the console window area.
 
static bool window_left (int32_t left)
 Sets the left of the console window area.
 
static int32_t window_top ()
 Gets the top of the console window area.
 
static bool window_top (int32_t top)
 Sets the top of the console window area.
 
static int32_t window_width ()
 Gets the width of the console window area.
 
static bool window_width (int32_t width)
 Sets the width of the console window area.
 

Member Function Documentation

◆ background_color() [1/2]

static int32_t xtd::native::console::background_color ( )
staticprotected

Gets the background color of the console.

Returns
the background console color.
Warning
Internal use only

◆ background_color() [2/2]

static bool xtd::native::console::background_color ( int32_t  color)
staticprotected

Sets the background color of the console.

Parameters
colorthe background console color.
Returns
true if successfull; otherwhise false.
Warning
Internal use only

◆ beep()

static bool xtd::native::console::beep ( uint32_t  frequency,
uint32_t  duration 
)
staticprotected

Plays the sound of a beep of a specified frequency and duration through the console speaker.

Parameters
frequencyThe frequency of the beep, ranging from 37 to 32767 hertz
durationThe duration of the beep measured in milliseconds
Returns
true if successfull; otherwhise false.
Warning
Internal use only

◆ buffer_height() [1/2]

static int32_t xtd::native::console::buffer_height ( )
staticprotected

Gets the height of the buffer area.

Returns
The current height, in rows, of the buffer area.
Warning
Internal use only

◆ buffer_height() [2/2]

static bool xtd::native::console::buffer_height ( int32_t  height)
staticprotected

Sets or sets the height of the buffer area.

Parameters
heightThe current height, in rows, of the buffer area.
Returns
true if successfull; otherwhise false.
Warning
Internal use only

◆ buffer_width() [1/2]

static int32_t xtd::native::console::buffer_width ( )
staticprotected

Gets the width of the buffer area.

Returns
The current width, in columns, of the buffer area.
Warning
Internal use only

◆ buffer_width() [2/2]

static bool xtd::native::console::buffer_width ( int32_t  width)
staticprotected

Sets the width of the buffer area.

Parameters
widthThe current width, in columns, of the buffer area.
Returns
true if successfull; otherwhise false.
Warning
Internal use only

◆ caps_lock()

static bool xtd::native::console::caps_lock ( )
staticprotected

Gets a value indicating whether the CAPS LOCK keyboard toggle is turned on or turned off.

Returns
true if CAPS LOCK is turned on; false if CAPS LOCK is turned off.
Warning
Internal use only

◆ clear()

static bool xtd::native::console::clear ( )
staticprotected

Clears the console buffer and corresponding console window of display information.

Returns
true if successfull; otherwhise false.
Warning
Internal use only

◆ cursor_left()

static int32_t xtd::native::console::cursor_left ( )
staticprotected

Gets the column position of the cursor within the buffer area.

Returns
The current position, in columns, of the cursor.
Warning
Internal use only

◆ cursor_size() [1/2]

static int32_t xtd::native::console::cursor_size ( )
staticprotected

Gets or sets the height of the cursor within a character cell.

Returns
The size of the cursor expressed as a percentage of the height of a character cell. The property value ranges from 1 to 100.
Warning
Internal use only

◆ cursor_size() [2/2]

static bool xtd::native::console::cursor_size ( int32_t  size)
staticprotected

Sets the height of the cursor within a character cell.

Parameters
sizeThe size of the cursor expressed as a percentage of the height of a character cell. The property value ranges from 1 to 100.
Returns
true if successfull; otherwhise false.
Warning
Internal use only

◆ cursor_top()

static int32_t xtd::native::console::cursor_top ( )
staticprotected

Gets the row position of the cursor within the buffer area.

Returns
The current position, in rows, of the cursor.
Warning
Internal use only

◆ cursor_visible() [1/2]

static bool xtd::native::console::cursor_visible ( )
staticprotected

Gets a value indicating whether the cursor is visible.

Returns
true if the cursor is visible; otherwise, false.
Warning
Internal use only

◆ cursor_visible() [2/2]

static bool xtd::native::console::cursor_visible ( bool  visible)
staticprotected

Sets a value indicating whether the cursor is visible.

Parameters
visibletrue if the cursor is visible; otherwise, false.
Returns
true if successfull; otherwhise false.
Warning
Internal use only

◆ echo()

static bool xtd::native::console::echo ( bool  on)
staticprotected

Sets the echo of the console on or off.

Parameters
onif true the echo is on; otherwise is off.
Warning
Internal use only

◆ foreground_color() [1/2]

static int32_t xtd::native::console::foreground_color ( )
staticprotected

Gets the foreground color of the console.

Returns
the foreground console color.
Warning
Internal use only

◆ foreground_color() [2/2]

static bool xtd::native::console::foreground_color ( int32_t  color)
staticprotected

Sets the foreground color of the console.

Parameters
colorthe foreground console color.
Returns
true if successfull; otherwhise false.
Warning
Internal use only

◆ input_code_page() [1/2]

static int32_t xtd::native::console::input_code_page ( )
staticprotected

Gets the code page the console uses to read input.

Returns
The code page used to read console input.
Warning
Internal use only

◆ input_code_page() [2/2]

static bool xtd::native::console::input_code_page ( int32_t  codePage)
staticprotected

Sets the code page the console uses to read input.

Parameters
code_pageThe code page used to read console input.
Returns
true if successfull; otherwhise false.
Warning
Internal use only

◆ key_available()

static bool xtd::native::console::key_available ( )
staticprotected

Gets a value indicating whether a key press is available in the input stream.

Parameters
trueif a key press is available; otherwise, false
Warning
Internal use only

◆ largest_window_height()

static int32_t xtd::native::console::largest_window_height ( )
staticprotected

Gets the largest possible number of console window rows, based on the current font and screen resolution.

Parameters
Theheight of the largest possible console window measured in rows.
Warning
Internal use only

◆ largest_window_width()

static int32_t xtd::native::console::largest_window_width ( )
staticprotected

Gets the largest possible number of console window columns, based on the current font and screen resolution.

Parameters
Thewidth of the largest possible console window measured in columns.
Warning
Internal use only

◆ number_lock()

static bool xtd::native::console::number_lock ( )
staticprotected

Gets a value indicating whether the NUM LOCK keyboard toggle is turned on or turned off.

Parameters
trueif NUM LOCK is turned on; false if NUM LOCK is turned off.
Warning
Internal use only

◆ output_code_page() [1/2]

static int32_t xtd::native::console::output_code_page ( )
staticprotected

Gets the code page the console uses to write output.

Returns
The code page used to write console output.
Warning
Internal use only

◆ output_code_page() [2/2]

static bool xtd::native::console::output_code_page ( int32_t  codePage)
staticprotected

Sets the code page the console uses to write output.

Parameters
code_pageThe code page used to write console output.
Returns
true if successfull; otherwhise false.
Warning
Internal use only

◆ read_key()

static void xtd::native::console::read_key ( char32_t &  key_char,
char32_t &  key_code,
bool &  alt,
bool &  shift,
bool &  ctrl 
)
staticprotected

Obtains the next character or function key pressed by the user.

Parameters
key_charA bitwise combination of the enumeration values. There is no default value.
key_codeA value that identifies the console key that was pressed.
alttrue if alt key modifier is pressed; otherwise false.
shifttrue if shift key modifier is pressed; otherwise false.
ctrltrue if control key modifier is pressed; otherwise false.
Remarks
The five parameters will contains informations on key pressed.
Warning
Internal use only

◆ register_user_cancel_callback()

static void xtd::native::console::register_user_cancel_callback ( std::function< bool(int32_t)>  user_cancel_callback)
staticprotected

Register the user cancel callback.

Parameters
user_cancel_callbackThe user cancel callback method to register.
Remarks
This callback is call when when the Control modifier key (Ctrl) and either the ConsoleKey.C console key (C) or the Break key are pressed simultaneously (Ctrl+C or Ctrl+Break).
By default, the return of callback is false, which causes program execution to terminate when the event handler exits. Changing its return to true specifies that the application should continue to execute.
Warning
Internal use only

◆ reset_color()

static bool xtd::native::console::reset_color ( )
staticprotected

Sets the foreground and background console colors to their defaults.

Remarks
The foreground and background colors are restored to the colors that existed when the current process began. For more information, see the foreground_color and background_color properties.
Returns
true if successfull; otherwhise false.
Warning
Internal use only

◆ set_cursor_position()

static bool xtd::native::console::set_cursor_position ( int32_t  left,
int32_t  top 
)
staticprotected

Sets the position of the cursor.

Parameters
leftThe column position of the cursor. Columns are numbered from left to right starting at 0.
topThe row position of the cursor. Rows are numbered from top to bottom starting at 0.
Returns
true if successfull; otherwhise false.
Warning
Internal use only

◆ title() [1/2]

static std::string xtd::native::console::title ( )
staticprotected

Gets the title to display in the console title bar.

Returns
The string to be displayed in the title bar of the console. The maximum length of the title string is 24500 characters.
Warning
Internal use only

◆ title() [2/2]

static bool xtd::native::console::title ( const std::string &  title)
staticprotected

Sets the title to display in the console title bar.

Parameters
titleThe string to be displayed in the title bar of the console. The maximum length of the title string is 24500 characters.
Returns
true if successfull; otherwhise false.
Warning
Internal use only

◆ treat_control_c_as_input() [1/2]

static bool xtd::native::console::treat_control_c_as_input ( )
staticprotected

Gets a value indicating whether the combination of the Control modifier key and C console key (Ctrl+C) is treated as ordinary input or as an interruption that is handled by the operating system.

Returns
true if Ctrl+C is treated as ordinary input; otherwise, false.
Warning
Internal use only

◆ treat_control_c_as_input() [2/2]

static bool xtd::native::console::treat_control_c_as_input ( bool  treat_control_c_as_input)
staticprotected

Sets a value indicating whether the combination of the Control modifier key and C console key (Ctrl+C) is treated as ordinary input or as an interruption that is handled by the operating system.

Parameters
treat_control_c_as_inputtrue if Ctrl+C is treated as ordinary input; otherwise, false.
Returns
true if successfull; otherwhise false.
Warning
Internal use only

◆ window_height() [1/2]

static int32_t xtd::native::console::window_height ( )
staticprotected

Gets the height of the console window area.

Returns
The height of the console window measured in rows.
Warning
Internal use only

◆ window_height() [2/2]

static bool xtd::native::console::window_height ( int32_t  height)
staticprotected

Sets the height of the console window area.

Parameters
heightThe height of the console window measured in rows.
Returns
true if successfull; otherwhise false.
Warning
Internal use only

◆ window_left() [1/2]

static int32_t xtd::native::console::window_left ( )
staticprotected

Gets the left of the console window area.

Returns
The left of the console window measured in columns.
Warning
Internal use only

◆ window_left() [2/2]

static bool xtd::native::console::window_left ( int32_t  left)
staticprotected

Sets the left of the console window area.

Parameters
leftThe left of the console window measured in columns.
Returns
true if successfull; otherwhise false.
Warning
Internal use only

◆ window_top() [1/2]

static int32_t xtd::native::console::window_top ( )
staticprotected

Gets the top of the console window area.

Returns
The top of the console window measured in rows.
Warning
Internal use only

◆ window_top() [2/2]

static bool xtd::native::console::window_top ( int32_t  top)
staticprotected

Sets the top of the console window area.

Parameters
topThe top of the console window measured in rows.
Returns
true if successfull; otherwhise false.
Warning
Internal use only

◆ window_width() [1/2]

static int32_t xtd::native::console::window_width ( )
staticprotected

Gets the width of the console window area.

Returns
The width of the console window measured in columns.
Warning
Internal use only

◆ window_width() [2/2]

static bool xtd::native::console::window_width ( int32_t  width)
staticprotected

Sets the width of the console window area.

Parameters
widthThe width of the console window measured in columns.
Returns
true if successfull; otherwhise false.
Warning
Internal use only

The documentation for this class was generated from the following file: