xtd 0.2.0
Loading...
Searching...
No Matches
tool_bar_button.hpp
Go to the documentation of this file.
1
4#pragma once
5#include "component.hpp"
7#include "context_menu.hpp"
8#include "control_ref.hpp"
9#include "image_list.hpp"
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
43 class tool_bar_button : public xtd::forms::component, public xtd::iclonable, public xtd::iequatable<tool_bar_button> {
44 struct data;
45
46 public:
48
58
60 tool_bar_button(const tool_bar_button&) noexcept = default;
61 tool_bar_button(tool_bar_button&&) noexcept = default;
62 tool_bar_button& operator =(const tool_bar_button&) noexcept = default;
64
66
71 std::optional<xtd::forms::control_ref> control() const noexcept;
81 tool_bar_button& control(std::nullptr_t value);
82
86 std::optional<std::reference_wrapper<xtd::forms::context_menu>> drop_down_menu() const noexcept;
96 tool_bar_button& drop_down_menu(std::nullptr_t value);
97
101 bool enabled() const noexcept;
107
111 size_t image_index() const noexcept;
117
121 const xtd::string& name() const noexcept;
126 tool_bar_button& name(const xtd::string& value);
127
130 std::optional<std::reference_wrapper<xtd::forms::tool_bar>> parent() const noexcept;
131
135 bool pushed() const noexcept;
141
145 const xtd::drawing::rectangle& rectangle() const noexcept;
146
156
160 std::any tag() const noexcept;
165 tool_bar_button& tag(std::any value);
166
170 const xtd::string& text() const noexcept;
175 tool_bar_button& text(const xtd::string& value);
176
180 const xtd::string& tool_tip_text() const noexcept;
185 tool_bar_button& tool_tip_text(const xtd::string& value);
186
190 bool visible() const noexcept;
197
199
201 using object::equals;
202 bool equals(const tool_bar_button& other) const noexcept override;
203
207 xtd::string to_string() const noexcept override;
209
211
217 static tool_bar_button create_control(const xtd::string& text, const xtd::forms::control& control);
222
239
252 static tool_bar_button create_push_button(const xtd::string& text, size_t image_index);
253
257
261
276
277 protected:
279
285 xtd::uptr<xtd::object> clone() const override;
287
288 private:
289 friend xtd::forms::tool_bar;
290 xtd::sptr<data> data_;
291 };
292 }
293}
Represents text as a sequence of character units.
Definition basic_string.hpp:79
Provides the base implementation and enables object sharing between applications.
Definition component.hpp:25
Represents a shortcut menu.
Definition context_menu.hpp:36
Defines the base class for controls, which are components with visual representation.
Definition control.hpp:81
Represents a toolbar button.
Definition tool_bar_button.hpp:43
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.
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...
xtd::string to_string() const noexcept override
Returns a string that represents the xtd::forms::tool_bar_button control.
static tool_bar_button create_push_button(const xtd::string &text)
A factory to create a toolbar button with specified text.
const xtd::string & text() const noexcept
Gets the text displayed on the toolbar button.
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.
xtd::uptr< xtd::object > clone() const override
Creates a new object that is a copy of the current instance.
const xtd::string & name() const noexcept
Gets the name of the button.
static tool_bar_button create_separator()
A factory to create a toolbar separator.
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_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.
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::string & tool_tip_text() const noexcept
Gets the text that appears as a xtd::forms::tool_tip for the button.
const xtd::drawing::rectangle & rectangle() const noexcept
Gets the bounding rectangle for a toolbar button.
static tool_bar_button create_toggle_button(const xtd::string &text)
A factory to create a toolbar toggle button with specified text.
std::optional< std::reference_wrapper< xtd::forms::tool_bar > > parent() const noexcept
Gets the toolbar control that the toolbar button is assigned to.
Represents a Windows toolbar.
Definition tool_bar.hpp:52
Supports cloning, which creates a new instance of a class with the same value as an existing instance...
Definition iclonable.hpp:21
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:22
Contains xtd::forms::component class.
Contains xtd::forms::const_control_ref typedef.
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.hpp:25
std::optional< type_t > optional
Represents the null_opt alias on std::nullopt_t.
Definition optional.hpp:181
std::unique_ptr< type_t > uptr
The xtd::uptr object is a unique pointer.
Definition uptr.hpp:25
std::shared_ptr< type_t > sptr
The xtd::sptr object is a shared pointer.
Definition sptr.hpp:25
@ 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.hpp:23
std::reference_wrapper< control > control_ref
Represents a control reference.
Definition control_ref.hpp:25
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition xtd_about_box.hpp:12
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10
Contains xtd::forms::tool_bar_button_ref alias.
Contains xtd::forms::tool_bar_button_style enum class.
Contains xtd::forms::context_menu menu.
Contains xtd::forms::image_list component.