xtd 0.2.0
button.h
Go to the documentation of this file.
1 #pragma once
5 #include "button_base.h"
6 #include "dialog_result.h"
7 #include "ibutton_control.h"
8 #include "timer.h"
10 #include <xtd/environment>
11 
13 namespace xtd {
15  namespace forms {
47  class forms_export_ button : public ibutton_control, public button_base {
48  struct data;
49 
50  public:
52 
56  button();
58 
60 
64  virtual bool auto_repeat() const noexcept;
68  virtual button& auto_repeat(bool auto_repeat);
69 
72  virtual int32 auto_repeat_delay() const noexcept;
76  virtual button& auto_repeat_delay(int32 auto_repeat_delay);
77 
80  virtual int32 auto_repeat_interval() const noexcept;
84  virtual button& auto_repeat_interval(int32 auto_repeat_interval);
85 
88  virtual forms::auto_size_mode auto_size_mode() const noexcept;
92 
93  forms::dialog_result dialog_result() const noexcept override;
96 
98 
100  using control::create;
107  static button create(const xtd::ustring& text, const drawing::point& location = {-1, -1}, const drawing::size& size = {-1, -1}, const xtd::ustring& name = xtd::ustring::empty_string);
115  static button create(const control& parent, const xtd::ustring& text, const drawing::point& location = {-1, -1}, const drawing::size& size = {-1, -1}, const xtd::ustring& name = xtd::ustring::empty_string);
116 
117  void notify_default(bool value) override;
118 
119  void perform_click() override;
121 
122  protected:
124 
126  forms::create_params create_params() const noexcept override;
127 
130  xtd::forms::visual_styles::push_button_state state() const noexcept;
132 
134 
136  drawing::size measure_control() const noexcept override;
137 
138  void on_click(const event_args& e) override;
139  void on_enabled_changed(const event_args& e) override;
140  void on_handle_created(const event_args& e) override;
141  void on_image_changed(const xtd::event_args& e) override;
142  void on_mouse_down(const mouse_event_args& e) override;
143  void on_mouse_enter(const event_args& e) override;
144  void on_mouse_leave(const event_args& e) override;
145  void on_mouse_up(const mouse_event_args& e) override;
146  void on_paint(paint_event_args& e) override;
147 
148  private:
149  void on_auto_repeat_timer_tick(object& sender, const event_args& e);
150 
151  std::shared_ptr<data> data_;
152  };
153  }
154 }
Contains xtd::forms::timer component.
dialog_result
Specifies identifiers to indicate the return value of a dialog box.
Definition: dialog_result.h:41
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.h:18
The appearance of a button.
Represents an ordered pair of integer x- and y-coordinates that defines a point in a two-dimensional ...
Definition: point.h:54
Stores an ordered pair of integers, which specify a height and width.
Definition: size.h:31
Implements the basic functionality common to button controls.
Definition: button_base.h:35
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
auto_size_mode
Specifies how a control will behave when its auto_size property is enabled.
Definition: auto_size_mode.h:20
Encapsulates the information needed when creating a control.
Definition: create_params.h:27
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:46
Contains xtd::forms::visual_styles::push_button_state enum class.
static control create(const drawing::point &location={-1, -1}, const drawing::size &size={-1, -1}, const xtd::ustring &name=xtd::ustring::empty_string)
A factory to create a specified control with specified location, size, and name.
Provides data for the xtd::forms::control::paint event.
Definition: paint_event_args.h:28
Contains xtd::forms::dialog_result enum class.
Defines the base class for controls, which are components with visual representation.
Definition: control.h:78
int_least32_t int32
Represents a 32-bit signed integer.
Definition: types.h:129
push_button_state
Specifies the visual state of a button that is drawn with visual styles.
Definition: push_button_state.h:22
Provides data for the xtd::forms::control::mouse_up, xtd::forms::control::mouse_down, and xtd::forms::control::mouse_move events.
Definition: mouse_event_args.h:32
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
static const ustring empty_string
Represents the empty string.
Definition: ustring.h:53
Contains xtd::forms::ibutton_control interface.
Specifies that both the x and y coordinates of the control are defined.
Represents a Windows button control.
Definition: button.h:47
Allows a control to act like a button on a form.
Definition: ibutton_control.h:24
The xtd::forms::status_bar_panel displays text in the standard font.
size_t size
Represents a size of any object in bytes.
Definition: types.h:195