xtd - Reference Guide  0.1.1
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
theme_colors.h
Go to the documentation of this file.
1 #pragma once
5 #include "theme_base.h"
6 #include "known_themed_color.h"
7 #include <string>
8 #include <vector>
9 #include <xtd/delegate.h>
10 #include <xtd/drawing/color.h>
12 namespace xtd {
14  namespace forms {
15  class forms_export_ theme_colors final : public theme_base {
16  public:
17  using color_getter = xtd::delegate<xtd::drawing::color(xtd::forms::known_themed_color)>;
18 
19  theme_colors() = default;
20  theme_colors(const xtd::ustring& name, const color_getter& kown_themed_color_to_color) : theme_base(name), color_getter_(kown_themed_color_to_color) {}
21  theme_colors(const xtd::ustring& name, xtd::forms::theme_style theme_style, const color_getter& color_getter) : theme_base(name, theme_style), color_getter_(color_getter) {}
23  theme_colors(const theme_colors&) = default;
24  theme_colors& operator=(const theme_colors&) = default;
25  bool operator==(const theme_colors& value) const {return theme_base::operator==(value);}
26  bool operator!=(const theme_colors& value) const {return !operator==(value);}
28 
29  static const theme_colors empty;
30 
31  xtd::drawing::color accent() const {return from_known_themed_color(xtd::forms::known_themed_color::accent);}
32  xtd::drawing::color accent_text() const {return from_known_themed_color(xtd::forms::known_themed_color::accent_text);}
33  xtd::drawing::color active_border() const {return from_known_themed_color(xtd::forms::known_themed_color::active_border);}
34  xtd::drawing::color active_caption() const {return from_known_themed_color(xtd::forms::known_themed_color::active_caption);}
35  xtd::drawing::color active_caption_text() const {return from_known_themed_color(xtd::forms::known_themed_color::active_caption_text);}
36  xtd::drawing::color app_workspace() const {return from_known_themed_color(xtd::forms::known_themed_color::app_workspace);}
37  xtd::drawing::color button_face() const {return from_known_themed_color(xtd::forms::known_themed_color::button_face);}
38  xtd::drawing::color button_highlight() const {return from_known_themed_color(xtd::forms::known_themed_color::button_highlight);}
39  xtd::drawing::color button_shadow() const {return from_known_themed_color(xtd::forms::known_themed_color::button_shadow);}
40  xtd::drawing::color control() const {return from_known_themed_color(xtd::forms::known_themed_color::control);}
41  xtd::drawing::color control_dark() const {return from_known_themed_color(xtd::forms::known_themed_color::control_dark);}
42  xtd::drawing::color control_dark_dark() const {return from_known_themed_color(xtd::forms::known_themed_color::control_dark_dark);}
43  xtd::drawing::color control_light() const {return from_known_themed_color(xtd::forms::known_themed_color::control_light);}
44  xtd::drawing::color control_light_light() const {return from_known_themed_color(xtd::forms::known_themed_color::control_light_light);}
45  xtd::drawing::color control_text() const {return from_known_themed_color(xtd::forms::known_themed_color::control_text);}
46  xtd::drawing::color desktop() const {return from_known_themed_color(xtd::forms::known_themed_color::desktop);}
47  xtd::drawing::color gradient_active_caption() const {return from_known_themed_color(xtd::forms::known_themed_color::gradient_active_caption);}
48  xtd::drawing::color gradient_inactive_caption() const {return from_known_themed_color(xtd::forms::known_themed_color::gradient_inactive_caption);}
49  xtd::drawing::color gray_text() const {return from_known_themed_color(xtd::forms::known_themed_color::gray_text);}
50  xtd::drawing::color highlight() const {return from_known_themed_color(xtd::forms::known_themed_color::highlight);}
51  xtd::drawing::color highlight_text() const {return from_known_themed_color(xtd::forms::known_themed_color::highlight_text);}
52  xtd::drawing::color hot_track() const {return from_known_themed_color(xtd::forms::known_themed_color::hot_track);}
53  xtd::drawing::color inactive_border() const {return from_known_themed_color(xtd::forms::known_themed_color::inactive_border);}
54  xtd::drawing::color inactive_caption() const {return from_known_themed_color(xtd::forms::known_themed_color::inactive_caption);}
55  xtd::drawing::color inactive_caption_text() const {return from_known_themed_color(xtd::forms::known_themed_color::inactive_caption_text);}
56  xtd::drawing::color info() const {return from_known_themed_color(xtd::forms::known_themed_color::info);}
57  xtd::drawing::color info_text() const {return from_known_themed_color(xtd::forms::known_themed_color::info_text);}
58  xtd::drawing::color menu() const {return from_known_themed_color(xtd::forms::known_themed_color::menu);}
59  xtd::drawing::color menu_bar() const {return from_known_themed_color(xtd::forms::known_themed_color::menu_bar);}
60  xtd::drawing::color menu_highlight() const {return from_known_themed_color(xtd::forms::known_themed_color::menu_highlight);}
61  xtd::drawing::color menu_text() const {return from_known_themed_color(xtd::forms::known_themed_color::menu_text);}
62  xtd::drawing::color scroll_bar() const {return from_known_themed_color(xtd::forms::known_themed_color::scroll_bar);}
63  xtd::drawing::color text_box() const {return from_known_themed_color(xtd::forms::known_themed_color::text_box);}
64  xtd::drawing::color text_box_text() const {return from_known_themed_color(xtd::forms::known_themed_color::text_box_text);}
65  xtd::drawing::color window() const {return from_known_themed_color(xtd::forms::known_themed_color::window);}
66  xtd::drawing::color window_frame() const {return from_known_themed_color(xtd::forms::known_themed_color::window_frame);}
67  xtd::drawing::color window_text() const {return from_known_themed_color(xtd::forms::known_themed_color::window_text);}
68 
69  xtd::drawing::color from_known_themed_color(xtd::forms::known_themed_color known_themed_color) const {return color_getter_(known_themed_color);}
70 
71  static theme_colors current_theme() {
72  if (current_theme_ == theme_colors::empty) current_theme_ = default_theme();
73  return current_theme_;
74  }
75  static void current_theme(const theme_colors& theme_color) {current_theme_ = theme_color;}
76  static void current_theme(const xtd::ustring& name) {current_theme(theme_from_name(name));}
77 
78  static theme_colors default_theme() {return theme_from_name(default_theme_name());}
79 
80  static theme_colors theme_from_name(const xtd::ustring& theme_color_name);
81 
82  private:
83  theme_colors(const xtd::ustring& name, xtd::forms::theme_style theme_style, const color_getter& color_getter, bool is_default) : theme_base(name, theme_style, is_default), color_getter_(color_getter) {}
84  color_getter color_getter_;
85  static theme_colors current_theme_;
86  };
87  }
88 }
Represents an ARGB (alpha, red, green, blue) color.
Definition: color.h:39
Defines the base class for controls, which are components with visual representation.
Definition: control.h:67
Represents the base functionality for all menus. Although tool_strip_drop_down and tool_strip_drop_do...
Definition: menu.h:32
Represents a standard Windows scroll bar.
Definition: scroll_bar.h:17
Represents a standard Windows text box.
Definition: text_box.h:22
Definition: theme_base.h:15
Definition: theme_colors.h:15
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:48
Contains xtd::drawing::color class.
Contains xtd::delegate delegate.
#define forms_export_
Define shared library export.
Definition: forms_export.h:13
theme_style
Specifies the style of theme.
Definition: theme_style.h:16
known_themed_color
Specifies the known system colors.
Definition: known_themed_color.h:18
@ info_text
The system-defined color of the text of a ToolTip.
@ control_dark
The system-defined shadow color of a 3-D element. The shadow color is applied to parts of a 3-D eleme...
@ highlight_text
The system-defined color of the text of selected items.
@ window
The system-defined color of the background in the client area of a window.
@ active_caption
The system-defined color of the background of the active window's title bar.
@ menu_highlight
The system-defined color used to highlight menu items when the menu appears as a flat menu.
@ button_face
The system-defined face color of a 3-D element.
@ accent_text
The system-defined color of the accent text color (macos specific. On other platform is same as highl...
@ control_light_light
The system-defined highlight color of a 3-D element. The highlight color is applied to the parts of a...
@ active_border
The system-defined color of the active window's border.
@ highlight
The system-defined color of the background of selected items. This includes selected menu items as we...
@ menu_bar
The system-defined color of the background of a menu bar.
@ hot_track
The system-defined color used to designate a hot-tracked item. Single-clicking a hot-tracked item exe...
@ window_text
The system-defined color of the text in the client area of a window.
@ accent
The system-defined color of the accent color (macos specific. On other platform is same as menu_highl...
@ gray_text
The system-defined color of dimmed text. Items in a list that are disabled are displayed in dimmed te...
@ text_box_text
The system-defined color of the accent text color (macos specific. On other platform is same as windo...
@ text_box
The system-defined color of the accent color (macos specific. On other platform is same as window).
@ menu
The system-defined color of a menu's background.
@ control_light
The system-defined color that is the light color of a 3-D element. The light color is applied to part...
@ button_shadow
The system-defined color that is the shadow color of a 3-D element. This color is applied to parts of...
@ inactive_border
The system-defined color of an inactive window's border.
@ active_caption_text
The system-defined color of the text in the active window's title bar.
@ desktop
The system-defined color of the desktop.
@ gradient_active_caption
The system-defined color of the lightest color in the color gradient of an active window's title bar.
@ inactive_caption_text
The system-defined color of the text in an inactive window's title bar.
@ scroll_bar
The system-defined color of the background of a scroll bar.
@ info
The system-defined color of the background of a ToolTip.
@ control_text
The system-defined color of text in a 3-D element.
@ control_dark_dark
The system-defined color that is the dark shadow color of a 3-D element. The dark shadow color is app...
@ button_highlight
The system-defined color that is the highlight color of a 3-D element. This color is applied to parts...
@ window_frame
The system-defined color of a window frame.
@ gradient_inactive_caption
The system-defined color of the lightest color in the color gradient of an inactive window's title ba...
@ inactive_caption
The system-defined color of the background of an inactive window's title bar.
@ menu_text
The system-defined color of a menu's text.
@ app_workspace
The system-defined color of the application workspace. The application workspace is the area in a mul...
@ control
The system-defined face color of a 3-D element.
Contains xtd::forms::known_themed_color enum class.
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17
Contains xtd::forms::theme_base class.