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 {
43 struct data;
44
45 public:
47
53
55
60 virtual bool auto_check() const noexcept;
64 virtual toggle_button& auto_check(bool auto_check);
65
68 virtual content_alignment check_align() const noexcept;
71 virtual toggle_button& check_align(content_alignment check_align);
72
76 virtual bool checked() const noexcept;
80 virtual toggle_button& checked(bool checked);
81
91 virtual forms::check_state check_state() const noexcept;
101
105 virtual bool three_state() const noexcept;
109 virtual toggle_button& three_state(bool three_state);
111
113
117 static toggle_button create();
121 static toggle_button create(const drawing::point& location);
126 static toggle_button create(const drawing::point& location, const drawing::size& size);
132 static toggle_button create(const drawing::point& location, const drawing::size& size, const xtd::ustring& name);
136 static toggle_button create(const xtd::ustring& text);
141 static toggle_button create(const xtd::ustring& text, const drawing::point& location);
147 static toggle_button create(const xtd::ustring& text, const drawing::point& location, const drawing::size& size);
154 static toggle_button create(const xtd::ustring& text, const drawing::point& location, const drawing::size& size, const xtd::ustring& name);
159 static toggle_button create(const xtd::ustring& text, xtd::forms::check_state check_state);
165 static toggle_button create(const xtd::ustring& text, xtd::forms::check_state check_state, const drawing::point& location);
172 static toggle_button create(const xtd::ustring& text, xtd::forms::check_state check_state, const drawing::point& location, const drawing::size& size);
180 static toggle_button create(const xtd::ustring& text, xtd::forms::check_state check_state, const drawing::point& location, const drawing::size& size, const xtd::ustring& name);
186 static toggle_button create(const xtd::ustring& text, bool three_state, xtd::forms::check_state check_state);
193 static toggle_button create(const xtd::ustring& text, bool three_state, xtd::forms::check_state check_state, const drawing::point& location);
201 static toggle_button create(const xtd::ustring& text, bool three_state, xtd::forms::check_state check_state, const drawing::point& location, const drawing::size& size);
210 static toggle_button create(const xtd::ustring& text, bool three_state, xtd::forms::check_state check_state, const drawing::point& location, const drawing::size& size, const xtd::ustring& name);
214 static toggle_button create(const control& parent);
219 static toggle_button create(const control& parent, const drawing::point& location);
225 static toggle_button create(const control& parent, const drawing::point& location, const drawing::size& size);
232 static toggle_button create(const control& parent, const drawing::point& location, const drawing::size& size, const xtd::ustring& name);
237 static toggle_button create(const control& parent, const xtd::ustring& text);
243 static toggle_button create(const control& parent, const xtd::ustring& text, const drawing::point& location);
250 static toggle_button create(const control& parent, const xtd::ustring& text, const drawing::point& location, const drawing::size& size);
258 static toggle_button create(const control& parent, const xtd::ustring& text, const drawing::point& location, const drawing::size& size, const xtd::ustring& name);
264 static toggle_button create(const control& parent, const xtd::ustring& text, xtd::forms::check_state check_state);
271 static toggle_button create(const control& parent, const xtd::ustring& text, xtd::forms::check_state check_state, const drawing::point& location);
279 static toggle_button create(const control& parent, const xtd::ustring& text, xtd::forms::check_state check_state, const drawing::point& location, const drawing::size& size);
288 static toggle_button create(const control& parent, const xtd::ustring& text, xtd::forms::check_state check_state, const drawing::point& location, const drawing::size& size, const xtd::ustring& name);
295 static toggle_button create(const control& parent, const xtd::ustring& text, bool three_state, xtd::forms::check_state check_state);
303 static toggle_button create(const control& parent, const xtd::ustring& text, bool three_state, xtd::forms::check_state check_state, const drawing::point& location);
312 static toggle_button create(const control& parent, const xtd::ustring& text, bool three_state, xtd::forms::check_state check_state, const drawing::point& location, const drawing::size& size);
322 static toggle_button create(const control& parent, const xtd::ustring& text, bool three_state, xtd::forms::check_state check_state, const drawing::point& location, const drawing::size& size, const xtd::ustring& name);
324
326
331
334 event<toggle_button, event_handler> check_state_changed;
336
337 protected:
339
343 forms::create_params create_params() const noexcept override;
345
347
353 std::unique_ptr<xtd::object> clone() const override;
354
358 drawing::size measure_control() const noexcept override;
359
364 virtual void on_checked_changed(const event_args& e);
365
370 virtual void on_check_state_changed(const event_args& e);
371
372 void on_enabled_changed(const event_args& e) override;
373
376 void on_handle_created(const event_args& e) override;
377
378 void on_mouse_down(const mouse_event_args& e) override;
379 void on_mouse_enter(const event_args& e) override;
380 void on_mouse_leave(const event_args& e) override;
381 void on_mouse_up(const mouse_event_args& e) override;
382 void on_paint(paint_event_args& e) override;
383
386 xtd::forms::visual_styles::toggle_button_state state() const noexcept;
387
388 void wnd_proc(message& message) override;
390
391 private:
392 void wm_mouse_double_click(message& message);
393 void wm_mouse_down(message& message);
394 void wm_mouse_up(message& message);
395
396 std::shared_ptr<data> data_;
397 };
398 }
399}
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:35
Defines the base class for controls, which are components with visual representation.
Definition control.h:79
Encapsulates the information needed when creating a control.
Definition create_params.h:27
Implements a Windows message.
Definition message.h:26
Provides data for the xtd::forms::control::mouse_up, xtd::forms::control::mouse_down,...
Definition mouse_event_args.h:32
Provides data for the xtd::forms::control::paint event.
Definition paint_event_args.h:28
Represents a Windows toggle_button.
Definition toggle_button.h:42
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.
Represents text as a sequence of UTF-8 code units.
Definition ustring.h:47
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
size_t size
Represents a size of any object in bytes.
Definition types.h:197
check_state
Specifies the state of a control, such as a check box, that can be checked, unchecked,...
Definition check_state.h:21
content_alignment
Specifies alignment of content on the drawing surface.
Definition content_alignment.h:19
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.