xtd 0.2.0
Loading...
Searching...
No Matches
xtd::forms::native::control Class Referencefinal
Inheritance diagram for xtd::forms::native::control:
xtd::static_object

Definition

Contains control native API.

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

Protected Static Methods

static void back_color (intptr control, const drawing::color &color)
 Sets the background color for the control.
 
static drawing::rectangle client_rectangle (intptr control)
 Gets the rectangle that represents the client area of the control.
 
static drawing::size client_size (intptr control)
 Gets the height and width of the client area of the control.
 
static void client_size (intptr control, const drawing::size &size)
 Sets the height and width of the client area of the control.
 
static void context_menu (intptr control, intptr context_menu, const xtd::drawing::point &pos)
 Sets the context that is displayed in the control.
 
static intptr user_context_menu (intptr control, intptr context_menu, const xtd::drawing::point &pos)
 Displays the shortcut menu at the specified position.
 
static intptr create (const create_params &create_params)
 Creates control.
 
static intptr create_graphics (intptr control)
 Creates a graphics for the control.
 
static intptr create_paint_graphics (intptr control)
 Creates a graphics for the xtd::forms::control::paint event control.
 
static intptr create_double_buffered_paint_graphics (intptr control)
 Creates a graphics for the double buffer xtd::forms::control::paint event control.
 
static void cursor (intptr control, intptr cursor)
 Sets the cursor that is displayed when the mouse pointer is over the control.
 
static intptr def_wnd_proc (intptr control, intptr hwnd, uint32 msg, intptr wparam, intptr lparam, intptr result, intptr handle)
 Sends the specified message to the default window procedure.
 
static xtd::drawing::size default_size (const xtd::string &class_name)
 Gets the default height and default width for the specified class name.
 
static void destroy (intptr control)
 Destroys context menu.
 
static void double_buffered (intptr control, bool value)
 Sets a value indicating whether this control should redraw its surface using a secondary buffer to reduce or prevent flicker.
 
static bool enabled (intptr control)
 Gets a value indicating whether the control can respond to user interaction.
 
static void enabled (intptr control, bool enabled)
 Sets a value indicating whether the control can respond to user interaction.
 
static void focus (intptr control)
 Sets input focus to the control.
 
static bool focused (intptr control)
 Gets a value indicating whether the control has input focus.
 
static void fore_color (intptr control, const drawing::color &color)
 Sets the foreground color of the control.
 
static void font (intptr control, const drawing::font &font)
 Sets the font of the text displayed by the control.
 
static intptr native_handle (intptr control)
 Gets the native handle of the control.
 
static void invalidate (intptr control, const drawing::rectangle &rec, bool invalidate_children)
 Invalidates the entire surface of the control and causes the control to be redrawn.
 
static void invalidate (intptr control, const drawing::region &region, bool invalidate_children)
 Invalidates the entire surface of the control and causes the control to be redrawn.
 
static void invoke_in_control_thread (intptr control, delegate< void(std::vector< std::any >)> invoker, const std::vector< std::any > &args, xtd::sptr< xtd::threading::manual_reset_event > invoked, xtd::sptr< bool > completed)
 Executes the specified delegate, on the thread that owns the control's underlying window handle, with the specified list of arguments and mutex.
 
static drawing::point location (intptr control)
 Gets the coordinates of the upper-left corner of the control relative to the upper-left corner of its container.
 
static void location (intptr control, const drawing::point &location)
 Sets the coordinates of the upper-left corner of the control relative to the upper-left corner of its container.
 
static void maximum_client_size (intptr control, const drawing::size &size)
 Sets the maximum height and maximum width of the client area of the control.
 
static void maximum_size (intptr control, const drawing::size &size)
 Sets the maximum height and maximum width of the control.
 
static void minimum_client_size (intptr control, const drawing::size &size)
 Sets the minimum height and minimum width of the client area of the control.
 
static void minimum_size (intptr control, const drawing::size &size)
 Sets the minimum height and minimum width of the control.
 
static drawing::point point_to_client (intptr control, const drawing::point &p)
 Computes the location of the specified screen point into client coordinates.
 
static drawing::point point_to_screen (intptr control, const drawing::point &p)
 Computes the location of the specified client point into screen coordinates.
 
static void register_wnd_proc (intptr control, const delegate< intptr(intptr, int32, intptr, intptr, intptr)> &wnd_proc)
 Register a specified wnd proc from the message pump of the control.
 
static void resume_layout (intptr control)
 Resumes usual layout logic.
 
static void right_to_left (intptr control, int32 value)
 Sets a value indicating whether control's elements are aligned to support locales using right-to-left fonts.
 
static intptr send_message (intptr control, intptr hwnd, int32 msg, intptr wParam, intptr lParam)
 Send a message with specified hwnd, message, wparam and lparam.
 
static drawing::size size (intptr control)
 Gets the height and width of the control.
 
static void size (intptr control, const drawing::size &size)
 Sets the height and width of the control.
 
static void suspend_layout (intptr control)
 Temporarily suspends the layout logic for the control.
 
static xtd::string text (intptr control)
 Gets the text associated with this control.
 
static void text (intptr control, const xtd::string &text)
 Sets the text associated with this control.
 
static intptr toolkit_handle (intptr control)
 Gets the toolkit handle of the control.
 
static void unregister_wnd_proc (intptr control)
 Unregister the wnd proc previously registered.
 
static void update (intptr control)
 Causes the control to redraw the invalidated regions within its client area.
 
static bool visible (intptr control)
 Gets a value indicating whether the control and all its child controls are displayed.
 
static void visible (intptr control, bool visible)
 Sets a value indicating whether the control and all its child controls are displayed.
 
static xtd::string message_to_string (uint32 id)
 Convert message identifiers to a string.
 

Member Function Documentation

◆ back_color()

static void xtd::forms::native::control::back_color ( intptr  control,
const drawing::color color 
)
staticprotected

Sets the background color for the control.

Parameters
controlControl window handle.
colorA xtd::drawing::color that represents the background color of the control.
Warning
Internal use only

◆ client_rectangle()

static drawing::rectangle xtd::forms::native::control::client_rectangle ( intptr  control)
staticprotected

Gets the rectangle that represents the client area of the control.

Parameters
controlControl window handle.
Returns
A rectangle that represents the client area of the control.
Warning
Internal use only

◆ client_size() [1/2]

static drawing::size xtd::forms::native::control::client_size ( intptr  control)
staticprotected

Gets the height and width of the client area of the control.

Parameters
controlControl window handle.
Returns
A size that represents the dimensions of the client area of the control.
Warning
Internal use only
Todo:
Check the redundancy with client_rectangle method.

◆ client_size() [2/2]

static void xtd::forms::native::control::client_size ( intptr  control,
const drawing::size size 
)
staticprotected

Sets the height and width of the client area of the control.

Parameters
controlControl window handle.
sizeA size that represents the dimensions of the client area of the control.
Warning
Internal use only

◆ context_menu()

static void xtd::forms::native::control::context_menu ( intptr  control,
intptr  context_menu,
const xtd::drawing::point pos 
)
staticprotected

Sets the context that is displayed in the control.

Parameters
controlControl handle.
menuA menu handle that represents the menu to display in the form.
Warning
Internal use only

◆ user_context_menu()

static intptr xtd::forms::native::control::user_context_menu ( intptr  control,
intptr  context_menu,
const xtd::drawing::point pos 
)
staticprotected

Displays the shortcut menu at the specified position.

Parameters
controlA control handle that specifies the control with which this shortcut menu is associated.
context_menuA context menu handle that specifies the menu is associated.
posA xtd::drawing::point that specifies the coordinates at which to display the menu. These coordinates are specified relative to the client coordinates of the control specified in the control parameter.
Returns
Id corresponding to menu_item handle selected.
Warning
Internal use only

◆ create()

static intptr xtd::forms::native::control::create ( const create_params create_params)
staticprotected

Creates control.

Parameters
create_paramA xtd::forms::create_param object that contains needed parameters to create control.
Returns
The created control window handle.
Remarks
For creating controls, some xtd::forms::create_params members are filled in as follow :
Control xtd::forms::create_params::class_name xtd::forms::create_params::style
xtd::forms::button "button" button_styles.h and window_styles.h bitwise combination
xtd::forms::check_box "checkbox" button_styles.h and window_styles.h bitwise combination
xtd::forms::checked_list_box "checkedlistbox" window_styles.h bitwise combination
xtd::forms::choice "choice" window_styles.h bitwise combination
xtd::forms::collapsible_panel "collapsiblepanel" window_styles.h bitwise combination
xtd::forms::color_picker "colorpicker" window_styles.h bitwise combination
xtd::forms::combo_box "combobox" combo_box_styles.h and window_styles.h bitwise combination
xtd::forms::command_link_button "commandlinkbutton" window_styles.h bitwise combination
xtd::forms::date_time_picker "datetimepicker" window_styles.h bitwise combination
xtd::forms::domain_up_down "domainupdown" window_styles.h bitwise combination
xtd::forms::font_picker "fontpicker" window_styles.h bitwise combination
xtd::forms::form "form" window_styles.h bitwise combination
xtd::forms::group_box "groupbox" button_styles.h and window_styles.h bitwise combination
xtd::forms::label "label" window_styles.h bitwise combination
xtd::forms::list_box "listbox" list_box_styles.h and window_styles.h bitwise combination
xtd::forms::loading_indicator "loadingindicator" window_styles.h bitwise combination
xtd::forms::numeric_up_down "numericupdown" window_styles.h bitwise combination
xtd::forms::panel "panel" window_styles.h bitwise combination
xtd::forms::picture_box "picturebox" window_styles.h bitwise combination
xtd::forms::progress_bar "progressbar" progress_bar_styles.h and window_styles.h bitwise combination
xtd::forms::radio_button "radiobutton" button_styles.h and window_styles.h bitwise combination
xtd::forms::scrollbar "scrollbar" scroll_bar_styles.h and window_styles.h bitwise combination
xtd::forms::switch_button "switchbutton" button_styles.h and window_styles.h bitwise combination
xtd::forms::tab_control "tabcontrol" tab_control_styles.h and window_styles.h bitwise combination
xtd::forms::tab_page "tabpage" window_styles.h bitwise combination
xtd::forms::text_box "textbox" window_styles.h bitwise combination
xtd::forms::toggle_button "togglebutton" button_styles.h and window_styles.h bitwise combination
xtd::forms::track_bar "trackbar" track_bar_styles.h and window_styles.h bitwise combination
xtd::forms::up_down_button "updownbutton" button_styles.h and window_styles.h bitwise combination
xtd::forms::user_control "usercontrol" window_styles.h bitwise combination
Read xtd::forms::create_params for other members.
Note
For more portability and compatibility with underlying toolkits, xtd::forms::create_params::class_name does not contains real Windows names like WC_DIALOG, WC_BUTTON,...
Warning
Internal use only

◆ create_graphics()

static intptr xtd::forms::native::control::create_graphics ( intptr  control)
staticprotected

Creates a graphics for the control.

Parameters
controlControl window handle.
Returns
A graphics handle for the control.
Warning
Internal use only

◆ create_paint_graphics()

static intptr xtd::forms::native::control::create_paint_graphics ( intptr  control)
staticprotected

Creates a graphics for the xtd::forms::control::paint event control.

Parameters
controlControl window handle.
Returns
A graphics handle for the xtd::forms::control::paint event control.
Warning
Internal use only

◆ create_double_buffered_paint_graphics()

static intptr xtd::forms::native::control::create_double_buffered_paint_graphics ( intptr  control)
staticprotected

Creates a graphics for the double buffer xtd::forms::control::paint event control.

Parameters
controlControl window handle.
Returns
A graphics handle for the double buffered xtd::forms::control::paint event control.
Warning
Internal use only

◆ cursor()

static void xtd::forms::native::control::cursor ( intptr  control,
intptr  cursor 
)
staticprotected

Sets the cursor that is displayed when the mouse pointer is over the control.

Parameters
controlControl window handle.
cursorA cursor handle that represents the cursor to display when the mouse pointer is over the control.
Warning
Internal use only

◆ def_wnd_proc()

static intptr xtd::forms::native::control::def_wnd_proc ( intptr  control,
intptr  hwnd,
uint32  msg,
intptr  wparam,
intptr  lparam,
intptr  result,
intptr  handle 
)
staticprotected

Sends the specified message to the default window procedure.

Parameters
controlControl window handle.
hwndThe window handle of the message.
msgThe ID number for the message.
wparamThe wparam field of the message.
lparamThe lparam field of the message.
resultThe return value of the message.
handleThe handle on specific operating system data
Returns
The result of def_wnd_proc message.
Warning
Internal use only

◆ default_size()

static xtd::drawing::size xtd::forms::native::control::default_size ( const xtd::string class_name)
staticprotected

Gets the default height and default width for the specified class name.

Parameters
class_nameThe name of the Windows class to derive the control from.
Returns
The default size that represents the default height and default width of the control in pixels.
Remarks
The class name is the same as the one used to create the control with the xtd::forms::create_params class.
The following table contains the default width and height in pixels for class name :
class name Width Height
"button" 75 25
"checkbox" 104 25
"checkedlistbox" 120 90
"choice" 130 25
"collapsiblepanel" 0 0
"colorpicker" 104 25
"combobox" 130 23 *
"commandlinkbutton" 200 60
"datetimepicker" 104 25 **
"domainupdown" 150 23 **
"fontpicker" 104 25
"form" 300 300
"groupbox" 200 100
"label" 100 23
"lightbutton" 75 25
"listbox" 120 96
"loadingindicator" 32 32
"monthcalendar" 240 162
"numericupdown" 120 23 **
"panel" 200 100
"picturebox" 100 50
"popup_panel" 100 150
"progressbar" 100 23
"radiobutton" 104 25
"scrollbar" 17 17
"statusbar" 100 23
"switchbutton" 50 25
"tabcontrol" 200 100
"tabpage" 200 100
"textbox" 100 23
"togglebutton" 104 25
"toolbar" 100 23
"trackbar" 104 45
"updownbutton" 18 *** 34
"usercontrol" 150 150
other 0 0

** is 21 on "macos" environment *** is 34 on "gnome" environment **** is 71 on "gnome" environment

Warning
Internal use only

◆ destroy()

static void xtd::forms::native::control::destroy ( intptr  control)
staticprotected

Destroys context menu.

Parameters
controlControl window handle to destroy.
Warning
Internal use only

◆ double_buffered()

static void xtd::forms::native::control::double_buffered ( intptr  control,
bool  value 
)
staticprotected

Sets a value indicating whether this control should redraw its surface using a secondary buffer to reduce or prevent flicker.

Parameters
controlControl window handle.
valuetrue if the surface of the control should be drawn using double buffering; otherwise, false.
Warning
Internal use only

◆ enabled() [1/2]

static bool xtd::forms::native::control::enabled ( intptr  control)
staticprotected

Gets a value indicating whether the control can respond to user interaction.

Parameters
controlControl window handle.
Returns
true if the control can respond to user interaction; otherwise, false.
Warning
Internal use only

◆ enabled() [2/2]

static void xtd::forms::native::control::enabled ( intptr  control,
bool  enabled 
)
staticprotected

Sets a value indicating whether the control can respond to user interaction.

Parameters
controlControl window handle.
enabledtrue if the control can respond to user interaction; otherwise, false.
Warning
Internal use only

◆ focus()

static void xtd::forms::native::control::focus ( intptr  control)
staticprotected

Sets input focus to the control.

Parameters
controlControl window handle.
Warning
Internal use only

◆ focused()

static bool xtd::forms::native::control::focused ( intptr  control)
staticprotected

Gets a value indicating whether the control has input focus.

Parameters
controlControl window handle.
Returns
true if the control has focus; otherwise, false.
Warning
Internal use only

◆ fore_color()

static void xtd::forms::native::control::fore_color ( intptr  control,
const drawing::color color 
)
staticprotected

Sets the foreground color of the control.

Parameters
controlControl window handle.
colorThe foreground color of the control.
Warning
Internal use only

◆ font()

static void xtd::forms::native::control::font ( intptr  control,
const drawing::font font 
)
staticprotected

Sets the font of the text displayed by the control.

Parameters
controlControl window handle.
fontThe xtd::drawing::font to apply to the text displayed by the control.
Warning
Internal use only

◆ native_handle()

static intptr xtd::forms::native::control::native_handle ( intptr  control)
staticprotected

Gets the native handle of the control.

Parameters
controlControl window handle.
Returns
The native handle.
Warning
Internal use only

◆ invalidate() [1/2]

static void xtd::forms::native::control::invalidate ( intptr  control,
const drawing::rectangle rec,
bool  invalidate_children 
)
staticprotected

Invalidates the entire surface of the control and causes the control to be redrawn.

Parameters
controlControl window handle.
rectA xtd::drawing::rectangle that represents the region to invalidate.
invalidate_childrentrue to invalidate the control's child controls; otherwise, false.
Warning
Internal use only

◆ invalidate() [2/2]

static void xtd::forms::native::control::invalidate ( intptr  control,
const drawing::region region,
bool  invalidate_children 
)
staticprotected

Invalidates the entire surface of the control and causes the control to be redrawn.

Parameters
controlControl window handle.
regionA xtd::drawing::region that represents the region to invalidate.
invalidate_childrentrue to invalidate the control's child controls; otherwise, false.
Warning
Internal use only

◆ invoke_in_control_thread()

static void xtd::forms::native::control::invoke_in_control_thread ( intptr  control,
delegate< void(std::vector< std::any >)>  invoker,
const std::vector< std::any > &  args,
xtd::sptr< xtd::threading::manual_reset_event invoked,
xtd::sptr< bool >  completed 
)
staticprotected

Executes the specified delegate, on the thread that owns the control's underlying window handle, with the specified list of arguments and mutex.

Parameters
controlControl window handle.
invokerA delegate to a method that takes parameters of the same number and type that are contained in the args parameter.
argsAn array of objects to pass as arguments to the specified method. This parameter can be null if the method takes no arguments.
invokedA mutex for async invoke.
Remarks
Signal mutex when invoke is done.
Warning
Internal use only

◆ location() [1/2]

static drawing::point xtd::forms::native::control::location ( intptr  control)
staticprotected

Gets the coordinates of the upper-left corner of the control relative to the upper-left corner of its container.

Parameters
controlControl window handle.
Returns
The point that represents the upper-left corner of the control relative to the upper-left corner of its container.
Warning
Internal use only

◆ location() [2/2]

static void xtd::forms::native::control::location ( intptr  control,
const drawing::point location 
)
staticprotected

Sets the coordinates of the upper-left corner of the control relative to the upper-left corner of its container.

Parameters
controlControl window handle.
location
Warning
Internal use only

◆ maximum_client_size()

static void xtd::forms::native::control::maximum_client_size ( intptr  control,
const drawing::size size 
)
staticprotected

Sets the maximum height and maximum width of the client area of the control.

Parameters
controlControl window handle.
sizeThe size that represents the height and width of the control in pixels.
Warning
Internal use only

◆ maximum_size()

static void xtd::forms::native::control::maximum_size ( intptr  control,
const drawing::size size 
)
staticprotected

Sets the maximum height and maximum width of the control.

Parameters
controlControl window handle.
sizeThe size that represents the height and width of the control in pixels.
Warning
Internal use only

◆ minimum_client_size()

static void xtd::forms::native::control::minimum_client_size ( intptr  control,
const drawing::size size 
)
staticprotected

Sets the minimum height and minimum width of the client area of the control.

Parameters
controlControl window handle.
sizeThe size that represents the height and width of the control in pixels.
Warning
Internal use only

◆ minimum_size()

static void xtd::forms::native::control::minimum_size ( intptr  control,
const drawing::size size 
)
staticprotected

Sets the minimum height and minimum width of the control.

Parameters
controlControl window handle.
sizeThe size that represents the height and width of the control in pixels.
Warning
Internal use only

◆ point_to_client()

static drawing::point xtd::forms::native::control::point_to_client ( intptr  control,
const drawing::point p 
)
staticprotected

Computes the location of the specified screen point into client coordinates.

Parameters
controlControl window handle.
pThe screen coordinate xtd::drawing::point to convert.
Returns
A xtd::drawing::point that represents the converted xtd::drawing::point, p, in client coordinates.
Warning
Internal use only

◆ point_to_screen()

static drawing::point xtd::forms::native::control::point_to_screen ( intptr  control,
const drawing::point p 
)
staticprotected

Computes the location of the specified client point into screen coordinates.

Parameters
controlControl window handle.
pThe client coordinate xtd::drawing::point to convert.
Returns
A xtd::drawing::point that represents the converted xtd::drawing::point, p, in screen coordinates.
Warning
Internal use only

◆ register_wnd_proc()

static void xtd::forms::native::control::register_wnd_proc ( intptr  control,
const delegate< intptr(intptr, int32, intptr, intptr, intptr)> &  wnd_proc 
)
staticprotected

Register a specified wnd proc from the message pump of the control.

Parameters
controlControl window handle.
wnd_procA wnd proc delegate to register.
Warning
Internal use only

◆ resume_layout()

static void xtd::forms::native::control::resume_layout ( intptr  control)
staticprotected

Resumes usual layout logic.

Parameters
controlControl window handle.
Warning
Internal use only

◆ right_to_left()

static void xtd::forms::native::control::right_to_left ( intptr  control,
int32  value 
)
staticprotected

Sets a value indicating whether control's elements are aligned to support locales using right-to-left fonts.

Parameters
controlControl window handle.
valueThe 0, 1 or 2 value.
Remarks
Possible value for value parameter :
value state
0 no
1 yes
2 inherit
Warning
Internal use only

◆ send_message()

static intptr xtd::forms::native::control::send_message ( intptr  control,
intptr  hwnd,
int32  msg,
intptr  wParam,
intptr  lParam 
)
staticprotected

Send a message with specified hwnd, message, wparam and lparam.

Parameters
controlControl window handle.
hwndThe window handle of the message.
msgThe ID number for the message.
wparamThe WParam field of the message.
lparamThe LParam field of the message.
Returns
The return value of the message.
Warning
Internal use only

◆ size() [1/2]

static drawing::size xtd::forms::native::control::size ( intptr  control)
staticprotected

Gets the height and width of the control.

Parameters
controlControl window handle.
Returns
The size that represents the height and width of the control in pixels.
Warning
Internal use only

◆ size() [2/2]

static void xtd::forms::native::control::size ( intptr  control,
const drawing::size size 
)
staticprotected

Sets the height and width of the control.

Parameters
controlControl window handle.
sizeThe size that represents the height and width of the control in pixels.
Warning
Internal use only

◆ suspend_layout()

static void xtd::forms::native::control::suspend_layout ( intptr  control)
staticprotected

Temporarily suspends the layout logic for the control.

Parameters
controlControl window handle.
Warning
Internal use only

◆ text() [1/2]

static xtd::string xtd::forms::native::control::text ( intptr  control)
staticprotected

Gets the text associated with this control.

Parameters
controlControl window handle.
Returns
The text associated with this control.
Warning
Internal use only

◆ text() [2/2]

static void xtd::forms::native::control::text ( intptr  control,
const xtd::string text 
)
staticprotected

Sets the text associated with this control.

Parameters
controlControl window handle.
textThe text associated with this control.
Warning
Internal use only

◆ toolkit_handle()

static intptr xtd::forms::native::control::toolkit_handle ( intptr  control)
staticprotected

Gets the toolkit handle of the control.

Parameters
controlControl window handle.
Returns
The toolkit handle.
Warning
Internal use only

◆ unregister_wnd_proc()

static void xtd::forms::native::control::unregister_wnd_proc ( intptr  control)
staticprotected

Unregister the wnd proc previously registered.

Parameters
controlControl window handle.
Warning
Internal use only

◆ update()

static void xtd::forms::native::control::update ( intptr  control)
staticprotected

Causes the control to redraw the invalidated regions within its client area.

Parameters
controlControl window handle.
Warning
Internal use only

◆ visible() [1/2]

static bool xtd::forms::native::control::visible ( intptr  control)
staticprotected

Gets a value indicating whether the control and all its child controls are displayed.

Parameters
controlControl window handle.
Returns
true if the control and all its child controls are displayed; otherwise, false.
Warning
Internal use only

◆ visible() [2/2]

static void xtd::forms::native::control::visible ( intptr  control,
bool  visible 
)
staticprotected

Sets a value indicating whether the control and all its child controls are displayed.

Parameters
controlControl window handle.
visibletrue if the control and all its child controls are displayed; otherwise, false.
Warning
Internal use only

◆ message_to_string()

static xtd::string xtd::forms::native::control::message_to_string ( uint32  id)
inlinestaticprotected

Convert message identifiers to a string.

Parameters
controlControl window handle.
idAn int32 message id.
Returns
A string that represent the message id.
Notes for xtd developers
This method is not an API. It is needed only for debug.
Warning
Internal use only

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