xtd 0.2.0
Loading...
Searching...
No Matches
toggle_button.h
Go to the documentation of this file.
1
4#pragma once
6#include "button_base.h"
7#include "check_state.h"
8
10namespace xtd {
12 namespace forms {
45 struct data;
46
47 public:
49
55
57
62 virtual bool auto_check() const noexcept;
66 virtual toggle_button& auto_check(bool auto_check);
67
70 virtual content_alignment check_align() const noexcept;
73 virtual toggle_button& check_align(content_alignment check_align);
74
78 virtual bool checked() const noexcept;
82 virtual toggle_button& checked(bool checked);
83
93 virtual forms::check_state check_state() const noexcept;
103
107 virtual bool three_state() const noexcept;
111 virtual toggle_button& three_state(bool three_state);
113
115
119 static toggle_button create();
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);
161 static toggle_button create(const xtd::string& text, xtd::forms::check_state check_state);
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);
188 static toggle_button create(const xtd::string& text, bool three_state, xtd::forms::check_state check_state);
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);
216 static toggle_button create(const control& parent);
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);
266 static toggle_button create(const control& parent, const xtd::string& text, xtd::forms::check_state check_state);
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);
297 static toggle_button create(const control& parent, const xtd::string& text, bool three_state, xtd::forms::check_state check_state);
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
336 event<toggle_button, event_handler> check_state_changed;
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.h:18
Represents an event.
Definition event.h:21
Implements the basic functionality common to button controls.
Definition button_base.h:37
Defines the base class for controls, which are components with visual representation.
Definition control.h:81
Encapsulates the information needed when creating a control.
Definition create_params.h:29
Implements a Windows message.
Definition message.h:28
Provides data for the xtd::forms::control::mouse_up, xtd::forms::control::mouse_down,...
Definition mouse_event_args.h:34
Provides data for the xtd::forms::control::paint event.
Definition paint_event_args.h:30
Represents a Windows toggle_button.
Definition toggle_button.h:44
virtual bool auto_check() const noexcept
Gets a value indicating whether the checked or check_state values and the toggle_button's appearance ...
toggle_button()
Initializes a new instance of the CheckBox class.
generic_event_handler<> event_handler
Represents the method that will handle an event that has no event data.
Definition event_handler.h:32
#define forms_export_
Define shared library export.
Definition forms_export.h:13
std::unique_ptr< type_t > uptr
The xtd::uptr object is a unique pointer.
Definition uptr.h:25
size_t size
Represents a size of any object in bytes.
Definition size.h:23
std::shared_ptr< type_t > sptr
The xtd::sptr object is a shared pointer.
Definition sptr.h:25
check_state
Specifies the state of a control, such as a check box, that can be checked, unchecked,...
Definition check_state.h:23
content_alignment
Specifies alignment of content on the drawing surface.
Definition content_alignment.h:21
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition xtd_about_box.h:12
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
Contains xtd::forms::visual_styles::toggle_button_state enum class.