ASPiK SDK
uicolor.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 __uicolor__
6 #define __uicolor__
7 
8 #include "../../lib/vstguibase.h"
9 
10 #if VSTGUI_LIVE_EDITING
11 
12 #include "../../lib/ccolor.h"
13 #include "../../lib/idependency.h"
14 
15 namespace VSTGUI {
16 
17 //----------------------------------------------------------------------------------------------------
18 class UIColor : protected CColor, public CBaseObject, public IDependency
19 {
20 public:
21  UIColor () : CColor (kTransparentCColor), hue (0), saturation (0), lightness (0) {}
22 
23  UIColor& operator= (const CColor& c);
24  const CColor& base () const { return *this; }
25 
26  double getRed () const { return r; }
27  double getGreen () const { return g; }
28  double getBlue () const { return b; }
29  double getAlpha () const { return alpha; }
30 
31  double getHue () const { return hue; }
32  double getSaturation () const { return saturation; }
33  double getLightness () const { return lightness; }
34 
35  void setHue (double h);
36  void setSaturation (double s);
37  void setLightness (double l);
38 
39  void setRed (double nr);
40  void setGreen (double ng);
41  void setBlue (double nb);
42  void setAlpha (double na);
43 
44  void beginEdit ();
45  void endEdit ();
46 
47  static IdStringPtr kMsgChanged;
48  static IdStringPtr kMsgEditChange;
49  static IdStringPtr kMsgBeginEditing;
50  static IdStringPtr kMsgEndEditing;
51 private:
52  enum HSLUpdateDirection
53  {
54  kFrom,
55  kTo
56  };
57 
58  void updateHSL (HSLUpdateDirection direction);
59 
60  double hue, saturation, lightness;
61  double r, g, b;
62 };
63 
64 } // namespace
65 
66 #endif // VSTGUI_LIVE_EDITING
67 
68 #endif // __uicolor__
Definition: customcontrols.cpp:8