xtd 0.2.0
Loading...
Searching...
No Matches
switch_button.h
Go to the documentation of this file.
1
4#include "button_base.h"
5#include <xtd/optional>
6
7namespace xtd {
8 namespace forms {
31 struct data;
32
33 public:
35
40
42
47 virtual bool auto_check() const noexcept;
53
56 virtual xtd::drawing::color checked_back_color() const noexcept;
59 virtual switch_button& checked_back_color(const xtd::drawing::color& color);
61 virtual switch_button& checked_back_color(std::nullptr_t);
63
66 virtual xtd::drawing::color slider_color() const noexcept;
69 virtual switch_button& slider_color(const xtd::drawing::color& color);
71 virtual switch_button& slider_color(std::nullptr_t);
73
76 virtual bool rounded() const noexcept;
80 virtual switch_button& rounded(bool value);
81
84 virtual bool checked() const noexcept;
89
92 virtual bool show_text() const noexcept;
96 virtual switch_button& show_text(bool value);
98
100
108 static switch_button create(const drawing::point& location);
113 static switch_button create(const drawing::point& location, const drawing::size& size);
119 static switch_button create(const drawing::point& location, const drawing::size& size, const xtd::ustring& name);
130 static switch_button create(bool checked, const drawing::point& location);
137 static switch_button create(bool checked, const drawing::point& location, const drawing::size& size);
145 static switch_button create(bool checked, const drawing::point& location, const drawing::size& size, const xtd::ustring& name);
154 static switch_button create(const control& parent, const drawing::point& location);
160 static switch_button create(const control& parent, const drawing::point& location, const drawing::size& size);
167 static switch_button create(const control& parent, const drawing::point& location, const drawing::size& size, const xtd::ustring& name);
180 static switch_button create(const control& parent, bool checked, const drawing::point& location);
188 static switch_button create(const control& parent, bool checked, const drawing::point& location, const drawing::size& size);
197 static switch_button create(const control& parent, bool checked, const drawing::point& location, const drawing::size& size, const xtd::ustring& name);
199
201
207
208 protected:
210
214 drawing::size default_size() const noexcept override;
216
218
224 std::unique_ptr<xtd::object> clone() const override;
225
230 virtual void on_checked_changed(const event_args& e);
231
232 void on_mouse_down(const mouse_event_args& e) override;
233 void on_handle_created(const event_args& e) override;
234 void on_paint(paint_event_args& e) override;
235 void on_resize(const event_args& e) override;
237
238 private:
239 std::shared_ptr<data> data_;
240 };
241 }
242}
Contains xtd::forms::button_base 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
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::ustring & name() const noexcept
Gets the name 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.h:32
Provides data for the xtd::forms::control::paint event.
Definition paint_event_args.h:28
Represents a standard Windows switch button.
Definition switch_button.h:30
void on_resize(const event_args &e) override
Raises the xtd::forms::control::region event.
virtual bool show_text() const noexcept
Gets a value indicating whether the switch_button text is shown.
virtual bool rounded() const noexcept
Gets a value indicating whether the switch_button is rounded appearance.
virtual bool checked() const noexcept
Gets a value indicating whether the switch_button is in the checked state.
std::unique_ptr< xtd::object > clone() const override
Creates a new object that is a copy of the current instance.
event< switch_button, event_handler > checked_changed
Occurs when the value of the checked property changes.
Definition switch_button.h:205
virtual xtd::drawing::color slider_color() const noexcept
Gets the slider color for the control.
void on_mouse_down(const mouse_event_args &e) override
Raises the xtd::forms::control::mouse_down event.
static switch_button create()
A factory to create an xtd::forms::switch_button.
void on_paint(paint_event_args &e) override
Raises the xtd::forms::control::paint event.
virtual bool auto_check() const noexcept
Gets a value indicating whether the checked and the switch_button's appearance are automatically chan...
void on_handle_created(const event_args &e) override
Raises the xtd::forms::control::handle_created event.
virtual xtd::drawing::color checked_back_color() const noexcept
Gets the checked background color for the control.
virtual void on_checked_changed(const event_args &e)
Raises the switch_button::checked_changed event.
drawing::size default_size() const noexcept override
Gets the default size of the control.
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
size_t size
Represents a size of any object in bytes.
Definition types.h:197
@ e
The E key.
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