xtd - Reference Guide  0.1.0
Modern c++17 framework to create console, gui and unit test applications on Windows, macOS and Linux.
xtd::forms::color_dialog Class Reference

Represents a common dialog box that displays available colors along with controls that enable the user to define custom colors. More...

#include <color_dialog.h>

Inheritance diagram for xtd::forms::color_dialog:
xtd::forms::common_dialog xtd::forms::component

Public Member Functions

 color_dialog ()=default
 Initializes a new instance of the color_dialog class. More...
 
bool allow_full_open () const
 Gets a value indicating whether the user can use the dialog box to define custom colors. More...
 
color_dialogallow_full_open (bool allow_full_open)
 Sets a value indicating whether the user can use the dialog box to define custom colors. More...
 
bool alpha_color () const
 Gets a value indicating whether the dialog box shows alpha values and an opacity selector (slider). More...
 
color_dialogalpha_color (bool alpha_color)
 Sets a value indicating whether the user can use the dialog box to define custom colors. More...
 
bool any_color () const
 Gets a value indicating whether the dialog box displays all available colors in the set of basic colors. More...
 
color_dialogany_color (bool any_color)
 
drawing::color color () const
 Gets the color selected by the user. More...
 
color_dialogcolor (const drawing::color &color)
 Sets the color selected by the user. More...
 
const std::optional< std::vector< int32_t > > & custom_colors () const
 Gets the set of custom colors shown in the dialog box. More...
 
color_dialogcustom_colors (const std::vector< int32_t > &custom_colors)
 Sets the set of custom colors shown in the dialog box. More...
 
xtd::forms::dialog_result dialog_result () const
 
bool full_open () const
 Gets a value indicating whether the controls used to create custom colors are visible when the dialog box is opened. More...
 
color_dialogfull_open (bool full_open)
 Sets a value indicating whether the controls used to create custom colors are visible when the dialog box is opened. More...
 
size_t options () const
 
void reset () override
 Resets all options to their default values, the last selected color to black, and the custom colors to their default values. More...
 
xtd::forms::dialog_result show_dialog ()
 Runs a common dialog box with a default owner. More...
 
xtd::forms::dialog_result show_dialog (const iwin32_window &owner)
 Runs a common dialog box with the specified owner. More...
 
bool show_help () const
 Gets a value indicating whether a Help button appears in the color dialog box. More...
 
color_dialogshow_help (bool show_help)
 Sets a value indicating whether a Help button appears in the color dialog box. More...
 
void show_sheet (const iwin32_window &owner)
 Runs a common dialog box with the specified owner. More...
 
xtd::forms::dialog_result show_sheet_dialog (const iwin32_window &owner)
 Runs a common dialog box with the specified owner. More...
 
bool solid_color_only () const
 Gets a value indicating whether the dialog box will restrict users to selecting solid colors only. More...
 
color_dialogsolid_color_only (bool solid_color_only)
 Sets a value indicating whether the dialog box will restrict users to selecting solid colors only. More...
 
std::any tag () const
 Gets an object that contains data about the control. More...
 
common_dialogtag (const std::any &tag)
 Sets an object that contains data about the control. More...
 

Public Attributes

event< common_dialog, common_dialog_closed_event_handler< component & > > common_dialog_closed
 
event< common_dialog, help_event_handler< component & > > help_request
 Occurs when the user clicks the Help button on a common dialog box. More...
 

Protected Member Functions

virtual bool can_raise_events () const
 Gets a value indicating whether the component can raise an event. More...
 
bool design_mode () const
 Gets a value that indicates whether the component is currently in design mode. More...
 
virtual void on_common_dialog_closed (const common_dialog_closed_event_args &e)
 Raises the close event. More...
 
virtual void on_help_request (help_event_args &e)
 Raises the help_request event. More...
 
bool run_dialog (intptr_t owner) override
 When overridden in a derived class, specifies a common dialog box. More...
 
void run_sheet (intptr_t owner) override
 When overridden in a derived class, specifies a common dialog box. More...
 

Detailed Description

Represents a common dialog box that displays available colors along with controls that enable the user to define custom colors.

Remarks
The inherited member show_dialog must be invoked to create this specific common dialog box. hook_proc can be overridden to implement specific dialog box hook functionality. Use color to retrieve the color selected by the user.
When you create an instance of color_dialog, some of the read/write properties are set to initial values. For a list of these values, see the color_dialog constructor.
Example
The following code example demonstrate the use of color_dialog dialog.
#include <xtd/xtd>
using namespace xtd;
using namespace xtd::forms;
class form1 : public form {
public:
form1() {
text("Color dialog example");
controls().push_back(button1);
button1.location({10, 10});
button1.text("Color...");
button1.click += [&] {
color_dialog.color(back_color());
if (color_dialog.show_dialog(*this) == forms::dialog_result::ok)
back_color(color_dialog.color());
};
}
private:
};
int main() {
application::run(form1());
}

The documentation for this class was generated from the following file: