ASPiK SDK
iviewcreator.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 __iviewcreator__
6 #define __iviewcreator__
7 
8 #include "../lib/vstguifwd.h"
9 #include <string>
10 #include <list>
11 
12 namespace VSTGUI {
13 class IUIDescription;
14 class UIAttributes;
15 
16 //-----------------------------------------------------------------------------
19 //-----------------------------------------------------------------------------
21 {
22 public:
23  virtual ~IViewCreator () noexcept = default;
24 
25  enum AttrType {
26  kUnknownType,
27  kBooleanType,
28  kIntegerType,
29  kFloatType,
30  kStringType,
31  kColorType,
32  kFontType,
33  kBitmapType,
34  kPointType,
35  kRectType,
36  kTagType,
37  kListType,
38  kGradientType
39  };
40 
41  virtual IdStringPtr getViewName () const = 0;
42  virtual IdStringPtr getBaseViewName () const = 0;
43  virtual CView* create (const UIAttributes& attributes, const IUIDescription* description) const = 0;
44  virtual bool apply (CView* view, const UIAttributes& attributes, const IUIDescription* description) const = 0;
45  virtual bool getAttributeNames (std::list<std::string>& attributeNames) const = 0;
46  virtual AttrType getAttributeType (const std::string& attributeName) const = 0;
47  virtual bool getAttributeValue (CView* view, const std::string& attributeName, std::string& stringValue, const IUIDescription* desc) const = 0;
48  // optional list type support
49  virtual bool getPossibleListValues (const std::string& attributeName, std::list<const std::string*>& values) const = 0;
50  // optional value range
51  virtual bool getAttributeValueRange (const std::string& attributeName, double& minValue, double &maxValue) const = 0;
52  // optional display name
53  virtual UTF8StringPtr getDisplayName () const = 0;
54 };
55 
56 //-----------------------------------------------------------------------------
58 //-----------------------------------------------------------------------------
60 {
61 public:
62  bool apply (CView* view, const UIAttributes& attributes, const IUIDescription* description) const override { return true; }
63  bool getAttributeNames (std::list<std::string>& attributeNames) const override { return true; }
64  AttrType getAttributeType (const std::string& attributeName) const override { return kUnknownType; }
65  bool getAttributeValue (CView* view, const std::string& attributeName, std::string& stringValue, const IUIDescription* desc) const override { return false; }
66  bool getPossibleListValues (const std::string& attributeName, std::list<const std::string*>& values) const override { return false; }
67  bool getAttributeValueRange (const std::string& attributeName, double& minValue, double &maxValue) const override { return false; }
68  UTF8StringPtr getDisplayName () const override { return getViewName (); }
69 };
70 
71 } // namespace
72 
73 #endif // __iviewcreator__
View creator interface adapter.
Definition: iviewcreator.h:59
Definition: iuidescription.h:19
View creator interface.
Definition: iviewcreator.h:20
Definition: customcontrols.cpp:8
Definition: uiattributes.h:21
Base Class of all view objects.
Definition: cview.h:44