xtd 0.2.0
check_box.h
Go to the documentation of this file.
1 #pragma once
6 #include "appearance.h"
7 #include "button_base.h"
8 #include "check_state.h"
9 
11 namespace xtd {
13  namespace forms {
43  class forms_export_ check_box : public xtd::forms::button_base {
44  struct data;
45 
46  public:
48 
55  check_box();
57 
59 
67  virtual forms::appearance appearance() const noexcept;
72 
79  virtual bool auto_check() const noexcept;
83  virtual check_box& auto_check(bool auto_check);
84 
87  virtual content_alignment check_align() const noexcept;
90  virtual check_box& check_align(content_alignment check_align);
91 
98  virtual bool checked() const noexcept;
102  virtual check_box& checked(bool checked);
103 
116  virtual forms::check_state check_state() const noexcept;
129 
136  virtual bool three_state() const noexcept;
140  virtual check_box& three_state(bool three_state);
142 
144 
146  using control::create;
155  static check_box create(const xtd::ustring& text, bool three_state = false, xtd::forms::check_state check_state = xtd::forms::check_state::unchecked, const drawing::point& location = {-1, -1}, const drawing::size& size = {-1, -1}, const xtd::ustring& name = xtd::ustring::empty_string);
165  static check_box create(const control& parent, const xtd::ustring& text, bool three_state = false, xtd::forms::check_state check_state = xtd::forms::check_state::unchecked, const drawing::point& location = {-1, -1}, const drawing::size& size = {-1, -1}, const xtd::ustring& name = xtd::ustring::empty_string);
167 
169 
174 
178 
183 
184  protected:
186 
190  forms::create_params create_params() const noexcept override;
193  xtd::forms::visual_styles::check_box_state state() const noexcept;
195 
197 
202  drawing::size measure_control() const noexcept override;
203 
208  virtual void on_appearance_changed(const event_args& e);
209 
214  virtual void on_checked_changed(const event_args& e);
215 
220  virtual void on_check_state_changed(const event_args& e);
221 
222  void on_enabled_changed(const event_args& e) override;
223  void on_handle_created(const event_args& e) override;
224  void on_mouse_down(const mouse_event_args& e) override;
225  void on_mouse_enter(const event_args& e) override;
226  void on_mouse_leave(const event_args& e) override;
227  void on_mouse_up(const mouse_event_args& e) override;
228  void on_paint(paint_event_args& e) override;
229  void wnd_proc(message& message) override;
231 
232  private:
233  void wm_mouse_double_click(message& message);
234  void wm_mouse_down(message& message);
235  void wm_mouse_up(message& message);
236 
237  std::shared_ptr<data> data_;
238  };
239  }
240 }
check_state
Specifies the state of a control, such as a check box, that can be checked, unchecked, or set to an indeterminate state.
Definition: check_state.h:21
The control is unchecked.
Contains xtd::forms::appearance enum class.
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 button has a checked or latched appearance. Use this appearance to show that a toggle button has ...
appearance
Specifies the appearance of a control.
Definition: appearance.h:20
Represents an ordered pair of integer x- and y-coordinates that defines a point in a two-dimensional ...
Definition: point.h:54
Contains xtd::forms::check_state enum class.
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
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
event< check_box, event_handler > check_state_changed
Occurs when the value of the check_state property changes.
Definition: check_box.h:181
check_box_state
Specifies the visual state of a check box that is drawn with visual styles.
Definition: check_box_state.h:22
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.
Represents an event.
Definition: event.h:21
Provides data for the xtd::forms::control::paint event.
Definition: paint_event_args.h:28
content_alignment
Specifies alignment of content on the drawing surface.
Definition: content_alignment.h:19
event< check_box, event_handler > appearance_changed
Occurs when the value of the appearance property changes.
Definition: check_box.h:173
Implements a Windows message.
Definition: message.h:26
Defines the base class for controls, which are components with visual representation.
Definition: control.h:78
Contains xtd::forms::visual_styles::check_box_state enum class.
Represents a Windows check_box.
Definition: check_box.h:43
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
Specifies that both the x and y coordinates of the control are defined.
The xtd::forms::status_bar_panel displays text in the standard font.
event< check_box, event_handler > checked_changed
Occurs when the value of the checked property changes.
Definition: check_box.h:177
size_t size
Represents a size of any object in bytes.
Definition: types.h:195