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.
color_picker.h
Go to the documentation of this file.
1 #pragma once
5 #include "control.h"
6 
8 namespace xtd {
10  namespace forms {
23  public:
26 
30  const drawing::color& color() const {return color_;}
34  void color(const drawing::color& color);
35 
36  drawing::size default_size() const override {return {100, 25};}
37 
38 
41  bool alpha_color() const {return alpha_color_;}
44  color_picker& alpha_color(bool alpha_color) {
45  if (alpha_color_ != alpha_color) {
46  alpha_color_ = alpha_color;
47  recreate_handle();
48  }
49  return *this;
50  }
51 
55 
56  protected:
57  forms::create_params create_params() const override;
58 
61  void on_color_changed(const event_args& e);
62 
63  void on_handle_created(const event_args& e) override;
64 
65  void wnd_proc(message& message) override;
66 
67  private:
68  void wm_click(message& message);
69  drawing::color color_;
70  bool alpha_color_ = false;
71  };
72  }
73 }
Represents an ARGB (alpha, red, green, blue) color.
Definition: color.h:39
Stores an ordered pair of integers, which specify a height and width.
Definition: size.h:25
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition: event_args.h:18
Represents an event.
Definition: event.h:21
Represents a picker control that displays available colors along with controls that enable the user t...
Definition: color_picker.h:22
void color(const drawing::color &color)
Sets the color selected by the user.
forms::create_params create_params() const override
Gets the required creation parameters when the control handle is created.
const drawing::color & color() const
Gets the color selected by the user.
Definition: color_picker.h:30
void on_color_changed(const event_args &e)
Raises the color_changed event.
color_picker & alpha_color(bool alpha_color)
Sets a value indicating whether the user can use the dialog box to define custom colors.
Definition: color_picker.h:44
color_picker()
Initializes a new instance of the color_picker class.
drawing::size default_size() const override
Gets the default size of the control.
Definition: color_picker.h:36
bool alpha_color() const
Gets a value indicating whether the dialog box shows alpha values and an opacity selector (slider).
Definition: color_picker.h:41
void wnd_proc(message &message) override
Processes Windows messages.
void on_handle_created(const event_args &e) override
Raises the control::handle_created event.
Defines the base class for controls, which are components with visual representation.
Definition: control.h:67
Implements a Windows message.
Definition: message.h:25
Contains xtd::forms::control control.
event< color_picker, event_handler > color_changed
Occurs when the value of the color property changes.
Definition: color_picker.h:54
#define forms_export_
Define shared library export.
Definition: forms_export.h:13
@ alpha_color
The color box shows alpha values and an opacity selector (slider).
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