xtd 1.0.0
Loading...
Searching...
No Matches
button.hpp
Go to the documentation of this file.
1
4#pragma once
5#include "button_base.hpp"
6#include "dialog_result.hpp"
7#include "ibutton_control.hpp"
8#include "timer.hpp"
10#include <xtd/environment>
11
13namespace xtd {
15 namespace forms {
50 struct data;
51
52 public:
54
60
62
66 [[nodiscard]] virtual auto auto_repeat() const noexcept -> bool;
70 virtual auto auto_repeat(bool value) -> button&;
71
74 [[nodiscard]] virtual auto auto_repeat_delay() const noexcept -> xtd::time_span;
78 virtual auto auto_repeat_delay(const xtd::time_span& value) -> button&;
82 virtual auto auto_repeat_delay(xtd::int32 value) -> button&;
83
86 [[nodiscard]] virtual auto auto_repeat_delay_milliseconds() const noexcept -> xtd::int32;
87
90 [[nodiscard]] virtual auto auto_repeat_interval() const noexcept -> xtd::time_span;
94 virtual auto auto_repeat_interval(const xtd::time_span& value) -> button&;
98 virtual auto auto_repeat_interval(xtd::int32 value) -> button&;
99
102 [[nodiscard]] virtual auto auto_repeat_interval_milliseconds() const noexcept -> xtd::int32;
103
106 [[nodiscard]] virtual auto auto_size_mode() const noexcept -> xtd::forms::auto_size_mode;
109 virtual auto auto_size_mode(xtd::forms::auto_size_mode value) -> button&;
110
111 [[nodiscard]] auto dialog_result() const noexcept -> xtd::forms::dialog_result override;
112 auto dialog_result(xtd::forms::dialog_result value) -> xtd::forms::control& override;
114
116
118 auto notify_default(bool value) -> void override;
119
120 auto perform_click() -> void override;
122
124
128 [[nodiscard]] static auto create() -> button;
132 [[nodiscard]] static auto create(const xtd::drawing::point& location) -> button;
137 [[nodiscard]] static auto create(const xtd::drawing::point& location, const xtd::drawing::size& size) -> button;
143 [[nodiscard]] static auto create(const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> button;
147 [[nodiscard]] static auto create(const xtd::string& text) -> button;
152 [[nodiscard]] static auto create(const xtd::string& text, const xtd::drawing::point& location) -> button;
158 [[nodiscard]] static auto create(const xtd::string& text, const xtd::drawing::point& location, const xtd::drawing::size& size) -> button;
165 [[nodiscard]] static auto create(const xtd::string& text, const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> button;
169 [[nodiscard]] static auto create(const xtd::forms::control& parent) -> button;
174 [[nodiscard]] static auto create(const xtd::forms::control& parent, const xtd::drawing::point& location) -> button;
180 [[nodiscard]] static auto create(const xtd::forms::control& parent, const xtd::drawing::point& location, const xtd::drawing::size& size) -> button;
187 [[nodiscard]] static auto create(const xtd::forms::control& parent, const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> button;
192 [[nodiscard]] static auto create(const xtd::forms::control& parent, const xtd::string& text) -> button;
198 [[nodiscard]] static auto create(const xtd::forms::control& parent, const xtd::string& text, const xtd::drawing::point& location) -> button;
205 [[nodiscard]] static auto create(const xtd::forms::control& parent, const xtd::string& text, const xtd::drawing::point& location, const xtd::drawing::size& size) -> button;
213 [[nodiscard]] static auto create(const xtd::forms::control& parent, const xtd::string& text, const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> button;
215
216 protected:
218
220 [[nodiscard]] auto create_params() const noexcept -> xtd::forms::create_params override;
221
224 [[nodiscard]] auto state() const noexcept -> xtd::forms::visual_styles::push_button_state;
226
228
230 [[nodiscard]] auto measure_control() const noexcept -> xtd::drawing::size override;
231
232 auto on_click(const event_args& e) -> void override;
233 auto on_enabled_changed(const event_args& e) -> void override;
234 auto on_handle_created(const event_args& e) -> void override;
235 auto on_image_changed(const xtd::event_args& e) -> void override;
236 auto on_mouse_down(const mouse_event_args& e) -> void override;
237 auto on_mouse_enter(const event_args& e) -> void override;
238 auto on_mouse_leave(const event_args& e) -> void override;
239 auto on_mouse_up(const mouse_event_args& e) -> void override;
240 auto on_paint(paint_event_args& e) -> void override;
242
243 private:
244 auto auto_repeat_perform_click() -> void;
245
246 xtd::sptr<data> data_;
247 };
248 }
249}
Contains xtd::forms::button_base class.
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition event_args.hpp:18
Implements the basic functionality common to button controls.
Definition button_base.hpp:37
virtual auto auto_repeat() const noexcept -> bool
Gets if this button instance is auto repeat.
auto on_paint(paint_event_args &e) -> void override
Raises the xtd::forms::control::paint event.
virtual auto auto_size_mode() const noexcept -> xtd::forms::auto_size_mode
Gets the mode by which the button automatically resizes itself.
auto on_mouse_leave(const event_args &e) -> void override
Raises the xtd::forms::control::mouse_leave event.
auto create_params() const noexcept -> xtd::forms::create_params override
Gets the required creation parameters when the control handle is created.
static auto create() -> button
A factory to create an xtd::forms::button.
auto on_mouse_down(const mouse_event_args &e) -> void override
Raises the xtd::forms::control::mouse_down event.
auto perform_click() -> void override
Generates a click event for the control.
auto notify_default(bool value) -> void override
Notifies a control that it is the default button so that its appearance and behavior is adjusted acco...
virtual auto auto_repeat_delay() const noexcept -> xtd::time_span
Gets the auto repeat delay.
auto on_mouse_enter(const event_args &e) -> void override
Raises the xtd::forms::control::mouse_enter event.
auto on_click(const event_args &e) -> void override
Raises the xtd::forms::control::click event.
virtual auto auto_repeat_interval() const noexcept -> xtd::time_span
Gets the auto repeat interval.
auto on_enabled_changed(const event_args &e) -> void override
Raises the xtd::forms::control::enabled_changed event.
virtual auto auto_repeat_delay_milliseconds() const noexcept -> xtd::int32
Gets the auto repeat delay.
auto measure_control() const noexcept -> xtd::drawing::size override
Measure this control.
button()
Initializes a new instance of the button class.
auto on_handle_created(const event_args &e) -> void override
Raises the xtd::forms::control::handle_created event.
virtual auto auto_repeat_interval_milliseconds() const noexcept -> xtd::int32
Gets the auto repeat interval.
auto state() const noexcept -> xtd::forms::visual_styles::push_button_state
Gets state.
auto on_mouse_up(const mouse_event_args &e) -> void override
Raises the xtd::forms::control::mouse_up event.
auto on_image_changed(const xtd::event_args &e) -> void override
Raises the button_base::image_changed event.
auto dialog_result() const noexcept -> xtd::forms::dialog_result override
Gets the value returned to the parent form when the button is clicked.
Defines the base class for controls, which are components with visual representation.
Definition control.hpp:81
virtual auto size() const noexcept -> xtd::drawing::size
Gets the height and width of the control.
virtual auto parent() const noexcept -> std::optional< xtd::forms::control_ref >
Gets the parent container of the control.
virtual auto text() const noexcept -> const xtd::string &
Gets the text associated with this control.
virtual auto name() const noexcept -> const xtd::string &
Gets the name of the control.
virtual auto location() const noexcept -> xtd::drawing::point
Gets the coordinates of the upper-left corner of the control relative to the upper-left corner of its...
Allows a control to act like a button on a form.
Definition ibutton_control.hpp:26
Provides data for the xtd::forms::control::mouse_up, xtd::forms::control::mouse_down,...
Definition mouse_event_args.hpp:34
Provides data for the xtd::forms::control::paint event.
Definition paint_event_args.hpp:26
Represents a time interval.
Definition time_span.hpp:29
Contains xtd::forms::dialog_result enum class.
#define forms_export_
Define shared library export.
Definition forms_export.hpp:13
xtd::shared_ptr_object< type_t > sptr
The xtd::sptr object is a shared pointer.
Definition sptr.hpp:25
std::int32_t int32
Represents a 32-bit signed integer.
Definition int32.hpp:25
Contains xtd::forms::ibutton_control interface.
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition actions_system_images.hpp:10
The xtd::forms::visual_styles namespace contains classes for rendering controls and other windows use...
Definition check_box_state.hpp:12
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::visual_styles::push_button_state enum class.
Contains xtd::forms::timer component.