ASPiK SDK
uiattributescontroller.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 __uiattributescontroller__
6 #define __uiattributescontroller__
7 
8 #include "../uidescription.h"
9 
10 #if VSTGUI_LIVE_EDITING
11 
12 #include "uiselection.h"
13 #include "../delegationcontroller.h"
14 #include "../iviewcreator.h"
15 #include "uiundomanager.h"
16 #include "../../lib/controls/ctextedit.h"
17 
18 namespace VSTGUI {
19 class CRowColumnView;
20 class UIViewFactory;
21 
22 namespace UIAttributeControllers {
23 class Controller;
24 }
25 
26 //----------------------------------------------------------------------------------------------------
27 class UIAttributesController : public CBaseObject, public DelegationController
28 {
29 public:
30  UIAttributesController (IController* baseController, UISelection* selection, UIUndoManager* undoManager, UIDescription* description);
31  ~UIAttributesController () override;
32 
33  void beginLiveAttributeChange (const std::string& name, const std::string& currentValue);
34  void endLiveAttributeChange ();
35  void performAttributeChange (const std::string& name, const std::string& value);
36 protected:
37  using StringList = std::list<std::string>;
38 
39  CView* createViewForAttribute (const std::string& attrName);
40  void rebuildAttributesView ();
41  void validateAttributeViews ();
42  CView* createValueViewForAttributeType (const UIViewFactory* viewFactory, CView* view, const std::string& attrName, IViewCreator::AttrType attrType);
43  void getConsolidatedAttributeNames (StringList& result, const std::string& filter);
44 
45  void valueChanged (CControl* pControl) override;
46  CView* verifyView (CView* view, const UIAttributes& attributes, const IUIDescription* description) override;
47  IController* createSubController (IdStringPtr name, const IUIDescription* description) override;
48  IControlListener* getControlListener (UTF8StringPtr name) override;
49 
50  CMessageResult notify (CBaseObject* sender, IdStringPtr message) override;
51 
52  SharedPointer<UISelection> selection;
53  SharedPointer<UIUndoManager> undoManager;
54  SharedPointer<UIDescription> editDescription;
55  SharedPointer<CVSTGUITimer> timer;
56  IAction* liveAction;
57 
58  using UIAttributeControllerList = std::list<UIAttributeControllers::Controller*>;
59  UIAttributeControllerList attributeControllers;
60 
61  enum {
62  kSearchFieldTag = 100,
63  kViewNameTag = 101
64  };
65 
66  SharedPointer<CTextEdit> searchField;
67  CTextLabel* viewNameLabel;
68  CRowColumnView* attributeView;
69 
70  std::string filterString;
71 
72  const std::string* currentAttributeName;
73 };
74 
75 } // namespace
76 
77 #endif // VSTGUI_LIVE_EDITING
78 
79 #endif // __uiattributescontroller__
Definition: customcontrols.cpp:8