ASPiK SDK
ccolorchooser.h
1 // This file is part of VSTGUI. It is subject to the license terms
2 // in the LICENSE file found in the top-level directory of this
3 // distribution and at http://github.com/steinbergmedia/vstgui/LICENSE
4 
5 #ifndef __ccolorchooser__
6 #define __ccolorchooser__
7 
8 #include "../vstguifwd.h"
9 #include "../cviewcontainer.h"
10 #include "icontrollistener.h"
11 #include "ctextedit.h"
12 
13 namespace VSTGUI {
15 namespace CColorChooserInternal {
16 class ColorView;
17 }
19 
21 //-----------------------------------------------------------------------------
23 {
24 public:
25  virtual void colorChanged (CColorChooser* chooser, const CColor& color) = 0;
26 };
27 
28 //-----------------------------------------------------------------------------
30 {
31  CFontRef font {kNormalFont};
32  CColor fontColor {kWhiteCColor};
33  CColor checkerBoardColor1 {kWhiteCColor};
34  CColor checkerBoardColor2 {kBlackCColor};
35  CPoint margin {5, 5};
36 
37  bool checkerBoardBack {true};
38 };
39 
41 //-----------------------------------------------------------------------------
43 {
44 public:
45  CColorChooser (IColorChooserDelegate* delegate = 0, const CColor& initialColor = kTransparentCColor, const CColorChooserUISettings& settings = CColorChooserUISettings ());
46  ~CColorChooser () noexcept override = default;
47 
48  void setColor (const CColor& newColor);
49 
50  static IdStringPtr kMsgBeginColorChange;
51  static IdStringPtr kMsgEndColorChange;
52 //-----------------------------------------------------------------------------
53 protected:
54  void valueChanged (CControl* pControl) override;
55  void controlBeginEdit (CControl* pControl) override;
56  void controlEndEdit (CControl* pControl) override;
57  void updateState ();
58 
60 
61  IColorChooserDelegate* delegate;
62  CColor color;
63 
64  CSlider* redSlider;
65  CSlider* greenSlider;
66  CSlider* blueSlider;
67  CSlider* hueSlider;
68  CSlider* saturationSlider;
69  CSlider* brightnessSlider;
70  CSlider* alphaSlider;
71  CTextEdit* editFields[8];
72  CColorChooserInternal::ColorView* colorView;
73 
74  //-----------------------------------------------------------------------------
75  enum {
76  kRedTag = 10000,
77  kGreenTag,
78  kBlueTag,
79  kHueTag,
80  kSaturationTag,
81  kBrightnessTag,
82  kAlphaTag,
83  kColorTag
84  };
85 
86  //-----------------------------------------------------------------------------
87  static bool convertNormalized (UTF8StringPtr string, float& output, CTextEdit::StringToValueUserData* userData);
88  static bool convertColorValue (UTF8StringPtr string, float& output, CTextEdit::StringToValueUserData* userData);
89  static bool convertAngle (UTF8StringPtr string, float& output, CTextEdit::StringToValueUserData* userData);
90  static bool convertNormalizedToString (float value, char string[256], CParamDisplay::ValueToStringUserData* userData);
91  static bool convertColorValueToString (float value, char string[256], CParamDisplay::ValueToStringUserData* userData);
92  static bool convertAngleToString (float value, char string[256], CParamDisplay::ValueToStringUserData* userData);
94 
95 };
96 
97 } // namespace
98 
99 #endif
Definition: ccolorchooser.h:29
Container Class of CView objects.
Definition: cviewcontainer.h:52
font class
Definition: cfont.h:31
Definition: ccolorchooser.h:42
RGBA Color structure.
Definition: ccolor.h:15
a slider control
Definition: cslider.h:18
Definition: customcontrols.cpp:8
base class of all VSTGUI controls
Definition: ccontrol.h:76
Definition: ccolorchooser.h:22
Point structure.
Definition: cpoint.h:17
a parameter display
Definition: cparamdisplay.h:24
a text edit control
Definition: ctextedit.h:21
Definition: icontrollistener.h:14
simple dependency between objects.
Definition: idependency.h:26