xtd - Reference Guide  0.2.0
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 {
22  class forms_export_ color_picker : public control {
23  public:
25  color_picker();
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_;}
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 the base class for classes that contain event data, and provides a value to use for events...
Definition: event_args.h:18
Stores an ordered pair of integers, which specify a height and width.
Definition: size.h:25
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
The color box shows alpha values and an opacity selector (slider).
event< color_picker, event_handler > color_changed
Occurs when the value of the color property changes.
Definition: color_picker.h:54
Represents an ARGB (alpha, red, green, blue) color.
Definition: color.h:39
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
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
Implements a Windows message.
Definition: message.h:25
const drawing::color & color() const
Gets the color selected by the user.
Definition: color_picker.h:30
Defines the base class for controls, which are components with visual representation.
Definition: control.h:68
Contains xtd::forms::control control.
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
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
drawing::size default_size() const override
Gets the default size of the control.
Definition: color_picker.h:36