xtd 0.2.0
xtd::forms::ibutton_control Class Referenceabstract

Definition

Allows a control to act like a button on a form.

Header
#include <xtd/forms/ibutton_cntrol>
Namespace
xtd::forms
Library
xtd.forms
Remarks
An example of where this interface might be implemented is default and cancel button processing. Default buttons are notified when an unprocessed ENTER key is entered for a form, just like a dialog box would be closed. Similarly, cancel buttons are notified whenever an unprocessed ESC key is entered on a form, much like a dialog box would be dismissed.
Notes to implementers
Implement this interface in classes that act as button controls. The members of this interface will provide basic button functionality, such as providing a dialog_result to the parent form or the ability to perform a click event, or acting as the default button of a form.

Properties

virtual forms::dialog_result dialog_result () const noexcept=0
 Gets the value returned to the parent form when the button is clicked. More...
 
virtual controldialog_result (forms::dialog_result dialog_result)=0
 Sets the value returned to the parent form when the button is clicked. More...
 

Methods

virtual void notify_default (bool value)=0
 Notifies a control that it is the default button so that its appearance and behavior is adjusted accordingly. More...
 
virtual void perform_click ()=0
 Generates a click event for the control. More...
 

Member Function Documentation

◆ dialog_result() [1/2]

virtual forms::dialog_result xtd::forms::ibutton_control::dialog_result ( ) const
pure virtualnoexcept

Gets the value returned to the parent form when the button is clicked.

Returns
One of the DialogResult values.
Remarks
When a form is shown as a dialog box using the show_dialog method and one of its buttons is clicked, the button's dialog_result value is assigned to the form's dialog_result property.

Implemented in xtd::forms::button.

◆ dialog_result() [2/2]

virtual control& xtd::forms::ibutton_control::dialog_result ( forms::dialog_result  dialog_result)
pure virtual

Sets the value returned to the parent form when the button is clicked.

Parameters
dialog_resultOne of the DialogResult values.
Remarks
When a form is shown as a dialog box using the show_dialog method and one of its buttons is clicked, the button's dialog_result value is assigned to the form's dialog_result property.

Implemented in xtd::forms::button.

◆ notify_default()

virtual void xtd::forms::ibutton_control::notify_default ( bool  value)
pure virtual

Notifies a control that it is the default button so that its appearance and behavior is adjusted accordingly.

Parameters
valuetrue if the control should behave as a default button; otherwise false.
Remarks
This method is called by a parent form to make a control the default button. Default buttons are set to have an extra thick border.

Implemented in xtd::forms::button.

◆ perform_click()

virtual void xtd::forms::ibutton_control::perform_click ( )
pure virtual

Generates a click event for the control.

Remarks
This method is called for the button that has focus, or for the default button (if no other button has focus) when the user presses the ENTER key. This method is also called when the user presses the ESC key if the button is set as the cancel button.

Implemented in xtd::forms::button.


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