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 {
33 struct data;
34
35 public:
37
42
44
49 virtual bool auto_check() const noexcept;
55
58 virtual xtd::drawing::color checked_back_color() const noexcept;
61 virtual switch_button& checked_back_color(const xtd::drawing::color& color);
63 virtual switch_button& checked_back_color(std::nullptr_t);
65
68 virtual xtd::drawing::color slider_color() const noexcept;
71 virtual switch_button& slider_color(const xtd::drawing::color& color);
73 virtual switch_button& slider_color(std::nullptr_t);
75
78 virtual bool rounded() const noexcept;
82 virtual switch_button& rounded(bool value);
83
86 virtual bool checked() const noexcept;
91
94 virtual bool show_text() const noexcept;
98 virtual switch_button& show_text(bool value);
100
102
110 static switch_button create(const drawing::point& location);
115 static switch_button create(const drawing::point& location, const drawing::size& size);
121 static switch_button create(const drawing::point& location, const drawing::size& size, const xtd::string& name);
132 static switch_button create(bool checked, const drawing::point& location);
139 static switch_button create(bool checked, const drawing::point& location, const drawing::size& size);
147 static switch_button create(bool checked, const drawing::point& location, const drawing::size& size, const xtd::string& name);
156 static switch_button create(const control& parent, const drawing::point& location);
162 static switch_button create(const control& parent, const drawing::point& location, const drawing::size& size);
169 static switch_button create(const control& parent, const drawing::point& location, const drawing::size& size, const xtd::string& name);
182 static switch_button create(const control& parent, bool checked, const drawing::point& location);
190 static switch_button create(const control& parent, bool checked, const drawing::point& location, const drawing::size& size);
199 static switch_button create(const control& parent, bool checked, const drawing::point& location, const drawing::size& size, const xtd::string& name);
201
203
209
210 protected:
212
216 drawing::size default_size() const noexcept override;
218
220
226 xtd::uptr<xtd::object> clone() const override;
227
232 virtual void on_checked_changed(const event_args& e);
233
234 void on_mouse_down(const mouse_event_args& e) override;
235 void on_handle_created(const event_args& e) override;
236 void on_paint(paint_event_args& e) override;
237 void on_resize(const event_args& e) override;
239
240 private:
241 xtd::sptr<data> data_;
242 };
243 }
244}
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:37
Defines the base class for controls, which are components with visual representation.
Definition control.h: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 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:34
Provides data for the xtd::forms::control::paint event.
Definition paint_event_args.h:30
Represents a standard Windows switch button.
Definition switch_button.h:32
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.
event< switch_button, event_handler > checked_changed
Occurs when the value of the checked property changes.
Definition switch_button.h:207
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.
xtd::uptr< xtd::object > clone() const override
Creates a new object that is a copy of the current instance.
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.
generic_event_handler<> event_handler
Represents the method that will handle an event that has no event data.
Definition event_handler.h:32
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
@ 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