xtd - Reference Guide  0.1.2
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
Loading...
Searching...
No Matches
radio_button.h
Go to the documentation of this file.
1
4#pragma once
5#include "appearance.h"
6#include "button_base.h"
8
10namespace xtd {
12 namespace forms {
27 public:
31
35 virtual forms::appearance appearance() const {return appearance_;}
41
46 virtual bool auto_check() const {return auto_check_;}
52 virtual radio_button& auto_check(bool auto_check);
53
56 virtual bool checked() const {return checked_;}
60 virtual radio_button& checked(bool checked);
61
64 virtual content_alignment check_align() const {return check_align_;}
69
72 drawing::size default_size() const override {return {104, 25};}
73
76
80 xtd::ustring to_string() const noexcept override {return ustring::format("{}, checked: {}", ustring::full_class_name(*this), checked_);}
81
85
89
90 protected:
93 forms::create_params create_params() const override;
94
99
106 virtual void on_appearance_changed(const event_args& e) {
107 if (flat_style_ != xtd::forms::flat_style::system) invalidate();
108 appearance_changed(*this, e);
109 }
110
117 virtual void on_checked_changed(const event_args& e) {
118 if (flat_style_ != xtd::forms::flat_style::system) {
121 invalidate();
122 }
123 checked_changed(*this, e);
124 }
125
126 void on_enabled_changed(const event_args& e) override {
127 if (flat_style_ != xtd::forms::flat_style::system) {
130 }
131 button_base::on_enabled_changed(e);
132 }
133
134 void on_got_focus(const event_args& e) override {
135 button_base::on_got_focus(e);
136 if (flat_style_ != xtd::forms::flat_style::system) {
139 }
140 }
141
144 void on_handle_created(const event_args& e) override;
145
146 void on_lost_focus(const event_args& e) override {
147 button_base::on_lost_focus(e);
148 if (flat_style_ != xtd::forms::flat_style::system) {
151 }
152 }
153
154 void on_mouse_down(const mouse_event_args& e) override {
155 if (flat_style_ != xtd::forms::flat_style::system) {
158 }
159 button_base::on_mouse_down(e);
160 }
161
162 void on_mouse_enter(const event_args& e) override {
163 if (flat_style_ != xtd::forms::flat_style::system) {
166 }
167 button_base::on_mouse_enter(e);
168 }
169
170 void on_mouse_leave(const event_args& e) override {
171 if (flat_style_ != xtd::forms::flat_style::system) {
174 }
175 button_base::on_mouse_leave(e);
176 }
177
178 void on_mouse_move(const mouse_event_args& e) override {
179 if (flat_style_ != xtd::forms::flat_style::system && (e.button() & mouse_buttons::left) == mouse_buttons::left && !client_rectangle().contains(e.location()) && (state_ == xtd::forms::visual_styles::radio_button_state::unchecked_pressed || state_ == xtd::forms::visual_styles::radio_button_state::checked_pressed)) {
182 }
183 button_base::on_mouse_move(e);
184 }
185
186 void on_mouse_up(const mouse_event_args& e) override {
190 }
191 button_base::on_mouse_up(e);
192 }
193
194 void on_paint(paint_event_args& e) override;
195
196 void wnd_proc(message& message) override;
197
199 void wm_mouse_double_click(message& message);
200 void wm_mouse_down(message& message);
201 void wm_mouse_up(message& message);
202
203 forms::appearance appearance_ = forms::appearance::normal;
204 bool auto_check_ = true;
205 bool checked_ = false;
206 content_alignment check_align_ = content_alignment::middle_left;
209 };
210 }
211}
Contains xtd::forms::appearance enum class.
Contains xtd::forms::button_base 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
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
Enables the user to select a single option from a group of choices when paired with other xtd::forms:...
Definition radio_button.h:26
void wnd_proc(message &message) override
Processes Windows messages.
void on_mouse_down(const mouse_event_args &e) override
Raises the control::mouse_down event.
Definition radio_button.h:154
virtual forms::appearance appearance() const
Gets a value determining the appearance of the radio_button.
Definition radio_button.h:35
void on_paint(paint_event_args &e) override
Raises the control::paint event.
void on_mouse_leave(const event_args &e) override
Raises the control::mouse_leave event.
Definition radio_button.h:170
drawing::size measure_control() const override
Measure this control.
void on_mouse_enter(const event_args &e) override
Raises the control::mouse_enter event.
Definition radio_button.h:162
xtd::ustring to_string() const noexcept override
Returns a string that represents the progress_bar control.
Definition radio_button.h:80
virtual radio_button & check_align(content_alignment check_align)
Sets the horizontal and vertical alignment of the check mark on a check_box control.
virtual radio_button & auto_check(bool auto_check)
Sets a value indicating whether the checked value and the appearance of the control automatically cha...
forms::create_params create_params() const override
Gets the required creation parameters when the control handle is created.
void on_got_focus(const event_args &e) override
Raises the control::got_focus event.
Definition radio_button.h:134
void on_mouse_up(const mouse_event_args &e) override
Raises the control::mouse_up event.
Definition radio_button.h:186
drawing::size default_size() const override
Gets the default size of the control.
Definition radio_button.h:72
void on_mouse_move(const mouse_event_args &e) override
Raises the control::mouse_move event.
Definition radio_button.h:178
void perform_click()
Generates a click event for the control, simulating a click by a user.
virtual void on_appearance_changed(const event_args &e)
Raises the radio_button::appearance_changed event.
Definition radio_button.h:106
radio_button()
Initializes a new instance of the radio_button class.
void on_enabled_changed(const event_args &e) override
Raises the control::enabled_changed event.
Definition radio_button.h:126
virtual void on_checked_changed(const event_args &e)
Raises the radio_button::radio_button::checked_changed event.
Definition radio_button.h:117
virtual bool auto_check() const
Gets a value indicating whether the checked value and the appearance of the control automatically cha...
Definition radio_button.h:46
virtual bool checked() const
Gets a value indicating whether the control is checked.
Definition radio_button.h:56
virtual radio_button & appearance(forms::appearance appearance)
Sets a value determining the appearance of the radio_button.
void on_handle_created(const event_args &e) override
Overrides the on_handle_created(const event_args&) method.
virtual content_alignment check_align() const
Gets the horizontal and vertical alignment of the check mark on a check_box control.
Definition radio_button.h:64
void on_lost_focus(const event_args &e) override
Raises the control::lost_focus event.
Definition radio_button.h:146
virtual radio_button & checked(bool checked)
Sets a value indicating whether the control is checked.
Represents text as a sequence of UTF-8 code units.
Definition ustring.h:48
event< radio_button, event_handler > appearance_changed
Occurs when the appearance property value changes.
Definition radio_button.h:84
event< radio_button, event_handler > checked_changed
Occurs when the value of the checked property changes.
Definition radio_button.h:88
#define forms_export_
Define shared library export.
Definition forms_export.h:13
@ e
The E key.
radio_button_state
Specifies the visual state of a radio button that is drawn with visual styles.
Definition radio_button_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
@ unchecked_normal
The radio button is unchecked.
@ checked_normal
The radio button is checked.
@ checked_disabled
The radio button is checked and disabled.
@ unchecked_pressed
The radio button is unchecked and pressed.
@ checked_hot
The radio button is checked and hot.
@ unchecked_hot
The radio button is unchecked and hot.
@ unchecked_disabled
The radio button is unchecked and disabled.
@ checked_pressed
The radio button is checked and pressed.
@ system
The appearance of the control is determined by the user's operating system.
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
Contains xtd::forms::visual_styles::radio_button_state enum class.