xtd 0.2.0
toggle_button.hpp
Go to the documentation of this file.
1
4#pragma once
6#include "button_base.hpp"
7#include "check_state.hpp"
8
10namespace xtd {
12 namespace forms {
45 struct data;
46
47 public:
49
55
57
62 virtual bool auto_check() const noexcept;
67
70 virtual content_alignment check_align() const noexcept;
74
78 virtual bool checked() const noexcept;
83
93 virtual forms::check_state check_state() const noexcept;
103
107 virtual bool three_state() const noexcept;
113
115
123 static toggle_button create(const drawing::point& location);
128 static toggle_button create(const drawing::point& location, const drawing::size& size);
134 static toggle_button create(const drawing::point& location, const drawing::size& size, const xtd::string& name);
138 static toggle_button create(const xtd::string& text);
143 static toggle_button create(const xtd::string& text, const drawing::point& location);
149 static toggle_button create(const xtd::string& text, const drawing::point& location, const drawing::size& size);
156 static toggle_button create(const xtd::string& text, const drawing::point& location, const drawing::size& size, const xtd::string& name);
167 static toggle_button create(const xtd::string& text, xtd::forms::check_state check_state, const drawing::point& location);
174 static toggle_button create(const xtd::string& text, xtd::forms::check_state check_state, const drawing::point& location, const drawing::size& size);
182 static toggle_button create(const xtd::string& text, xtd::forms::check_state check_state, const drawing::point& location, const drawing::size& size, const xtd::string& name);
195 static toggle_button create(const xtd::string& text, bool three_state, xtd::forms::check_state check_state, const drawing::point& location);
203 static toggle_button create(const xtd::string& text, bool three_state, xtd::forms::check_state check_state, const drawing::point& location, const drawing::size& size);
212 static toggle_button create(const xtd::string& text, bool three_state, xtd::forms::check_state check_state, const drawing::point& location, const drawing::size& size, const xtd::string& name);
221 static toggle_button create(const control& parent, const drawing::point& location);
227 static toggle_button create(const control& parent, const drawing::point& location, const drawing::size& size);
234 static toggle_button create(const control& parent, const drawing::point& location, const drawing::size& size, const xtd::string& name);
239 static toggle_button create(const control& parent, const xtd::string& text);
245 static toggle_button create(const control& parent, const xtd::string& text, const drawing::point& location);
252 static toggle_button create(const control& parent, const xtd::string& text, const drawing::point& location, const drawing::size& size);
260 static toggle_button create(const control& parent, const xtd::string& text, const drawing::point& location, const drawing::size& size, const xtd::string& name);
273 static toggle_button create(const control& parent, const xtd::string& text, xtd::forms::check_state check_state, const drawing::point& location);
281 static toggle_button create(const control& parent, const xtd::string& text, xtd::forms::check_state check_state, const drawing::point& location, const drawing::size& size);
290 static toggle_button create(const control& parent, const xtd::string& text, xtd::forms::check_state check_state, const drawing::point& location, const drawing::size& size, const xtd::string& name);
305 static toggle_button create(const control& parent, const xtd::string& text, bool three_state, xtd::forms::check_state check_state, const drawing::point& location);
314 static toggle_button create(const control& parent, const xtd::string& text, bool three_state, xtd::forms::check_state check_state, const drawing::point& location, const drawing::size& size);
324 static toggle_button create(const control& parent, const xtd::string& text, bool three_state, xtd::forms::check_state check_state, const drawing::point& location, const drawing::size& size, const xtd::string& name);
326
328
333
338
339 protected:
341
345 forms::create_params create_params() const noexcept override;
347
349
355 xtd::uptr<xtd::object> clone() const override;
356
360 drawing::size measure_control() const noexcept override;
361
366 virtual void on_checked_changed(const event_args& e);
367
372 virtual void on_check_state_changed(const event_args& e);
373
374 void on_enabled_changed(const event_args& e) override;
375
378 void on_handle_created(const event_args& e) override;
379
380 void on_mouse_down(const mouse_event_args& e) override;
381 void on_mouse_enter(const event_args& e) override;
382 void on_mouse_leave(const event_args& e) override;
383 void on_mouse_up(const mouse_event_args& e) override;
384 void on_paint(paint_event_args& e) override;
385
388 xtd::forms::visual_styles::toggle_button_state state() const noexcept;
389
390 void wnd_proc(message& message) override;
392
393 private:
394 void wm_mouse_double_click(message& message);
395 void wm_mouse_down(message& message);
396 void wm_mouse_up(message& message);
397
398 xtd::sptr<data> data_;
399 };
400 }
401}
Contains xtd::forms::button_base class.
Contains xtd::forms::check_state enum class.
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition event_args.hpp:18
Represents an event.
Definition event.hpp:21
Implements the basic functionality common to button controls.
Definition button_base.hpp:37
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.
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
void on_enabled_changed(const event_args &e) override
Raises the xtd::forms::control::enabled_changed event.
void on_handle_created(const event_args &e) override
Raises the xtd::forms::control::handle_created event.
virtual content_alignment check_align() const noexcept
Gets the horizontal and vertical alignment of the check mark on a toggle_button control.
virtual void on_check_state_changed(const event_args &e)
Raises the toggle_button::check_state_changed event.
void on_mouse_up(const mouse_event_args &e) override
Raises the xtd::forms::control::mouse_up event.
virtual bool auto_check() const noexcept
Gets a value indicating whether the checked or check_state values and the toggle_button's appearance ...
drawing::size measure_control() const noexcept override
Measure this control.
virtual bool checked() const noexcept
Gets a value indicating whether the toggle_button is in the checked state.
virtual bool three_state() const noexcept
Gets a value indicating whether the toggle_button will allow three check states rather than two.
void on_mouse_down(const mouse_event_args &e) override
Raises the xtd::forms::control::mouse_down event.
xtd::forms::visual_styles::toggle_button_state state() const noexcept
Gets state.
virtual void on_checked_changed(const event_args &e)
Raises the toggle_button::checked_changed event.
void on_paint(paint_event_args &e) override
Raises the xtd::forms::control::paint event.
virtual forms::check_state check_state() const noexcept
Gets the state of the toggle_button.
toggle_button()
Initializes a new instance of the CheckBox class.
forms::create_params create_params() const noexcept override
Gets the required creation parameters when the control handle is created.
static toggle_button create()
A factory to create an xtd::forms::toggle_button.
event< toggle_button, event_handler > checked_changed
Occurs when the value of the checked property changes.
Definition toggle_button.hpp:332
xtd::uptr< xtd::object > clone() const override
Creates a new object that is a copy of the current instance.
void wnd_proc(message &message) override
Processes Windows messages.
event< toggle_button, event_handler > check_state_changed
Occurs when the value of the check_state property changes.
Definition toggle_button.hpp:336
void on_mouse_enter(const event_args &e) override
Raises the xtd::forms::control::mouse_enter event.
void on_mouse_leave(const event_args &e) override
Raises the xtd::forms::control::mouse_leave event.
generic_event_handler< const xtd::event_args & > event_handler
Represents the method that will handle an event that has no event data.
Definition event_handler.hpp:24
#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
xtd::unique_ptr_object< type_t > uptr
The xtd::uptr object is a unique pointer.
Definition uptr.hpp:25
content_alignment
Specifies alignment of content on the drawing surface.
Definition content_alignment.hpp:21
@ e
The E key.
Definition keys.hpp:207
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:219
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
Implements a Windows message.
Definition message.hpp:33
Contains xtd::forms::visual_styles::toggle_button_state enum class.