ASPiK SDK
uifontscontroller.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 __uifontscontroller__
6 #define __uifontscontroller__
7 
8 #include "../uidescription.h"
9 
10 #if VSTGUI_LIVE_EDITING
11 
12 #include "uiselection.h"
13 #include "uiundomanager.h"
14 #include "iaction.h"
15 #include "../delegationcontroller.h"
16 #include "../../lib/cdatabrowser.h"
17 #include "../../lib/controls/ctextedit.h"
18 
19 namespace VSTGUI {
20 class UIFontsDataSource;
21 //----------------------------------------------------------------------------------------------------
22 class UIFontsController : public NonAtomicReferenceCounted, public DelegationController, public IGenericStringListDataBrowserSourceSelectionChanged
23 {
24 public:
25  UIFontsController (IController* baseController, UIDescription* description, IActionPerformer* actionPerformer);
26  ~UIFontsController () override;
27 
28 protected:
29  CView* createView (const UIAttributes& attributes, const IUIDescription* description) override;
30  CView* verifyView (CView* view, const UIAttributes& attributes, const IUIDescription* description) override;
31  IControlListener* getControlListener (UTF8StringPtr name) override;
32  void valueChanged (CControl* pControl) override;
33 
34  void dbSelectionChanged (int32_t selectedRow, GenericStringListDataBrowserSource* source) override;
35 
36  static bool valueToString (float value, char utf8String[256], CParamDisplay::ValueToStringUserData* userData);
37  static bool stringToValue (UTF8StringPtr txt, float& result, CTextEdit::StringToValueUserData* userData);
38 
39  SharedPointer<UIDescription> editDescription;
40  IActionPerformer* actionPerformer;
41  UIFontsDataSource* dataSource;
42 
43  COptionMenu* fontMenu;
44  CTextEdit* altTextEdit;
45  CTextEdit* sizeTextEdit;
46  CControl* boldControl;
47  CControl* italicControl;
48  CControl* strikethroughControl;
49  CControl* underlineControl;
50 
51  std::string selectedFont;
52 
53  enum {
54  kAddTag = 0,
55  kRemoveTag,
56  kSearchTag,
57  kFontMainTag,
58  kFontAltTag,
59  kFontSizeTag,
60  kFontStyleBoldTag,
61  kFontStyleItalicTag,
62  kFontStyleStrikethroughTag,
63  kFontStyleUnderlineTag
64  };
65 };
66 
67 } // namespace
68 
69 #endif // VSTGUI_LIVE_EDITING
70 
71 #endif // __uifontscontroller__
Definition: customcontrols.cpp:8