xtd - Reference Guide  0.1.1
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
check_box.h
Go to the documentation of this file.
1 #pragma once
5 #include "appearance.h"
6 #include "button_base.h"
7 #include "check_state.h"
9 
11 namespace xtd {
13  namespace forms {
53  public:
60 
67  virtual forms::appearance appearance() const {return appearance_;}
72 
79  virtual bool auto_check() const {return auto_check_;}
83  virtual check_box& auto_check(bool auto_check);
84 
87  virtual content_alignment check_align() const {return check_align_;}
90  virtual check_box& check_align(content_alignment check_align);
91 
98  virtual bool checked() const {return checked_;}
102  virtual check_box& checked(bool checked);
103 
116  virtual forms::check_state check_state() const {return check_state_;}
129 
132  drawing::size default_size() const override {return {104, 25};}
133 
140  virtual bool three_state() const {return three_state_;}
144  virtual check_box& three_state(bool three_state);
145 
149 
153 
157 
158  protected:
161  forms::create_params create_params() const override;
162 
166  drawing::size measure_control() const override;
167 
172  virtual void on_appearance_changed(const event_args& e) {
173  appearance_changed(*this, e);
174  if (flat_style_ != xtd::forms::flat_style::system) invalidate();
175  }
176 
181  virtual void on_checked_changed(const event_args& e) {
182  if (flat_style_ != xtd::forms::flat_style::system && enabled()) {
186  }
187  checked_changed(*this, e);
188  if (flat_style_ != xtd::forms::flat_style::system) invalidate();
189  }
190 
195  virtual void on_check_state_changed(const event_args& e) {
196  if (flat_style_ != xtd::forms::flat_style::system && enabled()) {
200  }
201  check_state_changed(*this, e);
202  if (flat_style_ != xtd::forms::flat_style::system) invalidate();
203  }
204 
205  void on_enabled_changed(const event_args& e) override {
206  if (flat_style_ != xtd::forms::flat_style::system) {
210  }
212  }
213 
214  void on_handle_created(const event_args& e) override;
215 
216  void on_mouse_down(const mouse_event_args& e) override {
217  if (flat_style_ != xtd::forms::flat_style::system && enabled()) {
221  }
223  }
224 
225  void on_mouse_enter(const event_args& e) override {
226  if (flat_style_ != xtd::forms::flat_style::system && enabled()) {
230  }
232  }
233 
234  void on_mouse_leave(const event_args& e) override {
235  if (flat_style_ != xtd::forms::flat_style::system && enabled()) {
239  }
241  }
242 
243  void on_mouse_up(const mouse_event_args& e) override {
248  }
250  }
251 
252  void on_paint(paint_event_args& e) override;
253 
255  void wnd_proc(message& message) override;
256  virtual void wm_mouse_double_click(message& message);
257  virtual void wm_mouse_down(message& message);
258  virtual void wm_mouse_up(message& message);
259 
261  bool auto_check_ = true;
262  bool three_state_ = 0;
263  bool checked_ = false;
268  };
269  }
270 }
Contains xtd::forms::appearance enum class.
Contains xtd::forms::button_base class.
Contains xtd::forms::visual_styles::check_box_state enum class.
Contains xtd::forms::check_state enum class.
Stores an ordered pair of integers, which specify a height and width.
Definition: size.h:25
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition: event_args.h:18
Represents an event.
Definition: event.h:21
Implements the basic functionality common to button controls.
Definition: button_base.h:26
void on_enabled_changed(const event_args &e) override
Raises the control::enabled_changed event.
Definition: button_base.h:139
void on_mouse_up(const mouse_event_args &e) override
Raises the control::mouse_up event.
Definition: button_base.h:176
void on_mouse_down(const mouse_event_args &e) override
Raises the control::mouse_down event.
Definition: button_base.h:161
void on_mouse_enter(const event_args &e) override
Raises the control::mouse_enter event.
Definition: button_base.h:166
void on_mouse_leave(const event_args &e) override
Raises the control::mouse_leave event.
Definition: button_base.h:171
Represents a Windows check_box.
Definition: check_box.h:52
void on_handle_created(const event_args &e) override
Raises the control::handle_created event.
virtual void on_check_state_changed(const event_args &e)
Raises the check_box::check_state_changed event.
Definition: check_box.h:195
virtual check_box & appearance(forms::appearance appearance)
Gets the value that determines the appearance of a check_box control.
void on_mouse_up(const mouse_event_args &e) override
Raises the control::mouse_up event.
Definition: check_box.h:243
virtual content_alignment check_align() const
Gets the horizontal and vertical alignment of the check mark on a check_box control.
Definition: check_box.h:87
void on_mouse_leave(const event_args &e) override
Raises the control::mouse_leave event.
Definition: check_box.h:234
void on_mouse_down(const mouse_event_args &e) override
Raises the control::mouse_down event.
Definition: check_box.h:216
virtual void on_appearance_changed(const event_args &e)
Raises the check_box::appearance_changed event.
Definition: check_box.h:172
drawing::size measure_control() const override
Measure this control.
virtual forms::appearance appearance() const
Gets the value that determines the appearance of a check_box control.
Definition: check_box.h:67
virtual bool auto_check() const
Gets a value indicating whether the checked or check_state values and the check_box's appearance are ...
Definition: check_box.h:79
virtual check_box & checked(bool checked)
Sets a value indicating whether the check_box is in the checked state.
virtual check_box & check_align(content_alignment check_align)
Sets the horizontal and vertical alignment of the check mark on a check_box control.
virtual void on_checked_changed(const event_args &e)
Raises the check_box::checked_changed event.
Definition: check_box.h:181
virtual check_box & three_state(bool three_state)
Gets a value indicating whether the check_box will allow three check states rather than two.
void on_mouse_enter(const event_args &e) override
Raises the control::mouse_enter event.
Definition: check_box.h:225
virtual check_box & auto_check(bool auto_check)
Sets a value indicating whether the checked or check_state values and the check_box's appearance are ...
forms::create_params create_params() const override
Gets the required creation parameters when the control handle is created.
drawing::size default_size() const override
Gets the default size of the control.
Definition: check_box.h:132
void on_paint(paint_event_args &e) override
Raises the control::paint event.
void on_enabled_changed(const event_args &e) override
Raises the control::enabled_changed event.
Definition: check_box.h:205
virtual check_box & check_state(forms::check_state check_state)
Sets the state of the check_box.
virtual forms::check_state check_state() const
Gets the state of the check_box.
Definition: check_box.h:116
check_box()
Initializes a new instance of the CheckBox class.
virtual bool three_state() const
Gets a value indicating whether the check_box will allow three check states rather than two.
Definition: check_box.h:140
virtual bool checked() const
Gets a value indicating whether the check_box is in the checked state.
Definition: check_box.h:98
Implements a Windows message.
Definition: message.h:25
Provides data for the xtd::forms::control::mouse_up, xtd::forms::control::mouse_down,...
Definition: mouse_event_args.h:29
Provides data for the paint event.
Definition: paint_event_args.h:26
event< check_box, event_handler > appearance_changed
Occurs when the value of the appearance property changes.
Definition: check_box.h:148
event< check_box, event_handler > check_state_changed
Occurs when the value of the check_state property changes.
Definition: check_box.h:156
event< check_box, event_handler > checked_changed
Occurs when the value of the checked property changes.
Definition: check_box.h:152
#define forms_export_
Define shared library export.
Definition: forms_export.h:13
@ e
The E key.
check_state
Specifies the state of a control, such as a check box, that can be checked, unchecked,...
Definition: check_state.h:19
check_box_state
Specifies the visual state of a check box that is drawn with visual styles.
Definition: check_box_state.h:20
content_alignment
Specifies alignment of content on the drawing surface.
Definition: content_alignment.h:17
appearance
Specifies the appearance of a control.
Definition: appearance.h:18
@ checked
The control is checked.
@ indeterminate
The control is indeterminate. An indeterminate control generally has a shaded appearance.
@ unchecked
The control is unchecked.
@ mixed_normal
The check box is three-state.
@ mixed_pressed
The check box is three-state and pressed.
@ unchecked_normal
The check box is unchecked.
@ checked_normal
The check box is checked.
@ checked_disabled
The check box is checked and disabled.
@ unchecked_pressed
The check box is unchecked and pressed.
@ mixed_hot
The check box is three-state and hot.
@ checked_hot
The check box is checked and hot.
@ unchecked_hot
The check box is unchecked and hot.
@ unchecked_disabled
The check box is unchecked and disabled.
@ checked_pressed
The check box is checked and pressed.
@ mixed_disabled
The check box is three-state and disabled.
@ system
The appearance of the control is determined by the user's operating system.
@ left
The left mouse button was pressed.
@ middle_left
Content is vertically aligned in the middle, and horizontally aligned on the left.
@ normal
The default appearance defined by the control class.
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17