Represents a toolbar button.
Public Constructors | |
tool_bar_button () | |
Initialises a new instance of xtd::forms::tool_bar_button class. | |
tool_bar_button (const xtd::string &text) | |
Initializes a new instance of the xtd::forms::tool_bar_button class and displays the assigned text on the button. | |
Public Properties | |
std::optional< xtd::forms::control_ref > | control () const noexcept |
Gets the control to be displayed in the control toolbar button. | |
tool_bar_button & | control (const xtd::forms::control &value) |
Sets the control to be displayed in the control toolbar button. | |
tool_bar_button & | control (std::nullptr_t value) |
Resets the control to be displayed in the control toolbar button. | |
std::optional< std::reference_wrapper< xtd::forms::context_menu > > | drop_down_menu () const noexcept |
Gets the menu to be displayed in the drop-down toolbar button. | |
tool_bar_button & | drop_down_menu (const xtd::forms::context_menu &value) |
Sets the menu to be displayed in the drop-down toolbar button. | |
tool_bar_button & | drop_down_menu (std::nullptr_t value) |
Resets the menu to be displayed in the drop-down toolbar button. | |
bool | enabled () const noexcept |
Gets a value indicating whether the button is enabled. | |
tool_bar_button & | enabled (bool value) |
Sets a value indicating whether the button is enabled. | |
size_t | image_index () const noexcept |
Gets the index value of the image assigned to the button. | |
tool_bar_button & | image_index (size_t value) |
Sets the index value of the image assigned to the button. | |
const xtd::string & | name () const noexcept |
Gets the name of the button. | |
tool_bar_button & | name (const xtd::string &value) |
Sets the name of the button. | |
std::optional< std::reference_wrapper< xtd::forms::tool_bar > > | parent () const noexcept |
Gets the toolbar control that the toolbar button is assigned to. | |
bool | pushed () const noexcept |
Gets a value indicating whether a toggle-style toolbar button is currently in the pushed state. | |
tool_bar_button & | pushed (bool value) |
Sets a value indicating whether a toggle-style toolbar button is currently in the pushed state. | |
const xtd::drawing::rectangle & | rectangle () const noexcept |
Gets the bounding rectangle for a toolbar button. | |
xtd::forms::tool_bar_button_style | style () const noexcept |
Gets the style of the toolbar button. | |
tool_bar_button & | style (xtd::forms::tool_bar_button_style value) |
Sets the style of the toolbar button. | |
std::any | tag () const noexcept |
Gets the object that contains data about the toolbar button. | |
tool_bar_button & | tag (std::any value) |
Sets the object that contains data about the toolbar button. | |
const xtd::string & | text () const noexcept |
Gets the text displayed on the toolbar button. | |
tool_bar_button & | text (const xtd::string &value) |
Sets the text displayed on the toolbar button. | |
const xtd::string & | tool_tip_text () const noexcept |
Gets the text that appears as a xtd::forms::tool_tip for the button. | |
tool_bar_button & | tool_tip_text (const xtd::string &value) |
Sets the text that appears as a xtd::forms::tool_tip for the button. | |
bool | visible () const noexcept |
Gets a value indicating whether the toolbar button is visible. | |
tool_bar_button & | visible (bool value) |
Sets a value indicating whether the toolbar button is visible. | |
Public Methods | |
bool | equals (const tool_bar_button &other) const noexcept override |
xtd::string | to_string () const noexcept override |
Returns a string that represents the xtd::forms::tool_bar_button control. | |
virtual bool | equals (const object &obj) const noexcept |
Determines whether the specified object is equal to the current object. | |
template<typename object_a_t , typename object_b_t > | |
static bool | equals (const object_a_t &object_a, const object_b_t &object_b) noexcept |
Determines whether the specified object instances are considered equal. | |
Public Static Methods | |
static tool_bar_button | create_control (const xtd::string &text, const xtd::forms::control &control) |
A factory to create a control toolbar button with specified text and control. | |
static tool_bar_button | create_control (const xtd::forms::control &control) |
A factory to create a control toolbar button with specified control. | |
static tool_bar_button | create_drop_down_button (const xtd::string &text, const xtd::forms::context_menu &drop_down_menu) |
A factory to create a drop-down toolbar button with specified text and context menu. | |
static tool_bar_button | create_drop_down_button (size_t image_index, const xtd::forms::context_menu &drop_down_menu) |
A factory to create a drop-down toolbar button with specified image index and context menu. | |
static tool_bar_button | create_drop_down_button (const xtd::string &text, size_t image_index, const xtd::forms::context_menu &drop_down_menu) |
A factory to create a drop-down toolbar button with specified text, image index and context menu. | |
static tool_bar_button | create_push_button (const xtd::string &text) |
A factory to create a toolbar button with specified text. | |
static tool_bar_button | create_push_button (size_t image_index) |
A factory to create a toolbar button with specified image index. | |
static tool_bar_button | create_push_button (const xtd::string &text, size_t image_index) |
A factory to create a toolbar button with specified text and image index. | |
static tool_bar_button | create_separator () |
A factory to create a toolbar separator. | |
static tool_bar_button | create_stretchable_separator () |
A factory to create a toolbar stretchable separator. | |
static tool_bar_button | create_toggle_button (const xtd::string &text) |
A factory to create a toolbar toggle button with specified text. | |
static tool_bar_button | create_toggle_button (size_t image_index) |
A factory to create a toolbar toggle button with specified image index. | |
static tool_bar_button | create_toggle_button (const xtd::string &text, size_t image_index) |
A factory to create a toolbar toggle button with specified text and image index. | |
Protected Methods | |
xtd::uptr< xtd::object > | clone () const override |
Creates a new object that is a copy of the current instance. | |
Additional Inherited Members | |
Public Member Functions inherited from xtd::object | |
object ()=default | |
Create a new instance of the ultimate base class object. | |
virtual size_t | get_hash_code () const noexcept |
Serves as a hash function for a particular type. | |
virtual type_object | get_type () const noexcept |
Gets the type of the current instance. | |
template<typename object_t > | |
xtd::uptr< object_t > | memberwise_clone () const |
Creates a shallow copy of the current object. | |
Public Member Functions inherited from xtd::iclonable | |
Public Member Functions inherited from xtd::iequatable< tool_bar_button > | |
virtual bool | equals (const tool_bar_button &) const noexcept=0 |
Indicates whether the current object is equal to another object of the same type. | |
Static Public Member Functions inherited from xtd::object | |
template<typename object_a_t , typename object_b_t > | |
static bool | equals (const object_a_t &object_a, const object_b_t &object_b) noexcept |
Determines whether the specified object instances are considered equal. | |
template<typename object_a_t , typename object_b_t > | |
static bool | reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept |
Determines whether the specified object instances are the same instance. | |
Protected Member Functions inherited from xtd::forms::component | |
component () | |
Initialises a new instance of the component class. | |
virtual bool | can_raise_events () const noexcept |
Gets a value indicating whether the component can raise an event. | |
bool | design_mode () const noexcept |
Gets a value that indicates whether the component is currently in design mode. | |
xtd::forms::tool_bar_button::tool_bar_button | ( | ) |
Initialises a new instance of xtd::forms::tool_bar_button class.
|
explicit |
Initializes a new instance of the xtd::forms::tool_bar_button class and displays the assigned text on the button.
text | The text to display on the new xtd::forms::tool_bar_button. |
|
noexcept |
Gets the control to be displayed in the control toolbar button.
tool_bar_button & xtd::forms::tool_bar_button::control | ( | const xtd::forms::control & | value | ) |
Sets the control to be displayed in the control toolbar button.
value | A xtd::forms::control to be displayed in the control toolbar button. The default is std::nullopt. |
tool_bar_button & xtd::forms::tool_bar_button::control | ( | std::nullptr_t | value | ) |
Resets the control to be displayed in the control toolbar button.
value | nullptr. |
|
noexcept |
Gets the menu to be displayed in the drop-down toolbar button.
tool_bar_button & xtd::forms::tool_bar_button::drop_down_menu | ( | const xtd::forms::context_menu & | value | ) |
Sets the menu to be displayed in the drop-down toolbar button.
value | A xtd::forms::context_menu to be displayed in the drop-down toolbar button. The default is std::nullopt. |
tool_bar_button & xtd::forms::tool_bar_button::drop_down_menu | ( | std::nullptr_t | value | ) |
Resets the menu to be displayed in the drop-down toolbar button.
value | nullptr. |
|
noexcept |
Gets a value indicating whether the button is enabled.
tool_bar_button & xtd::forms::tool_bar_button::enabled | ( | bool | value | ) |
Sets a value indicating whether the button is enabled.
value | true if the button is enabled; otherwise, false. The default is true. |
|
noexcept |
Gets the index value of the image assigned to the button.
tool_bar_button & xtd::forms::tool_bar_button::image_index | ( | size_t | value | ) |
Sets the index value of the image assigned to the button.
value | The index value of the xtd::drawing::image assigned to the toolbar button. The default is xtd::forms::image_list::image_collection::npos. |
|
noexcept |
Gets the name of the button.
tool_bar_button & xtd::forms::tool_bar_button::name | ( | const xtd::string & | value | ) |
Sets the name of the button.
value | The name of the button. |
|
noexcept |
Gets the toolbar control that the toolbar button is assigned to.
|
noexcept |
Gets a value indicating whether a toggle-style toolbar button is currently in the pushed state.
tool_bar_button & xtd::forms::tool_bar_button::pushed | ( | bool | value | ) |
Sets a value indicating whether a toggle-style toolbar button is currently in the pushed state.
value | rue if a toggle-style toolbar button is currently in the pushed state; otherwise, false. The default is false. |
|
noexcept |
Gets the bounding rectangle for a toolbar button.
|
noexcept |
Gets the style of the toolbar button.
tool_bar_button & xtd::forms::tool_bar_button::style | ( | xtd::forms::tool_bar_button_style | value | ) |
Sets the style of the toolbar button.
value | One of the xtd::forms::tool_bar_button_style values. The default is xtd::forms::tool_bar_button_style::push_button. |
|
noexcept |
Gets the object that contains data about the toolbar button.
tool_bar_button & xtd::forms::tool_bar_button::tag | ( | std::any | value | ) |
Sets the object that contains data about the toolbar button.
value | An std::any that contains data about the toolbar button. The default is empty. |
|
noexcept |
Gets the text displayed on the toolbar button.
tool_bar_button & xtd::forms::tool_bar_button::text | ( | const xtd::string & | value | ) |
Sets the text displayed on the toolbar button.
value | The text displayed on the toolbar button. The default is an empty string (""). |
|
noexcept |
Gets the text that appears as a xtd::forms::tool_tip for the button.
tool_bar_button & xtd::forms::tool_bar_button::tool_tip_text | ( | const xtd::string & | value | ) |
Sets the text that appears as a xtd::forms::tool_tip for the button.
value | The text that is displayed when the mouse pointer moves over the toolbar button. The default is an empty string (""). |
|
noexcept |
Gets a value indicating whether the toolbar button is visible.
tool_bar_button & xtd::forms::tool_bar_button::visible | ( | bool | value | ) |
Sets a value indicating whether the toolbar button is visible.
value | true if the toolbar button is visible; otherwise, false. The default is true. |
|
overridevirtualnoexcept |
Returns a string that represents the xtd::forms::tool_bar_button control.
Reimplemented from xtd::object.
|
static |
A factory to create a control toolbar button with specified text and control.
text | The text displayed on the toolbar button. |
control | A xtd::forms::control to be displayed in the control toolbar button. |
|
static |
A factory to create a control toolbar button with specified control.
control | A xtd::forms::control to be displayed in the control toolbar button. |
|
static |
A factory to create a drop-down toolbar button with specified text and context menu.
text | The text displayed on the toolbar button. |
drop_down_menu | A xtd::forms::context_menu to be displayed in the drop-down toolbar button. |
|
static |
A factory to create a drop-down toolbar button with specified image index and context menu.
image_index | The index value of the xtd::drawing::image assigned to the toolbar button. |
drop_down_menu | A xtd::forms::context_menu to be displayed in the drop-down toolbar button. |
|
static |
A factory to create a drop-down toolbar button with specified text, image index and context menu.
text | The text displayed on the toolbar button. |
image_index | The index value of the xtd::drawing::image assigned to the toolbar button. |
drop_down_menu | A xtd::forms::context_menu to be displayed in the drop-down toolbar button. |
|
static |
A factory to create a toolbar button with specified text.
text | The text displayed on the toolbar button. |
|
static |
A factory to create a toolbar button with specified image index.
image_index | The index value of the xtd::drawing::image assigned to the toolbar button. |
|
static |
A factory to create a toolbar button with specified text and image index.
text | The text displayed on the toolbar button. |
image_index | The index value of the xtd::drawing::image assigned to the toolbar button. |
|
static |
A factory to create a toolbar separator.
|
static |
A factory to create a toolbar stretchable separator.
|
static |
A factory to create a toolbar toggle button with specified text.
text | The text displayed on the toolbar button. |
|
static |
A factory to create a toolbar toggle button with specified image index.
image_index | The index value of the xtd::drawing::image assigned to the toolbar button. |
|
static |
A factory to create a toolbar toggle button with specified text and image index.
text | The text displayed on the toolbar button. |
image_index | The index value of the xtd::drawing::image assigned to the toolbar button. |
|
overrideprotectedvirtual |
Creates a new object that is a copy of the current instance.
Implements xtd::iclonable.
|
virtualnoexcept |
Determines whether the specified object is equal to the current object.
obj | The object to compare with the current object. |
Reimplemented from xtd::object.
|
inlinestaticnoexcept |
Determines whether the specified object instances are considered equal.
object_a | The first object to compare. |
object_b | The second object to compare. |