xtd 0.2.0
renderer.h
Go to the documentation of this file.
1 #pragma once
8 #include "../forms_export.h"
9 #include "text_format_flags.h"
10 #include <xtd/drawing/color>
11 #include <xtd/drawing/font>
12 #include <xtd/drawing/graphics>
13 #include <xtd/drawing/image>
14 #include <xtd/drawing/rectangle>
15 #include <xtd/optional>
16 #include <xtd/delegate>
17 #include <xtd/iequatable>
18 #include <xtd/object>
19 #include <xtd/ustring>
20 
22 namespace xtd {
24  namespace forms {
33  class forms_export_ renderer : public object, public xtd::iequatable<renderer> {
34  struct data;
35 
36  public:
38 
40  using button_renderer = xtd::delegate<void(xtd::drawing::graphics, const xtd::drawing::rectangle&, const xtd::ustring&, const xtd::drawing::font&, xtd::forms::text_format_flags, const xtd::drawing::image&, const xtd::drawing::rectangle&, bool focused, xtd::forms::visual_styles::push_button_state, const std::optional<xtd::drawing::color>&, const std::optional<xtd::drawing::color>&)>;
41  using check_box_renderer = xtd::delegate<void(xtd::drawing::graphics, const xtd::drawing::rectangle&, const xtd::ustring&, const xtd::drawing::font&, xtd::forms::text_format_flags, const xtd::drawing::image&, const xtd::drawing::rectangle&, bool focused, xtd::forms::visual_styles::check_box_state, const std::optional<xtd::drawing::color>&, const std::optional<xtd::drawing::color>&)>;
42  using radio_button_renderer = xtd::delegate<void(xtd::drawing::graphics, const xtd::drawing::rectangle&, const xtd::ustring&, const xtd::drawing::font&, xtd::forms::text_format_flags, const xtd::drawing::image&, const xtd::drawing::rectangle&, bool focused, xtd::forms::visual_styles::radio_button_state, const std::optional<xtd::drawing::color>&, const std::optional<xtd::drawing::color>&)>;
44 
46 
48  static const renderer empty;
50 
52 
54  renderer();
55  explicit renderer(const xtd::ustring& name);
57 
59  renderer(const renderer&);
60  renderer& operator =(const renderer&);
62 
64 
66  virtual const xtd::ustring& name() const;
67  renderer& name(const xtd::ustring& name);
68 
69  button_renderer button_render() const noexcept;
70  void button_render(button_renderer button_renderer);
71 
72  check_box_renderer check_box_render() const noexcept;
73  void check_box_render(check_box_renderer check_box_renderer);
74 
75  radio_button_renderer radio_button_render() const noexcept;
76  void radio_button_render(radio_button_renderer radio_button_renderer);
78 
80 
82  void draw_button(xtd::drawing::graphics g, const xtd::drawing::rectangle& bounds, const xtd::ustring& text, const xtd::drawing::font& font, xtd::forms::text_format_flags flags, const xtd::drawing::image& image, const xtd::drawing::rectangle& image_bounds, bool focused, xtd::forms::visual_styles::push_button_state state, const std::optional<xtd::drawing::color>& back_color, const std::optional<xtd::drawing::color>& fore_color);
83  void draw_check_box(xtd::drawing::graphics g, const xtd::drawing::rectangle& bounds, const xtd::ustring& text, const xtd::drawing::font& font, xtd::forms::text_format_flags flags, const xtd::drawing::image& image, const xtd::drawing::rectangle& image_bounds, bool focused, xtd::forms::visual_styles::check_box_state state, const std::optional<xtd::drawing::color>& back_color, const std::optional<xtd::drawing::color>& fore_color);
84  void draw_radio_button(xtd::drawing::graphics g, const xtd::drawing::rectangle& bounds, const xtd::ustring& text, const xtd::drawing::font& font, xtd::forms::text_format_flags flags, const xtd::drawing::image& image, const xtd::drawing::rectangle& image_bounds, bool focused, xtd::forms::visual_styles::radio_button_state state, const std::optional<xtd::drawing::color>& back_color, const std::optional<xtd::drawing::color>& fore_color);
85 
86  bool equals(const renderer& value) const noexcept override;
87 
88  xtd::ustring to_string() const noexcept override;
90 
91  private:
92  static void default_button_renderer(xtd::drawing::graphics g, const xtd::drawing::rectangle& bounds, const xtd::ustring& text, const xtd::drawing::font& font, xtd::forms::text_format_flags flags, const xtd::drawing::image& image, const xtd::drawing::rectangle& image_bounds, bool focused, xtd::forms::visual_styles::push_button_state state, const std::optional<xtd::drawing::color>& back_color, const std::optional<xtd::drawing::color>& fore_color);
93  static void default_check_box_renderer(xtd::drawing::graphics g, const xtd::drawing::rectangle& bounds, const xtd::ustring& text, const xtd::drawing::font& font, xtd::forms::text_format_flags flags, const xtd::drawing::image& image, const xtd::drawing::rectangle& image_bounds, bool focused, xtd::forms::visual_styles::check_box_state state, const std::optional<xtd::drawing::color>& back_color, const std::optional<xtd::drawing::color>& fore_color);
94  static void default_radio_button_renderer(xtd::drawing::graphics g, const xtd::drawing::rectangle& bounds, const xtd::ustring& text, const xtd::drawing::font& font, xtd::forms::text_format_flags flags, const xtd::drawing::image& image, const xtd::drawing::rectangle& image_bounds, bool focused, xtd::forms::visual_styles::radio_button_state state, const std::optional<xtd::drawing::color>& back_color, const std::optional<xtd::drawing::color>& fore_color);
95 
96  std::shared_ptr<data> data_;
97  };
98  }
99 }
Defines a particular format for text, including font face, size, and style attributes. This class cannot be inherited.
Definition: font.h:45
radio_button_state
Specifies the visual state of a radio button that is drawn with visual styles.
Definition: radio_button_state.h:22
Enum flags attribute.
Contains xtd::forms::visual_styles::radio_button_state enum class.
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.
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:46
Contains xtd::forms::visual_styles::push_button_state enum class.
check_box_state
Specifies the visual state of a check box that is drawn with visual styles.
Definition: check_box_state.h:22
std::string to_string(const date_time &value, const std::string &fmt, const std::locale &loc)
Convert a specified value into a string with specified format and locale.
Definition: date_time.h:1063
Provides control renderers methods.
Definition: renderer.h:33
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition: iequatable.h:18
Stores a set of four integers that represent the location and size of a rectangle.
Definition: rectangle.h:44
An abstract base class that provides functionality for the bitmap and metafile descended classes...
Definition: image.h:48
Contains xtd::forms::visual_styles::check_box_state enum class.
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes...
Definition: object.h:32
push_button_state
Specifies the visual state of a button that is drawn with visual styles.
Definition: push_button_state.h:22
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
text_format_flags
Specifies the display and layout information for text strings.
Definition: text_format_flags.h:20
Defines an object used to draw lines and curves. This class cannot be inherited.
Definition: graphics.h:70
The xtd::forms::status_bar_panel displays text in the standard font.