xtd 0.2.0
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 button(button&& rhs);
63 button(const button&) = default;
64 button& operator =(const button&) = default;
66
68
72 virtual bool auto_repeat() const noexcept;
77
80 virtual int32 auto_repeat_delay() const noexcept;
85
88 virtual int32 auto_repeat_interval() const noexcept;
93
96 virtual forms::auto_size_mode auto_size_mode() const noexcept;
100
101 forms::dialog_result dialog_result() const noexcept override;
104
106
108 void notify_default(bool value) override;
109
110 void perform_click() override;
112
114
118 static button create();
122 static button create(const drawing::point& location);
127 static button create(const drawing::point& location, const drawing::size& size);
133 static button create(const drawing::point& location, const drawing::size& size, const xtd::string& name);
137 static button create(const xtd::string& text);
142 static button create(const xtd::string& text, const drawing::point& location);
148 static button create(const xtd::string& text, const drawing::point& location, const drawing::size& size);
155 static button create(const xtd::string& text, const drawing::point& location, const drawing::size& size, const xtd::string& name);
159 static button create(const control& parent);
164 static button create(const control& parent, const drawing::point& location);
170 static button create(const control& parent, const drawing::point& location, const drawing::size& size);
177 static button create(const control& parent, const drawing::point& location, const drawing::size& size, const xtd::string& name);
182 static button create(const control& parent, const xtd::string& text);
188 static button create(const control& parent, const xtd::string& text, const drawing::point& location);
195 static button create(const control& parent, const xtd::string& text, const drawing::point& location, const drawing::size& size);
203 static button create(const control& parent, const xtd::string& text, const drawing::point& location, const drawing::size& size, const xtd::string& name);
205
206 protected:
208
210 forms::create_params create_params() const noexcept override;
211
214 xtd::forms::visual_styles::push_button_state state() const noexcept;
216
218
224 xtd::uptr<xtd::object> clone() const override;
225
226 drawing::size measure_control() const noexcept override;
227
228 void on_click(const event_args& e) override;
229 void on_enabled_changed(const event_args& e) override;
230 void on_handle_created(const event_args& e) override;
231 void on_image_changed(const xtd::event_args& e) override;
232 void on_mouse_down(const mouse_event_args& e) override;
233 void on_mouse_enter(const event_args& e) override;
234 void on_mouse_leave(const event_args& e) override;
235 void on_mouse_up(const mouse_event_args& e) override;
236 void on_paint(paint_event_args& e) override;
238
239 private:
240 void auto_repeat_perform_click();
241 void on_auto_repeat_timer_tick(object& sender, const event_args& e);
242
243 xtd::sptr<data> data_;
244 };
245 }
246}
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
button_base() noexcept
Initializes a new instance of the ButtonBase class.
void perform_click() override
Generates a click event for the control.
virtual int32 auto_repeat_delay() const noexcept
Gets the auto repeat delay.
xtd::uptr< xtd::object > clone() const override
Creates a new object that is a copy of the current instance.
void on_paint(paint_event_args &e) override
Raises the xtd::forms::control::paint event.
virtual int32 auto_repeat_interval() const noexcept
Gets the auto repeat interval.
void on_handle_created(const event_args &e) override
Raises the xtd::forms::control::handle_created event.
drawing::size measure_control() const noexcept override
Measure this control.
void on_image_changed(const xtd::event_args &e) override
Raises the button_base::image_changed event.
void on_mouse_enter(const event_args &e) override
Raises the xtd::forms::control::mouse_enter event.
void on_click(const event_args &e) override
Raises the xtd::forms::control::click event.
virtual forms::auto_size_mode auto_size_mode() const noexcept
Gets the mode by which the button automatically resizes itself.
static button create()
A factory to create an xtd::forms::button.
forms::dialog_result dialog_result() const noexcept override
Gets the value returned to the parent form when the button is clicked.
void on_mouse_up(const mouse_event_args &e) override
Raises the xtd::forms::control::mouse_up event.
void on_mouse_leave(const event_args &e) override
Raises the xtd::forms::control::mouse_leave event.
button()
Initializes a new instance of the button class.
void on_mouse_down(const mouse_event_args &e) override
Raises the xtd::forms::control::mouse_down event.
void notify_default(bool value) override
Notifies a control that it is the default button so that its appearance and behavior is adjusted acco...
forms::create_params create_params() const noexcept override
Gets the required creation parameters when the control handle is created.
xtd::forms::visual_styles::push_button_state state() const noexcept
Gets state.
virtual bool auto_repeat() const noexcept
Gets if this button instance is auto repeat.
void on_enabled_changed(const event_args &e) override
Raises the xtd::forms::control::enabled_changed event.
Defines the base class for controls, which are components with visual representation.
Definition control.hpp:81
virtual drawing::point location() const noexcept
Gets the coordinates of the upper-left corner of the control relative to the upper-left corner of its...
virtual const xtd::string & name() const noexcept
Gets the name of the control.
virtual const xtd::string & text() const noexcept
Gets the text associated with this control.
virtual drawing::size size() const noexcept
Gets the height and width of the control.
virtual std::optional< control_ref > parent() const noexcept
Gets the parent container of the control.
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:30
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
int32_t int32
Represents a 32-bit signed integer.
Definition int32.hpp:23
xtd::unique_ptr_object< type_t > uptr
The xtd::uptr object is a unique pointer.
Definition uptr.hpp:25
@ e
The E key.
Definition keys.hpp:207
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:217
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
constexpr const_pointer data() const noexcept
Gets direct access to the underlying contiguous storage.
Definition read_only_span.hpp:201
Contains xtd::forms::visual_styles::push_button_state enum class.
Contains xtd::forms::timer component.