xtd - Reference Guide  0.1.2
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
Loading...
Searching...
No Matches
color_box.h
Go to the documentation of this file.
1
4#pragma once
5#include "color_dialog.h"
6#include "color_box_styles.h"
7#include <xtd/static.h>
8
10namespace xtd {
12 namespace forms {
22 class color_box final static_ {
23 public:
29 static xtd::forms::dialog_result show(xtd::drawing::color& color, const xtd::forms::iwin32_window& owner) {return show_color_box(color, &owner);}
36 static xtd::forms::dialog_result show(xtd::drawing::color& color, const xtd::forms::iwin32_window& owner, color_box_styles styles) {return show_color_box(color, &owner, styles);}
44 static xtd::forms::dialog_result show(xtd::drawing::color& color, const xtd::forms::iwin32_window& owner, color_box_styles styles, const std::vector<xtd::drawing::color>& custom_colors) {return show_color_box(color, &owner, styles, custom_colors);}
45
50 static xtd::forms::dialog_result show(xtd::drawing::color& color) {return show_color_box(color, nullptr);}
56 static xtd::forms::dialog_result show(xtd::drawing::color& color, color_box_styles styles) {return show_color_box(color, nullptr, styles);}
63 static xtd::forms::dialog_result show(xtd::drawing::color& color, color_box_styles styles, const std::vector<xtd::drawing::color>& custom_colors) {return show_color_box(color, nullptr, styles, custom_colors);}
64
65 private:
66 static xtd::forms::dialog_result show_color_box(xtd::drawing::color& color, const xtd::forms::iwin32_window* owner = nullptr, color_box_styles styles = color_box_styles::alpha_color|color_box_styles::allow_full_open, const std::optional<std::vector<xtd::drawing::color>>& custom_colors = std::optional<std::vector<xtd::drawing::color>> {}) {
68 dialog.color(color);
74 if (custom_colors.has_value()) dialog.custom_colors(custom_colors.value());
76 xtd::forms::dialog_result result = owner ? dialog.show_sheet_dialog(*owner) : dialog.show_dialog();
77 if (result == xtd::forms::dialog_result::ok) color = dialog.color();
78 return result;
79 }
80 };
81 }
82}
Represents an ARGB (alpha, red, green, blue) color.
Definition color.h:39
Represents a common dialog box that displays available colors along with controls that enable the use...
Definition color_box.h:22
static xtd::forms::dialog_result show(xtd::drawing::color &color, color_box_styles styles)
Displays a color box. The color box displays a color with styles.
Definition color_box.h:56
static xtd::forms::dialog_result show(xtd::drawing::color &color, const xtd::forms::iwin32_window &owner)
Displays a color box in front of the specified window. The color box displays a color.
Definition color_box.h:29
static xtd::forms::dialog_result show(xtd::drawing::color &color, color_box_styles styles, const std::vector< xtd::drawing::color > &custom_colors)
Displays a color box. The color box displays a color with styles, and custom colors.
Definition color_box.h:63
static xtd::forms::dialog_result show(xtd::drawing::color &color)
Displays a color box. The color box displays a color.
Definition color_box.h:50
static xtd::forms::dialog_result show(xtd::drawing::color &color, const xtd::forms::iwin32_window &owner, color_box_styles styles)
Displays a color box in front of the specified window. The color box displays a color with styles.
Definition color_box.h:36
static xtd::forms::dialog_result show(xtd::drawing::color &color, const xtd::forms::iwin32_window &owner, color_box_styles styles, const std::vector< xtd::drawing::color > &custom_colors)
Displays a color box in front of the specified window. The color box displays a color with styles,...
Definition color_box.h:44
Represents a common dialog box that displays available colors along with controls that enable the use...
Definition color_dialog.h:25
bool allow_full_open() const
Gets a value indicating whether the user can use the dialog box to define custom colors.
Definition color_dialog.h:54
bool show_help() const
Gets a value indicating whether a Help button appears in the color dialog box.
Definition color_dialog.h:122
bool full_open() const
Gets a value indicating whether the controls used to create custom colors are visible when the dialog...
Definition color_dialog.h:105
bool any_color() const
Gets a value indicating whether the dialog box displays all available colors in the set of basic colo...
Definition color_dialog.h:64
bool alpha_color() const
Gets a value indicating whether the dialog box shows alpha values and an opacity selector (slider).
Definition color_dialog.h:44
bool solid_color_only() const
Gets a value indicating whether the dialog box will restrict users to selecting solid colors only.
Definition color_dialog.h:133
drawing::color color() const
Gets the color selected by the user.
Definition color_dialog.h:75
const std::vector< xtd::drawing::color > & custom_colors() const
Gets the set of custom colors shown in the dialog box.
Definition color_dialog.h:88
xtd::forms::dialog_result show_dialog()
Runs a common dialog box with a default owner.
Definition common_dialog.h:60
xtd::forms::dialog_result show_sheet_dialog(const iwin32_window &owner)
Runs a common dialog box with the specified owner.
Definition common_dialog.h:91
Provides an interface to expose Win32 HWND handles.
Definition iwin32_window.h:19
Contains xtd::forms::color_box_styles enum class.
Contains xtd::forms::color_dialog dialog.
#define static_
This keyword is use to represent a static object. A static object can't be instantiated (constructors...
Definition static.h:38
color_box_styles
Specifies constants defining which color_box styles is used.
Definition color_box_styles.h:18
dialog_result
Specifies identifiers to indicate the return value of a dialog box.
Definition dialog_result.h:39
@ alpha_color
The color box shows alpha values and an opacity selector (slider).
@ allow_full_open
The user can use the dialog box to define custom colors.
@ solid_color_only
The dialog box will restrict users to selecting solid colors only.
@ full_open
The controls used to create custom colors are visible when the dialog box is opened.
@ any_color
The dialog box displays all available colors in the set of basic colors.
@ show_help
A Help button appears in the color dialog box.
@ ok
The dialog box return value is OK (usually sent from a button labeled OK).
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::static_object class.