xtd 1.0.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/iequatable>
15
17namespace xtd {
19 namespace forms {
21 class control;
22 class tool_bar;
24
42 class tool_bar_button final : public xtd::forms::component, public xtd::iequatable<tool_bar_button> {
43 struct data;
44
45 public:
47
57
59
64 [[nodiscard]] auto control() const noexcept -> std::optional<xtd::forms::control_ref>;
69 auto control(const xtd::forms::control& value) -> tool_bar_button&;
75
79 [[nodiscard]] auto drop_down_menu() const noexcept -> std::optional<xtd::ref<xtd::forms::context_menu>>;
90
94 [[nodiscard]] auto enabled() const noexcept -> bool;
99 auto enabled(bool value) -> tool_bar_button&;
100
104 [[nodiscard]] auto image_index() const noexcept -> xtd::usize;
110
114 [[nodiscard]] auto name() const noexcept -> const xtd::string&;
119 auto name(const xtd::string& value) -> tool_bar_button&;
120
123 [[nodiscard]] auto parent() const noexcept -> std::optional<xtd::ref<xtd::forms::tool_bar>>;
124
128 [[nodiscard]] auto pushed() const noexcept -> bool;
133 auto pushed(bool value) -> tool_bar_button&;
134
138 [[nodiscard]] auto rectangle() const noexcept -> const xtd::drawing::rectangle&;
139
143 [[nodiscard]] auto style() const noexcept -> xtd::forms::tool_bar_button_style;
149
153 [[nodiscard]] auto tag() const noexcept -> const xtd::any_object&;
158 auto tag(const xtd::any_object& value) -> tool_bar_button&;
159
163 [[nodiscard]] auto text() const noexcept -> const xtd::string&;
168 auto text(const xtd::string& value) -> tool_bar_button&;
169
173 [[nodiscard]] auto tool_tip_text() const noexcept -> const xtd::string&;
178 auto tool_tip_text(const xtd::string& value) -> tool_bar_button&;
179
183 [[nodiscard]] auto visible() const noexcept -> bool;
188 auto visible(bool value) -> tool_bar_button&;
190
192
197 [[nodiscard]] auto equals(const xtd::object& obj) const noexcept -> bool override;
201 [[nodiscard]] auto equals(const tool_bar_button& other) const noexcept -> bool override;
202
205 [[nodiscard]] auto get_hash_code() const noexcept -> xtd::usize override;
206
210 [[nodiscard]] auto to_string() const noexcept -> xtd::string override;
212
214
220 [[nodiscard]] static auto create_control(const xtd::string& text, const xtd::forms::control& control) -> tool_bar_button;
224 [[nodiscard]] static auto create_control(const xtd::forms::control& control) -> tool_bar_button;
225
230 [[nodiscard]] static auto create_drop_down_button(const xtd::string& text, const xtd::forms::context_menu& drop_down_menu) -> tool_bar_button;
241 [[nodiscard]] static auto create_drop_down_button(const xtd::string& text, xtd::usize image_index, const xtd::forms::context_menu& drop_down_menu) -> tool_bar_button;
242
246 [[nodiscard]] static auto create_push_button(const xtd::string& text) -> tool_bar_button;
255 [[nodiscard]] static auto create_push_button(const xtd::string& text, xtd::usize image_index) -> tool_bar_button;
256
259 [[nodiscard]] static auto create_separator() -> tool_bar_button;
260
263 [[nodiscard]] static auto create_stretchable_separator() -> tool_bar_button;
264
268 [[nodiscard]] static auto create_toggle_button(const xtd::string& text) -> tool_bar_button;
277 [[nodiscard]] static auto create_toggle_button(const xtd::string& text, xtd::usize image_index) -> tool_bar_button;
279
280 private:
281 friend xtd::forms::tool_bar;
282 xtd::sptr<data> data_;
283 };
284 }
285}
Represent a polymorphic wrapper capable of holding any type.
Definition any_object.hpp:29
Provides the base implementation and enables object sharing between applications.
Definition component.hpp:26
Represents a shortcut menu.
Definition context_menu.hpp:35
Defines the base class for controls, which are components with visual representation.
Definition control.hpp:81
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...
auto to_string() const noexcept -> xtd::string override
Returns a string that represents the xtd::forms::tool_bar_button control.
auto style() const noexcept -> xtd::forms::tool_bar_button_style
Gets the style of the toolbar button.
auto text() const noexcept -> const xtd::string &
Gets the text displayed on the toolbar button.
static auto create_stretchable_separator() -> tool_bar_button
A factory to create a toolbar stretchable separator.
auto rectangle() const noexcept -> const xtd::drawing::rectangle &
Gets the bounding rectangle for a toolbar button.
auto tag() const noexcept -> const xtd::any_object &
Gets the object that contains data about the toolbar button.
static auto create_separator() -> tool_bar_button
A factory to create a toolbar separator.
auto visible() const noexcept -> bool
Gets a value indicating whether the toolbar button is visible.
static auto create_push_button(const xtd::string &text) -> tool_bar_button
A factory to create a toolbar button with specified text.
auto control() const noexcept -> std::optional< xtd::forms::control_ref >
Gets the control to be displayed in the control toolbar button.
auto get_hash_code() const noexcept -> xtd::usize override
Serves as a hash function for a particular type.
auto enabled() const noexcept -> bool
Gets a value indicating whether the button is enabled.
static auto create_toggle_button(const xtd::string &text) -> tool_bar_button
A factory to create a toolbar toggle button with specified text.
static auto create_control(const xtd::string &text, const xtd::forms::control &control) -> tool_bar_button
A factory to create a control toolbar button with specified text and control.
auto image_index() const noexcept -> xtd::usize
Gets the index value of the image assigned to the button.
auto name() const noexcept -> const xtd::string &
Gets the name of the button.
auto tool_tip_text() const noexcept -> const xtd::string &
Gets the text that appears as a xtd::forms::tool_tip for the button.
auto parent() const noexcept -> std::optional< xtd::ref< xtd::forms::tool_bar > >
Gets the toolbar control that the toolbar button is assigned to.
auto drop_down_menu() const noexcept -> std::optional< xtd::ref< xtd::forms::context_menu > >
Gets the menu to be displayed in the drop-down toolbar button.
auto equals(const xtd::object &obj) const noexcept -> bool override
Determines whether the specified object is equal to the current object.
static auto create_drop_down_button(const xtd::string &text, const xtd::forms::context_menu &drop_down_menu) -> tool_bar_button
A factory to create a drop-down toolbar button with specified text and context menu.
auto pushed() const noexcept -> bool
Gets a value indicating whether a toggle-style toolbar button is currently in the pushed state.
Represents a Windows toolbar.
Definition tool_bar.hpp:52
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:23
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::basic_string< char > string
Represents text as a sequence of UTF-8 code units.
Definition __string_definitions.hpp:43
xtd::shared_ptr_object< type_t > sptr
The xtd::sptr object is a shared pointer.
Definition sptr.hpp:25
std::nullptr_t null_ptr
Represents the null_opt alias on std::nullptr_t.
Definition null_ptr.hpp:19
xtd::reference_wrapper_object< type_t > ref
The xtd::ref object is a reference wrapper.
Definition ref.hpp:25
std::optional< type_t > optional
Represents the optional alias on std::optional.
Definition optional.hpp:26
std::size_t usize
Represents an unsigned size of any object in bytes.
Definition usize.hpp:22
@ other
The operating system is other.
Definition platform_id.hpp:60
tool_bar_button_style
Specifies the button style within a toolbar.
Definition tool_bar_button_style.hpp:23
xtd::ref< xtd::forms::control > control_ref
Represents a control reference.
Definition control_ref.hpp:25
Contains xtd::forms::image_list component.
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition actions_system_images.hpp:10
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition texts.hpp:219
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
constexpr auto data() const noexcept -> const_pointer
Gets direct access to the underlying contiguous storage.
Definition read_only_span.hpp:197
Contains xtd::forms::tool_bar_button_ref alias.
Contains xtd::forms::tool_bar_button_style enum class.