xtd 0.2.0
button_base.h
Go to the documentation of this file.
1 #pragma once
5 #include "control.h"
6 #include "content_alignment.h"
7 #include "image_list.h"
9 #include "flat_style.h"
10 #include "text_format_flags.h"
11 #include <xtd/drawing/image>
12 
14 namespace xtd {
16  namespace forms {
35  class forms_export_ button_base : public xtd::forms::control {
36  struct data;
37 
38  public:
40 
45  virtual bool auto_ellipsis() const noexcept;
46 
50  virtual button_base& auto_ellipsis(bool auto_ellipsis);
51 
52  bool auto_size() const noexcept override;
53  control& auto_size(bool auto_size) override;
54 
57 
60  virtual const xtd::forms::flat_button_appearance& flat_appearance() const noexcept;
63  virtual xtd::forms::button_base& flat_appearance(const xtd::forms::flat_button_appearance& value);
64 
67  virtual xtd::forms::flat_style flat_style() const noexcept;
71 
76  virtual const drawing::image& image() const noexcept;
81  virtual button_base& image(const drawing::image& value);
82 
85  virtual content_alignment image_align() const noexcept;
88  virtual button_base& image_align(content_alignment value);
89 
95  virtual int32 image_index() const noexcept;
101  virtual button_base& image_index(int32 value);
102 
105  virtual const forms::image_list& image_list() const noexcept;
108  virtual forms::image_list& image_list() noexcept;
111  virtual button_base& image_list(const forms::image_list& value);
112 
115  virtual content_alignment text_align() const noexcept ;
118  virtual button_base& text_align(content_alignment value);
120 
122 
129 
130  protected:
132 
135  button_base() noexcept;
137 
139 
143  forms::create_params create_params() const noexcept override;
144 
149  bool is_default() const noexcept;
154  button_base& is_default(bool value);
156 
158 
163  drawing::size measure_control() const noexcept override;
164 
165  void on_back_color_changed(const event_args& e) override;
166  void on_enabled_changed(const event_args& e) override;
167  void on_font_changed(const xtd::event_args& e) override;
168  void on_fore_color_changed(const event_args& e) override;
169 
172  virtual void on_image_changed(const xtd::event_args& e);
173 
174  void on_mouse_down(const mouse_event_args& e) override;
175  void on_mouse_enter(const event_args& e) override;
176  void on_mouse_leave(const event_args& e) override;
177  void on_mouse_up(const mouse_event_args& e) override;
178  void on_parent_back_color_changed(const event_args& e) override;
179  void on_parent_fore_color_changed(const event_args& e) override;
180  void on_resize(const xtd::event_args& e) override;
181  void on_text_changed(const xtd::event_args& e) override;
183 
185  xtd::drawing::rectangle compute_image_bounds();
186  xtd::drawing::rectangle compute_image_bounds(const xtd::drawing::rectangle& rectangle);
187  text_format_flags to_text_format_flags(content_alignment text_align);
189 
190  private:
191  std::shared_ptr<data> data_;
192  };
193  }
194 }
flat_style
Specifies the appearance of a control.
Definition: flat_style.h:22
Provides methods to manage a collection of xtd::drawing::image objects. This class cannot be inherite...
Definition: image_list.h:28
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition: event_args.h:18
The picture_box is sized equal to the size of the image that it contains.
Implements the basic functionality common to button controls.
Definition: button_base.h:35
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
Contains xtd::forms::text_format_flags enum class.
control_appearance
Specifies the appearance of a control.
Definition: control_appearance.h:19
Encapsulates the information needed when creating a control.
Definition: create_params.h:27
Contains xtd::forms::flat_button_appearance class.
Represents an event.
Definition: event.h:21
Contains xtd::forms::image_list component.
content_alignment
Specifies alignment of content on the drawing surface.
Definition: content_alignment.h:19
virtual forms::control_appearance control_appearance() const noexcept
Gets control appearance.
An abstract base class that provides functionality for the bitmap and metafile descended classes...
Definition: image.h:48
Contains xtd::forms::content_alignment enum class.
event< button_base, event_handler > image_changed
Occurs when the value of the image property changes.
Definition: button_base.h:127
Defines the base class for controls, which are components with visual representation.
Definition: control.h:78
Contains xtd::forms::flat_style enum class.
int_least32_t int32
Represents a 32-bit signed integer.
Definition: types.h:129
Provides data for the xtd::forms::control::mouse_up, xtd::forms::control::mouse_down, and xtd::forms::control::mouse_move events.
Definition: mouse_event_args.h:32
Contains xtd::forms::control control.
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
Provides properties that specify the appearance of xtd::forms::button controls whose xtd::forms::flat...
Definition: flat_button_appearance.h:22
text_format_flags
Specifies the display and layout information for text strings.
Definition: text_format_flags.h:20
size_t size
Represents a size of any object in bytes.
Definition: types.h:195