xtd 0.2.0
button_base.hpp
Go to the documentation of this file.
1
4#pragma once
5#include "control.hpp"
7#include "image_list.hpp"
9#include "flat_style.hpp"
10#include "text_format_flags.hpp"
11#include <xtd/drawing/image>
12
14namespace xtd {
16 namespace forms {
38 struct data;
39
40 public:
42
47 virtual bool auto_ellipsis() const noexcept;
48
53
54 bool auto_size() const noexcept override;
55 control& auto_size(bool auto_size) override;
56
59
62 virtual const xtd::forms::flat_button_appearance& flat_appearance() const noexcept;
66
69 virtual xtd::forms::flat_style flat_style() const noexcept;
73
78 virtual const drawing::image& image() const noexcept;
83 virtual button_base& image(const drawing::image& value);
84
87 virtual content_alignment image_align() const noexcept;
91
97 virtual int32 image_index() const noexcept;
104
107 virtual const forms::image_list& image_list() const noexcept;
110 virtual forms::image_list& image_list() noexcept;
113 virtual button_base& image_list(const forms::image_list& value);
114
117 virtual content_alignment text_align() const noexcept ;
122
124
131
132 protected:
134
137 button_base() noexcept;
139
141
145 forms::create_params create_params() const noexcept override;
146
151 bool is_default() const noexcept;
158
160
165 drawing::size measure_control() const noexcept override;
166
167 void on_back_color_changed(const event_args& e) override;
168 void on_enabled_changed(const event_args& e) override;
169 void on_font_changed(const xtd::event_args& e) override;
170 void on_fore_color_changed(const event_args& e) override;
171
174 virtual void on_image_changed(const xtd::event_args& e);
175
176 void on_mouse_down(const mouse_event_args& e) override;
177 void on_mouse_enter(const event_args& e) override;
178 void on_mouse_leave(const event_args& e) override;
179 void on_mouse_up(const mouse_event_args& e) override;
182 void on_resize(const xtd::event_args& e) override;
183 void on_text_changed(const xtd::event_args& e) override;
185
187 xtd::drawing::rectangle compute_image_bounds();
188 xtd::drawing::rectangle compute_image_bounds(const xtd::drawing::rectangle& rectangle);
189 text_format_flags to_text_format_flags(content_alignment text_align);
191
192 private:
193 xtd::sptr<data> data_;
194 };
195 }
196}
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:21
virtual bool auto_ellipsis() const noexcept
Gets a value indicating whether the ellipsis character (...) appears at the right edge of the control...
void on_enabled_changed(const event_args &e) override
Raises the xtd::forms::control::enabled_changed event.
void on_mouse_up(const mouse_event_args &e) override
Raises the xtd::forms::control::mouse_up event.
void on_mouse_down(const mouse_event_args &e) override
Raises the xtd::forms::control::mouse_down event.
event< button_base, event_handler > image_changed
Occurs when the value of the image property changes.
Definition button_base.hpp:129
button_base() noexcept
Initializes a new instance of the ButtonBase class.
void on_fore_color_changed(const event_args &e) override
Raises the xtd::forms::control::fore_color_changed event.
virtual int32 image_index() const noexcept
Gets the image list index value of the image displayed on the button control.
void on_parent_fore_color_changed(const event_args &e) override
Raises the xtd::forms::control::parent_fore_color_changed event.
virtual content_alignment text_align() const noexcept
Gets the alignment of the text on the button control.
virtual const forms::image_list & image_list() const noexcept
Gets the image_list that contains the image displayed on a button control.
bool auto_size() const noexcept override
Gets a value that indicates whether the control resizes based on its contents.
void on_back_color_changed(const event_args &e) override
Raises the xtd::forms::control::back_color_changed event.
void on_text_changed(const xtd::event_args &e) override
Raises the xtd::forms::control::text_changed event.
void on_parent_back_color_changed(const event_args &e) override
Raises the xtd::forms::control::parent_back_color_changed event.
virtual void on_image_changed(const xtd::event_args &e)
Raises the button_base::image_changed event.
void on_mouse_enter(const event_args &e) override
Raises the xtd::forms::control::mouse_enter event.
drawing::size measure_control() const noexcept override
Measure this control.
void on_resize(const xtd::event_args &e) override
Raises the xtd::forms::control::region event.
virtual const xtd::forms::flat_button_appearance & flat_appearance() const noexcept
Gets the appearance of the border and the colors used to indicate check state and mouse state.
void on_font_changed(const xtd::event_args &e) override
Raises the xtd::forms::control::font_changed event.
virtual xtd::forms::flat_style flat_style() const noexcept
Gets the flat style appearance of the button control.
virtual const drawing::image & image() const noexcept
Gets the image that is displayed on a button control.
control & control_appearance(forms::control_appearance value) override
Sets control appearance.
forms::create_params create_params() const noexcept override
Gets the required creation parameters when the control handle is created.
bool is_default() const noexcept
Gets a value indicating whether the button control is the default button.
void on_mouse_leave(const event_args &e) override
Raises the xtd::forms::control::mouse_leave event.
virtual content_alignment image_align() const noexcept
Gets the alignment of the image on the button control.
Defines the base class for controls, which are components with visual representation.
Definition control.hpp:81
control()
Initializes a new instance of the xtd::forms::control class with default settings.
virtual drawing::size size() const noexcept
Gets the height and width of the control.
Provides properties that specify the appearance of xtd::forms::button controls whose xtd::forms::flat...
Definition flat_button_appearance.hpp:24
Provides data for the xtd::forms::control::mouse_up, xtd::forms::control::mouse_down,...
Definition mouse_event_args.hpp:34
Contains xtd::forms::content_alignment enum class.
Contains xtd::forms::control control.
Contains xtd::forms::flat_button_appearance class.
Contains xtd::forms::flat_style enum class.
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
int32_t int32
Represents a 32-bit signed integer.
Definition int32.hpp:23
text_format_flags
Specifies the display and layout information for text strings.
Definition text_format_flags.hpp:22
content_alignment
Specifies alignment of content on the drawing surface.
Definition content_alignment.hpp:21
@ e
The E key.
Definition keys.hpp:207
Contains xtd::forms::image_list component.
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition actions_system_images.hpp:10
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 const_pointer data() const noexcept
Gets direct access to the underlying contiguous storage.
Definition read_only_span.hpp:201
Contains xtd::forms::text_format_flags enum class.