ASPiK SDK
uicolorchoosercontroller.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 __uicolorchoosercontroller__
6 #define __uicolorchoosercontroller__
7 
8 #include "../../lib/vstguibase.h"
9 
10 #if VSTGUI_LIVE_EDITING
11 
12 #include "../delegationcontroller.h"
13 #include "../../lib/controls/ctextedit.h"
14 
15 namespace VSTGUI {
16 class UIColor;
17 
18 //----------------------------------------------------------------------------------------------------
19 class UIColorChooserController : public CBaseObject, public DelegationController
20 {
21 public:
22  UIColorChooserController (IController* baseController, UIColor* color);
23  ~UIColorChooserController () override;
24 
25 protected:
26  CMessageResult notify (CBaseObject* sender, IdStringPtr message) override;
27  CView* createView (const UIAttributes& attributes, const IUIDescription* description) override;
28  CView* verifyView (CView* view, const UIAttributes& attributes, const IUIDescription* description) override;
29  IControlListener* getControlListener (UTF8StringPtr name) override;
30  void valueChanged (CControl* pControl) override;
31  void controlBeginEdit (CControl* pControl) override;
32  void controlEndEdit (CControl* pControl) override;
33 
34  void updateColorSlider (CControl* control);
35  void updateColorSliders ();
36 
37  static bool valueToString (float value, char utf8String[256], CParamDisplay::ValueToStringUserData* userData);
38  static bool stringToValue (UTF8StringPtr txt, float& result, CTextEdit::StringToValueUserData* userData);
39 
40  SharedPointer<UIColor> color;
41  using ControlList = std::list<SharedPointer<CControl>>;
42  ControlList controls;
43 
44  enum {
45  kHueTag = 0,
46  kSaturationTag,
47  kLightnessTag,
48  kRedTag,
49  kGreenTag,
50  kBlueTag,
51  kAlphaTag,
52  kNumTags
53  };
54 };
55 
56 } // namespace
57 
58 #endif // VSTGUI_LIVE_EDITING
59 
60 #endif // __uicolorchoosercontroller__
Definition: customcontrols.cpp:8