xtd_c - Reference Guide 0.2.0
xtd_c.forms

Definition

The xtd_c.forms library contains classes for creating Windows-based applications that take full advantage of the rich user interface features available in the Microsoft Windows operating system, Apple macOS and Linux like Ubuntu operating system.

Data Structures

struct  xtd_forms_control
 Defines the base class for controls, which are components with visual representation. More...
 

Enumerations

enum  xtd_forms_anchor_styles {
  xtd_forms_anchor_styles_none = 0x0,
  xtd_forms_anchor_styles_top = 0x1,
  xtd_forms_anchor_styles_bottom = 0x2,
  xtd_forms_anchor_styles_left = 0x4,
  xtd_forms_anchor_styles_right = 0x8,
  xtd_forms_anchor_styles_all = xtd_forms_anchor_styles_top | xtd_forms_anchor_styles_bottom | xtd_forms_anchor_styles_left | xtd_forms_anchor_styles_right
}
 Specifies how a control anchors to the edges of its container. More...
 
enum  xtd_forms_appearance {
  xtd_forms_appearance_normal = 0,
  xtd_forms_appearance_button = 1,
  xtd_forms_appearance_switch_button = 2
}
 Specifies the appearance of a control. More...
 
enum  xtd_forms_control_appearance {
  xtd_forms_control_appearance_standard = 0,
  xtd_forms_control_appearance_system
}
 Specifies the appearance of a control. More...
 
enum  xtd_forms_dialog_result {
  xtd_forms_dialog_result_none = 0,
  xtd_forms_dialog_result_ok = 1,
  xtd_forms_dialog_result_cancel = 2,
  xtd_forms_dialog_result_abort = 3,
  xtd_forms_dialog_result_retry = 4,
  xtd_forms_dialog_result_ignore = 5,
  xtd_forms_dialog_result_yes = 6,
  xtd_forms_dialog_result_no = 7
}
 Specifies identifiers to indicate the return value of a dialog box. More...
 
enum  xtd_forms_dock_style {
  xtd_forms_dock_style_none = 0,
  xtd_forms_dock_style_top = 1,
  xtd_forms_dock_style_bottom = 2,
  xtd_forms_dock_style_left = 3,
  xtd_forms_dock_style_right = 4,
  xtd_forms_dock_style_fill = 5
}
 Specifies the position and manner in which a control is docked. More...
 

Enumeration Type Documentation

◆ xtd_forms_anchor_styles

Specifies how a control anchors to the edges of its container.

Library
xtd_c.forms
Remarks
This enumeration has a flags attribute that allows a bitwise combination of its member values.
When a control is anchored to an edge of its container, the distance between the control and the specified edge remains constant when the container resizes. For example, if a control is anchored to the right edge of its container, the distance between the right edge of the control and the right edge of the container remains constant when the container resizes. A control can be anchored to any combination of control edges. If the control is anchored to opposite edges of its container (for example, to the top and bottom), it resizes when the container resizes. If a control has its anchor property set to none, the control moves half of the distance that the container of the control is resized. For example, if a button has its anchor property set to none and the form that the control is located on is resized by 20 pixels in either direction, the button will be moved 10 pixels in both directions.
Enumerator
xtd_forms_anchor_styles_none 

no styles.

xtd_forms_anchor_styles_top 

Bind control edges to the top of its container.

xtd_forms_anchor_styles_bottom 

Bind control edges to the bottom of its container.

xtd_forms_anchor_styles_left 

Bind control edges to the left of its container.

xtd_forms_anchor_styles_right 

Bind control edges to the right of its container.

xtd_forms_anchor_styles_all 

All flags except none.

◆ xtd_forms_appearance

Specifies the appearance of a control.

Library
xtd_c.forms
Remarks
Use the members of this enumeration in controls that provide the xtd_forms_control_set_appearance property to set its value.
Enumerator
xtd_forms_appearance_normal 

The default appearance defined by the control class.

xtd_forms_appearance_button 

The appearance of a button.

xtd_forms_appearance_switch_button 

The appearance of a switch button.

◆ xtd_forms_control_appearance

Specifies the appearance of a control.

Namespace
xtd::forms
Library
xtd_c.forms
Enumerator
xtd_forms_control_appearance_standard 

The appearance of the control is determined by current theme of xtd.

xtd_forms_control_appearance_system 

The appearance of the control is determined by the user's operating system.

◆ xtd_forms_dialog_result

Specifies identifiers to indicate the return value of a dialog box.

Library
xtd_c.forms
Remarks
The xtd_forms_button_dialog_result property and the xtd_forms_form_show_dialog method use this enumeration.
Examples
The following code example demonstrates how to display a xtd_forms_message_box_show with the options supported by this method. After verifying that a string variable,
server_name_text 
, is empty or NULL, the example displays a message box, offering the user the option to cancel the operation. If the xtd_forms_message_box_show method's return value evaluates to Yes, the form that displayed the message box is closed.
void validate_user_entry() {
// Checks the value of the text.
if (server_name_text() == NULL || server_name_text()[0] == 0) {
// Initializes the variables to pass to the xtd_forms_message_box_show method.
const char* message = "You did not enter a server name. Cancel this operation?";
const char* caption = "No Server Name Specified";
xtd_forms_message_box_buttons buttons = xtd_forms_message_box_buttons_yes_no;
// Displays the message_box.
result = xtd_forms_message_box_show(main_form, message, caption, buttons, xtd_forms_message_box_icon_none, xtd_forms_message_box_default_button_1, xtd_forms_message_box_options_none, false);
if (result == xtd_forms_dialog_result_yes) {
// Closes the parent form.
close(XTD_FORMS_FORM(main_form));
}
}
}
Enumerator
xtd_forms_dialog_result_none 

Nothing is returned from the dialog box. This means that the modal dialog continues running.

xtd_forms_dialog_result_ok 

The dialog box return value is OK (usually sent from a button labeled OK).

xtd_forms_dialog_result_cancel 

The dialog box return value is Cancel (usually sent from a button labeled Cancel).

xtd_forms_dialog_result_abort 

The dialog box return value is Abort (usually sent from a button labeled Abort).

xtd_forms_dialog_result_retry 

The dialog box return value is Retry (usually sent from a button labeled Retry).

xtd_forms_dialog_result_ignore 

The dialog box return value is Ignore (usually sent from a button labeled Ignore).

xtd_forms_dialog_result_yes 

The dialog box return value is Yes (usually sent from a button labeled Yes).

xtd_forms_dialog_result_no 

The dialog box return value is No (usually sent from a button labeled No).

◆ xtd_forms_dock_style

Specifies the position and manner in which a control is docked.

Namespace
xtd::forms
Library
xtd.forms
Remarks
When a control is docked to an edge of its container, it is always positioned flush against that edge when the container is resized. If more than one control is docked to an edge, the controls appear side by side according to their z-order; controls higher in the z-order are positioned farther from the container's edge.
If left, right, top, or bottom is selected, the specified and opposite edges of the control are resized to the size of the containing control's corresponding edges. If fill is selected, all four sides of the control are resized to match the containing control's edges.
Enumerator
xtd_forms_dock_style_none 

The control is not docked.

xtd_forms_dock_style_top 

The control's top edge is docked to the top of its containing control.

xtd_forms_dock_style_bottom 

The control's bottom edge is docked to the bottom of its containing control.

xtd_forms_dock_style_left 

The control's left edge is docked to the left edge of its containing control.

xtd_forms_dock_style_right 

The control's right edge is docked to the right edge of its containing control.

xtd_forms_dock_style_fill 

All the control's edges are docked to the all edges of its containing control and sized appropriately.