xtd 0.2.0
Loading...
Searching...
No Matches
tool_bar_button.h
Go to the documentation of this file.
1
4#pragma once
5#include "component.h"
6#include "const_control_ref.h"
7#include "context_menu.h"
8#include "control_ref.h"
9#include "image_list.h"
10#include "tool_bar_button_ref.h"
12#include <xtd/event>
13#include <xtd/event_handler>
14#include <xtd/iclonable>
15#include <xtd/iequatable>
16
18namespace xtd {
20 namespace forms {
22 class control;
23 class tool_bar;
25
41 class tool_bar_button : public xtd::forms::component, public xtd::iclonable, public xtd::iequatable<tool_bar_button> {
42 struct data;
43
44 public:
46
56
58 tool_bar_button(const tool_bar_button&) noexcept = default;
59 tool_bar_button(tool_bar_button&&) noexcept = default;
60 tool_bar_button& operator =(const tool_bar_button&) noexcept = default;
62
64
69 std::optional<xtd::forms::control_ref> control() const noexcept;
79 tool_bar_button& control(std::nullptr_t value);
80
84 std::optional<std::reference_wrapper<xtd::forms::context_menu>> drop_down_menu() const noexcept;
94 tool_bar_button& drop_down_menu(std::nullptr_t value);
95
99 bool enabled() const noexcept;
105
109 size_t image_index() const noexcept;
115
119 const xtd::ustring& name() const noexcept;
125
128 std::optional<std::reference_wrapper<xtd::forms::tool_bar>> parent() const noexcept;
129
133 bool pushed() const noexcept;
139
143 const xtd::drawing::rectangle& rectangle() const noexcept;
144
154
158 std::any tag() const noexcept;
163 tool_bar_button& tag(std::any value);
164
168 const xtd::ustring& text() const noexcept;
174
178 const xtd::ustring& tool_tip_text() const noexcept;
184
188 bool visible() const noexcept;
195
197
199 bool equals(const tool_bar_button& other) const noexcept override;
200
204 xtd::ustring to_string() const noexcept override;
206
208
219
236
250
254
258
273
274 protected:
276
282 std::unique_ptr<xtd::object> clone() const override;
284
285 private:
286 friend xtd::forms::tool_bar;
287 std::shared_ptr<data> data_;
288 };
289 }
290}
Provides the base implementation and enables object sharing between applications.
Definition component.h:23
Represents a shortcut menu.
Definition context_menu.h:34
Defines the base class for controls, which are components with visual representation.
Definition control.h:79
Represents a toolbar button.
Definition tool_bar_button.h:41
static tool_bar_button create_stretchable_separator()
A factory to create a toolbar stretchable separator.
bool enabled() const noexcept
Gets a value indicating whether the button is enabled.
tool_bar_button()
Initialises a new instance of xtd::forms::tool_bar_button class.
bool visible() const noexcept
Gets a value indicating whether the toolbar button is visible.
bool pushed() const noexcept
Gets a value indicating whether a toggle-style toolbar button is currently in the pushed state.
static tool_bar_button create_separator()
A factory to create a toolbar separator.
static tool_bar_button create_drop_down_button(const xtd::ustring &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_toggle_button(const xtd::ustring &text)
A factory to create a toolbar toggle button with specified text.
static tool_bar_button create_control(const xtd::ustring &text, const xtd::forms::control &control)
A factory to create a control toolbar button with specified text and control.
const xtd::ustring & name() const noexcept
Gets the name of the button.
tool_bar_button(const xtd::ustring &text)
Initializes a new instance of the xtd::forms::tool_bar_button class and displays the assigned text on...
xtd::forms::tool_bar_button_style style() const noexcept
Gets the style of the toolbar button.
std::any tag() const noexcept
Gets the object that contains data about the 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.
size_t image_index() const noexcept
Gets the index value of the image assigned to the button.
const xtd::ustring & tool_tip_text() const noexcept
Gets the text that appears as a xtd::forms::tool_tip for the button.
static tool_bar_button create_push_button(const xtd::ustring &text)
A factory to create a toolbar button with specified text.
const xtd::drawing::rectangle & rectangle() const noexcept
Gets the bounding rectangle for a toolbar button.
std::unique_ptr< xtd::object > clone() const override
Creates a new object that is a copy of the current instance.
std::optional< std::reference_wrapper< xtd::forms::tool_bar > > parent() const noexcept
Gets the toolbar control that the toolbar button is assigned to.
const xtd::ustring & text() const noexcept
Gets the text displayed on the toolbar button.
xtd::ustring to_string() const noexcept override
Returns a string that represents the xtd::forms::tool_bar_button control.
Represents a Windows toolbar.
Definition tool_bar.h:50
Supports cloning, which creates a new instance of a class with the same value as an existing instance...
Definition iclonable.h:19
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.h:18
Represents text as a sequence of UTF-8 code units.
Definition ustring.h:47
Contains xtd::forms::component class.
Contains xtd::forms::const_control_ref typedef.
Contains xtd::forms::context_menu menu.
Contains xtd::forms::control_ref typedef.
xtd::forms::style_sheets::control tool_bar
The tool_bar data allows you to specify the box of a tool_bar control.
Definition tool_bar.h:23
@ any
Indicates that all styles except allow_binary_specifier, allow_octal_specifier and allow_hex_specifie...
@ other
The operating system is other.
@ control
The left or right CTRL modifier key.
tool_bar_button_style
Specifies the button style within a toolbar.
Definition tool_bar_button_style.h:21
std::reference_wrapper< control > control_ref
Represents a control reference.
Definition control_ref.h:23
Contains xtd::forms::image_list component.
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition xtd_about_box.h:12
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
Contains xtd::forms::tool_bar_button_ref alias.
Contains xtd::forms::tool_bar_button_style enum class.