xtd 1.0.0
Loading...
Searching...
No Matches
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 [[nodiscard]] virtual auto auto_check() const noexcept -> bool;
66 virtual auto auto_check(bool value) -> toggle_button&;
67
70 [[nodiscard]] virtual auto check_align() const noexcept -> xtd::forms::content_alignment;
74
78 [[nodiscard]] virtual auto checked() const noexcept -> bool;
82 virtual auto checked(bool value) -> toggle_button&;
83
93 [[nodiscard]] virtual auto check_state() const noexcept -> xtd::forms::check_state;
102 virtual auto check_state(xtd::forms::check_state value) -> toggle_button&;
103
107 [[nodiscard]] virtual auto three_state() const noexcept -> bool;
111 virtual auto three_state(bool value) -> toggle_button&;
113
115
119 [[nodiscard]] static auto create() -> toggle_button;
123 [[nodiscard]] static auto create(const xtd::drawing::point& location) -> toggle_button;
128 [[nodiscard]] static auto create(const xtd::drawing::point& location, const xtd::drawing::size& size) -> toggle_button;
134 [[nodiscard]] static auto create(const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> toggle_button;
138 [[nodiscard]] static auto create(const xtd::string& text) -> toggle_button;
143 [[nodiscard]] static auto create(const xtd::string& text, const xtd::drawing::point& location) -> toggle_button;
149 [[nodiscard]] static auto create(const xtd::string& text, const xtd::drawing::point& location, const xtd::drawing::size& size) -> toggle_button;
156 [[nodiscard]] static auto create(const xtd::string& text, const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> toggle_button;
161 [[nodiscard]] static auto create(const xtd::string& text, xtd::forms::check_state check_state) -> toggle_button;
167 [[nodiscard]] static auto create(const xtd::string& text, xtd::forms::check_state check_state, const xtd::drawing::point& location) -> toggle_button;
174 [[nodiscard]] static auto create(const xtd::string& text, xtd::forms::check_state check_state, const xtd::drawing::point& location, const xtd::drawing::size& size) -> toggle_button;
182 [[nodiscard]] static auto create(const xtd::string& text, xtd::forms::check_state check_state, const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> toggle_button;
188 [[nodiscard]] static auto create(const xtd::string& text, bool three_state, xtd::forms::check_state check_state) -> toggle_button;
195 [[nodiscard]] static auto create(const xtd::string& text, bool three_state, xtd::forms::check_state check_state, const xtd::drawing::point& location) -> toggle_button;
203 [[nodiscard]] static auto create(const xtd::string& text, bool three_state, xtd::forms::check_state check_state, const xtd::drawing::point& location, const xtd::drawing::size& size) -> toggle_button;
212 [[nodiscard]] static auto create(const xtd::string& text, bool three_state, xtd::forms::check_state check_state, const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> toggle_button;
216 [[nodiscard]] static auto create(const xtd::forms::control& parent) -> toggle_button;
221 [[nodiscard]] static auto create(const xtd::forms::control& parent, const xtd::drawing::point& location) -> toggle_button;
227 [[nodiscard]] static auto create(const xtd::forms::control& parent, const xtd::drawing::point& location, const xtd::drawing::size& size) -> toggle_button;
234 [[nodiscard]] static auto create(const xtd::forms::control& parent, const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> toggle_button;
239 [[nodiscard]] static auto create(const xtd::forms::control& parent, const xtd::string& text) -> toggle_button;
245 [[nodiscard]] static auto create(const xtd::forms::control& parent, const xtd::string& text, const xtd::drawing::point& location) -> toggle_button;
252 [[nodiscard]] static auto create(const xtd::forms::control& parent, const xtd::string& text, const xtd::drawing::point& location, const xtd::drawing::size& size) -> toggle_button;
260 [[nodiscard]] static auto create(const xtd::forms::control& parent, const xtd::string& text, const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> toggle_button;
266 [[nodiscard]] static auto create(const xtd::forms::control& parent, const xtd::string& text, xtd::forms::check_state check_state) -> toggle_button;
273 [[nodiscard]] static auto create(const xtd::forms::control& parent, const xtd::string& text, xtd::forms::check_state check_state, const xtd::drawing::point& location) -> toggle_button;
281 [[nodiscard]] static auto create(const xtd::forms::control& parent, const xtd::string& text, xtd::forms::check_state check_state, const xtd::drawing::point& location, const xtd::drawing::size& size) -> toggle_button;
290 [[nodiscard]] static auto create(const xtd::forms::control& parent, const xtd::string& text, xtd::forms::check_state check_state, const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> toggle_button;
297 [[nodiscard]] static auto create(const xtd::forms::control& parent, const xtd::string& text, bool three_state, xtd::forms::check_state check_state) -> toggle_button;
305 [[nodiscard]] static auto create(const xtd::forms::control& parent, const xtd::string& text, bool three_state, xtd::forms::check_state check_state, const xtd::drawing::point& location) -> toggle_button;
314 [[nodiscard]] static auto create(const xtd::forms::control& parent, const xtd::string& text, bool three_state, xtd::forms::check_state check_state, const xtd::drawing::point& location, const xtd::drawing::size& size) -> toggle_button;
324 [[nodiscard]] static auto create(const xtd::forms::control& parent, const xtd::string& text, bool three_state, xtd::forms::check_state check_state, const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> toggle_button;
326
328
333
338
339 protected:
341
345 [[nodiscard]] auto create_params() const noexcept -> xtd::forms::create_params override;
347
349
354 [[nodiscard]] auto measure_control() const noexcept -> xtd::drawing::size override;
355
360 virtual auto on_checked_changed(const xtd::event_args& e) -> void;
361
366 virtual auto on_check_state_changed(const xtd::event_args& e) -> void;
367
368 auto on_enabled_changed(const xtd::event_args& e) -> void override;
369
372 auto on_handle_created(const xtd::event_args& e) -> void override;
373
374 auto on_mouse_down(const xtd::forms::mouse_event_args& e) -> void override;
375 auto on_mouse_enter(const xtd::event_args& e) -> void override;
376 auto on_mouse_leave(const xtd::event_args& e) -> void override;
377 auto on_mouse_up(const xtd::forms::mouse_event_args& e) -> void override;
378 auto on_paint(xtd::forms::paint_event_args& e) -> void override;
379
382 [[nodiscard]] auto state() const noexcept -> xtd::forms::visual_styles::toggle_button_state;
383
384 auto wnd_proc(xtd::forms::message& message) -> void override;
386
387 private:
388 auto wm_mouse_double_click(xtd::forms::message& message) -> void;
389 auto wm_mouse_down(xtd::forms::message& message) -> void;
390 auto wm_mouse_up(xtd::forms::message& message) -> void;
391
392 xtd::sptr<data> data_;
393 };
394 }
395}
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:23
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 auto size() const noexcept -> xtd::drawing::size
Gets the height and width of the control.
virtual auto parent() const noexcept -> std::optional< xtd::forms::control_ref >
Gets the parent container of the control.
virtual auto text() const noexcept -> const xtd::string &
Gets the text associated with this control.
virtual auto name() const noexcept -> const xtd::string &
Gets the name of the control.
virtual auto location() const noexcept -> xtd::drawing::point
Gets the coordinates of the upper-left corner of the control relative to the upper-left corner of its...
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:26
static auto create() -> toggle_button
A factory to create an xtd::forms::toggle_button.
virtual auto checked() const noexcept -> bool
Gets a value indicating whether the toggle_button is in the checked state.
auto on_mouse_down(const xtd::forms::mouse_event_args &e) -> void override
Raises the xtd::forms::control::mouse_down event.
auto state() const noexcept -> xtd::forms::visual_styles::toggle_button_state
Gets state.
virtual auto check_align() const noexcept -> xtd::forms::content_alignment
Gets the horizontal and vertical alignment of the check mark on a toggle_button control.
virtual auto on_check_state_changed(const xtd::event_args &e) -> void
Raises the toggle_button::check_state_changed event.
auto on_mouse_up(const xtd::forms::mouse_event_args &e) -> void override
Raises the xtd::forms::control::mouse_up event.
auto on_enabled_changed(const xtd::event_args &e) -> void override
Raises the xtd::forms::control::enabled_changed event.
virtual auto check_state() const noexcept -> xtd::forms::check_state
Gets the state of the toggle_button.
virtual auto auto_check() const noexcept -> bool
Gets a value indicating whether the checked or check_state values and the toggle_button's appearance ...
auto on_handle_created(const xtd::event_args &e) -> void override
Raises the xtd::forms::control::handle_created event.
toggle_button()
Initializes a new instance of the CheckBox class.
auto on_mouse_enter(const xtd::event_args &e) -> void override
Raises the xtd::forms::control::mouse_enter event.
auto wnd_proc(xtd::forms::message &message) -> void override
Processes Windows messages.
xtd::event< toggle_button, xtd::event_handler > checked_changed
Occurs when the value of the checked property changes.
Definition toggle_button.hpp:332
auto measure_control() const noexcept -> xtd::drawing::size override
Measure this control.
xtd::event< toggle_button, xtd::event_handler > check_state_changed
Occurs when the value of the check_state property changes.
Definition toggle_button.hpp:336
auto create_params() const noexcept -> xtd::forms::create_params override
Gets the required creation parameters when the control handle is created.
auto on_paint(xtd::forms::paint_event_args &e) -> void override
Raises the xtd::forms::control::paint event.
virtual auto on_checked_changed(const xtd::event_args &e) -> void
Raises the toggle_button::checked_changed event.
virtual auto three_state() const noexcept -> bool
Gets a value indicating whether the toggle_button will allow three check states rather than two.
auto on_mouse_leave(const xtd::event_args &e) -> void 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
content_alignment
Specifies alignment of content on the drawing surface.
Definition content_alignment.hpp:21
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 auto data() const noexcept -> const_pointer
Gets direct access to the underlying contiguous storage.
Definition read_only_span.hpp:197
Implements a Windows message.
Definition message.hpp:33
Contains xtd::forms::visual_styles::toggle_button_state enum class.