20 #include <vstgui4/vstgui/uidescription/iviewcreator.h> 21 #include <vstgui4/vstgui/uidescription/uiviewcreator.h> 22 #include <vstgui4/vstgui/uidescription/uiviewfactory.h> 23 #include <vstgui4/vstgui/uidescription/uiattributes.h> 24 #include <vstgui4/vstgui/uidescription/detail/uiviewcreatorattributes.h> 25 #include <vstgui4/vstgui/lib/crect.h> 26 #include <vstgui4/vstgui/lib/ccolor.h> 27 #include <vstgui4/vstgui/lib/cbitmap.h> 31 #include <pongasoft/logging/logging.h> 56 fName(std::move(iName))
62 virtual IViewCreator::AttrType getType() = 0;
79 virtual bool apply(CView *iView,
const UIAttributes &iAttributes,
const IUIDescription *iDescription) = 0;
88 virtual bool getAttributeValue(CView *iView,
const IUIDescription *iDescription, std::string &oStringValue)
const = 0;
93 virtual bool getPossibleListValues(std::list<const std::string *> &iValues)
const 107 template<
typename TView>
109 const UIAttributes &iAttributes,
110 const IUIDescription * ) {
return new TView(iSize); }
155 template<
typename TView>
164 template<
typename T,
typename TGetter,
typename TSetter>
183 return IViewCreator::kUnknownType;
190 virtual bool fromString(IUIDescription
const *iDescription, std::string
const &iAttributeValue, T &oValue)
const 196 bool apply(CView *iView,
const UIAttributes &iAttributes,
const IUIDescription *iDescription)
override 198 auto *tv = dynamic_cast<TView *>(iView);
201 auto attributeValue = iAttributes.getAttributeValue(getName());
205 if(fromString(iDescription, *attributeValue, value))
207 std::invoke(fSetter, tv, value);
220 virtual bool toString(IUIDescription
const *iDescription, T
const &iValue, std::string &oStringValue)
const 227 bool getAttributeValue(CView *iView,
const IUIDescription *iDescription, std::string &oStringValue)
const override 229 auto *tv = dynamic_cast<TView *>(iView);
232 auto value = std::invoke(fGetter, tv);
233 return toString(iDescription, value, oStringValue);
256 using ByRefAttribute = TAttribute<T, T
const &(TView::*)() const,
void (TView::*)(T const &)>;
273 return IViewCreator::kTagType;
277 bool fromString(IUIDescription
const *iDescription, std::string
const &iAttributeValue,
TagID &oValue)
const override 279 if(iAttributeValue.length() != 0)
281 auto tag = static_cast<TagID>(iDescription->getTagForName(iAttributeValue.c_str()));
284 char *endPtr =
nullptr;
285 tag = static_cast<TagID>(strtol(iAttributeValue.c_str(), &endPtr, 10));
286 if(endPtr == iAttributeValue.c_str())
302 bool toString(IUIDescription
const *iDescription,
const TagID &iValue, std::string &oStringValue)
const override 306 UTF8StringPtr controlTag = iDescription->lookupControlTagName(iValue);
309 oStringValue = controlTag;
323 template<
typename TInt>
337 return IViewCreator::kIntegerType;
341 bool fromString(IUIDescription
const *iDescription, std::string
const &iAttributeValue, TInt &oValue)
const override 343 char *endPtr =
nullptr;
344 auto value = static_cast<TInt>(strtol(iAttributeValue.c_str(), &endPtr, 10));
345 if(endPtr == iAttributeValue.c_str())
347 DLOG_F(WARNING,
"could not convert <%s> to an integer", iAttributeValue.c_str());
356 bool toString(IUIDescription
const *iDescription,
const TInt &iValue, std::string &oStringValue)
const override 358 std::stringstream str;
360 oStringValue = str.str();
370 template<
typename TFloat>
384 return IViewCreator::kFloatType;
388 bool fromString(IUIDescription
const *iDescription, std::string
const &iAttributeValue, TFloat &oValue)
const override 391 if(Utils::stringToFloat<TFloat>(iAttributeValue, value))
396 DLOG_F(WARNING,
"could not convert <%s> to a float", iAttributeValue.c_str());
402 bool toString(IUIDescription
const *iDescription,
const TFloat &iValue, std::string &oStringValue)
const override 404 std::stringstream str;
406 oStringValue = str.str();
429 return IViewCreator::kColorType;
433 bool fromString(IUIDescription
const *iDescription, std::string
const &iAttributeValue, CColor &oValue)
const override 436 if(UIViewCreator::stringToColor(&iAttributeValue, color, iDescription))
446 bool toString(IUIDescription
const *iDescription,
const CColor &iValue, std::string &oStringValue)
const override 448 return UIViewCreator::colorToString(iValue, oStringValue, iDescription);
470 return IViewCreator::kGradientType;
474 bool fromString(IUIDescription
const *iDescription, std::string
const &iAttributeValue,
GradientPtr &oValue)
const override 476 auto gradient = iDescription->getGradient(iAttributeValue.c_str());
487 bool toString(IUIDescription
const *iDescription,
GradientPtr const &iValue, std::string &oStringValue)
const override 491 auto name = iDescription->lookupGradientName(iValue);
520 return IViewCreator::kBooleanType;
524 bool fromString(IUIDescription
const *iDescription, std::string
const &iAttributeValue,
bool &oValue)
const override 526 if(iAttributeValue ==
"true")
532 if(iAttributeValue ==
"false")
543 bool toString(IUIDescription
const *iDescription,
const bool &iValue, std::string &oStringValue)
const override 545 oStringValue = iValue ?
"true" :
"false";
567 return IViewCreator::kBitmapType;
571 bool fromString(IUIDescription
const *iDescription, std::string
const &iAttributeValue,
BitmapPtr &oValue)
const override 574 if(UIViewCreator::stringToBitmap(&iAttributeValue, bitmap, iDescription))
584 bool toString(IUIDescription
const *iDescription,
BitmapPtr const &iValue, std::string &oStringValue)
const override 587 return UIViewCreator::bitmapToString(iValue, oStringValue, iDescription);
610 return IViewCreator::kFontType;
614 bool fromString(IUIDescription
const *iDescription, std::string
const &iAttributeValue,
FontPtr &oValue)
const override 616 auto font = iDescription->getFont(iAttributeValue.c_str());
627 bool toString(IUIDescription
const *iDescription,
FontPtr const &iValue, std::string &oStringValue)
const override 631 auto fontName = iDescription->lookupFontName(iValue);
634 oStringValue = fontName;
656 bool fromString(IUIDescription
const *iDescription, std::string
const &iAttributeValue,
Margin &oValue)
const override 658 auto parts = Utils::splitFloats<CCoord>(iAttributeValue,
',');
664 if(std::find_if(parts.cbegin(), parts.cend(), [] (
auto f) {
return std::isnan(f);}) != parts.cend())
667 if(parts.size() == 1)
669 oValue =
Margin{parts[0]};
676 oValue =
Margin{parts[0], parts[1], parts[2], parts[3]};
684 bool toString(IUIDescription
const *iDescription,
const Margin &iValue, std::string &oStringValue)
const override 686 std::stringstream str;
699 oStringValue = str.str();
718 bool fromString(IUIDescription
const *iDescription, std::string
const &iAttributeValue,
Range &oValue)
const override 720 auto parts = Utils::splitFloats<CCoord>(iAttributeValue,
',');
726 if(std::find_if(parts.cbegin(), parts.cend(), [] (
auto f) {
return std::isnan(f);}) != parts.cend())
729 if(parts.size() == 1)
730 oValue =
Range{parts[0]};
732 oValue =
Range{parts[0], parts[1]};
739 bool toString(IUIDescription
const *iDescription,
const Range &iValue, std::string &oStringValue)
const override 741 std::stringstream str;
750 oStringValue = str.str();
768 char iDelimiter =
',',
769 bool iSkipEmptyEntries =
false) :
771 fDelimiter{iDelimiter},
772 fSkipEmptyEntries{iSkipEmptyEntries}
777 std::string
const &iAttributeValue,
778 std::vector<std::string> &oValue)
const override 786 bool toString(IUIDescription
const *iDescription,
787 const std::vector<std::string> &iValue,
788 std::string &oStringValue)
const override 790 oStringValue.clear();
792 for(
auto &entry : iValue)
795 oStringValue += fDelimiter;
796 if(!entry.empty() || !fSkipEmptyEntries)
798 oStringValue += entry;
826 fAttributeValuesMap(iAttributeValues)
828 ,fAttributeValuesList{iAttributeValues}
836 return IViewCreator::kListType;
841 std::string
const &iAttributeValue,
842 T &oValue)
const override 844 if(fAttributeValuesMap.find(iAttributeValue) != fAttributeValuesMap.cend())
846 oValue = fAttributeValuesMap.at(iAttributeValue);
850 DLOG_F(WARNING,
"Attribute value '%s' is not valid for '%s'", iAttributeValue.c_str(),
ViewAttribute::getName().c_str());
856 bool toString(IUIDescription
const *iDescription,
858 std::string &oStringValue)
const override 860 auto pos = std::find_if(std::begin(fAttributeValuesList),
861 std::end(fAttributeValuesList),
862 [&iValue](
auto entry) ->
bool {
863 return entry.second == iValue;
865 if(pos != std::end(fAttributeValuesList))
867 oStringValue = pos->first;
875 bool getPossibleListValues(std::list<const std::string *> &iValues)
const override 877 for(
auto const &p : fAttributeValuesList)
879 iValues.emplace_back(&p.first);
888 std::vector<typename AttrValMap<T>::value_type>
const fAttributeValuesList;
895 char const *iDisplayName =
nullptr,
896 char const *iBaseViewName = VSTGUI::UIViewCreator::kCView) :
897 fViewName{iViewName},
898 fDisplayName{iDisplayName},
899 fBaseViewName{iBaseViewName},
903 if(iViewName !=
nullptr && iDisplayName !=
nullptr)
904 VSTGUI::UIViewFactory::registerViewCreator(*
this);
930 return fBaseViewName;
936 template<
typename XView>
941 registerAttribute(attribute.second);
944 if(std::string(fBaseViewName) == std::string(VSTGUI::UIViewCreator::kCView))
952 typename ColorAttribute::Getter iGetter,
953 typename ColorAttribute::Setter iSetter)
955 registerAttribute<ColorAttribute>(iName, iGetter, iSetter);
962 typename GradientAttribute::Getter iGetter,
963 typename GradientAttribute::Setter iSetter)
965 registerAttribute<GradientAttribute>(iName, iGetter, iSetter);
972 typename BitmapAttribute::Getter iGetter,
973 typename BitmapAttribute::Setter iSetter)
975 registerAttribute<BitmapAttribute>(iName, iGetter, iSetter);
982 typename FontAttribute::Getter iGetter,
983 typename FontAttribute::Setter iSetter)
985 registerAttribute<FontAttribute>(iName, iGetter, iSetter);
992 typename MarginAttribute::Getter iGetter,
993 typename MarginAttribute::Setter iSetter)
995 registerAttribute<MarginAttribute>(iName, iGetter, iSetter);
1002 typename RangeAttribute::Getter iGetter,
1003 typename RangeAttribute::Setter iSetter)
1005 registerAttribute<RangeAttribute>(iName, iGetter, iSetter);
1012 typename VectorStringAttribute::Getter iGetter,
1013 typename VectorStringAttribute::Setter iSetter,
1014 char iDelimiter =
',',
1015 bool iSkipEmptyEntries =
false)
1017 registerAttribute<VectorStringAttribute>(iName, iGetter, iSetter, iDelimiter, iSkipEmptyEntries);
1036 template<
typename T>
1038 typename ListAttribute<T>::Getter iGetter,
1039 typename ListAttribute<T>::Setter iSetter,
1042 registerAttribute<ListAttribute<T>>(iName, iGetter, iSetter, iAttributeValues);
1049 typename TagAttribute::Getter iGetter,
1050 typename TagAttribute::Setter iSetter)
1052 registerAttribute<TagAttribute>(iName, iGetter, iSetter);
1058 template<
typename TInt>
1060 typename IntegerAttribute<TInt>::Getter iGetter,
1061 typename IntegerAttribute<TInt>::Setter iSetter)
1063 registerAttribute<IntegerAttribute<TInt>>(iName, iGetter, iSetter);
1070 typename IntegerAttribute<int32_t>::Getter iGetter,
1071 typename IntegerAttribute<int32_t>::Setter iSetter)
1073 registerIntegerAttribute<int32_t>(iName, iGetter, iSetter);
1080 typename FloatAttribute<float>::Getter iGetter,
1081 typename FloatAttribute<float>::Setter iSetter)
1083 registerAttribute<FloatAttribute<float>>(iName, iGetter, iSetter);
1090 typename FloatAttribute<double>::Getter iGetter,
1091 typename FloatAttribute<double>::Setter iSetter)
1093 registerAttribute<FloatAttribute<double>>(iName, iGetter, iSetter);
1100 typename BooleanAttribute::Getter iGetter,
1101 typename BooleanAttribute::Setter iSetter)
1103 registerAttribute<BooleanAttribute>(iName, iGetter, iSetter);
1109 CView *
create(
const UIAttributes &attributes,
const IUIDescription *description)
const override 1111 #ifdef JAMBA_DEBUG_LOGGING 1112 DLOG_F(INFO,
"CustomViewCreator<%s>::create()", getViewName());
1115 return createCustomView<TView>(CRect(0, 0, 0, 0), attributes, description);
1122 bool apply(CView *view,
const UIAttributes &attributes,
const IUIDescription *description)
const override 1124 auto *tv = dynamic_cast<TView *>(view);
1129 for(
auto attribute : fAttributes)
1131 attribute.second->apply(tv, attributes, description);
1140 for(
auto attribute : fAttributes)
1142 attributeNames.emplace_back(attribute.first);
1150 auto iter = fAttributes.find(attributeName);
1151 if(iter != fAttributes.cend())
1153 return iter->second->getType();
1155 return kUnknownType;
1162 bool getAttributeValue(CView *iView,
1163 const std::string &iAttributeName,
1164 std::string &oStringValue,
1165 const IUIDescription *iDescription)
const override 1167 auto *cdv = dynamic_cast<TView *>(iView);
1172 auto iter = fAttributes.find(iAttributeName);
1173 if(iter != fAttributes.cend())
1175 return iter->second->getAttributeValue(cdv, iDescription, oStringValue);
1184 bool getPossibleListValues(
const std::string &iAttributeName, std::list<const std::string *> &iValues)
const override 1186 auto iter = fAttributes.find(iAttributeName);
1187 if(iter != fAttributes.cend())
1189 return iter->second->getPossibleListValues(iValues);
1198 template<
typename XView>
1207 assert(fAttributes.find(iAttribute->getName()) == fAttributes.cend());
1208 fAttributes[iAttribute->getName()] = std::move(iAttribute);
1214 template<
typename TViewAttribute,
typename... Args>
1216 typename TViewAttribute::Getter iGetter,
1217 typename TViewAttribute::Setter iSetter,
1220 std::shared_ptr<ViewAttribute> cva;
1221 cva.reset(
new TViewAttribute(iName, iGetter, iSetter, std::forward<Args>(iArgs)...));
1222 registerAttribute(cva);
1235 template<
typename T>
1238 template<
typename T>
1311 template<
typename TView,
typename TBaseView =
void>
1316 char const *iDisplayName =
nullptr,
1317 char const *iBaseViewName = VSTGUI::UIViewCreator::kCView) :
1320 if constexpr(impl::is_creator_ctor_detected<TBaseView>)
char const * fBaseViewName
Definition: CustomViewCreator.h:1228
BitmapAttribute(std::string const &iName, typename ByValAttribute< BitmapPtr >::Getter iGetter, typename ByValAttribute< BitmapPtr >::Setter iSetter)
Definition: CustomViewCreator.h:559
IViewCreator::AttrType getType() override
Definition: CustomViewCreator.h:518
CView * create(const UIAttributes &attributes, const IUIDescription *description) const override
This is the factory method which will instantiate the view.
Definition: CustomViewCreator.h:1109
void registerFloatAttribute(std::string const &iName, typename FloatAttribute< float >::Getter iGetter, typename FloatAttribute< float >::Setter iSetter)
Registers a float attribute with the given name and getter/setter.
Definition: CustomViewCreator.h:1079
Inherit from this class to provide the factory for a custom view.
Definition: CustomViewCreator.h:1312
void registerColorAttribute(std::string const &iName, typename ColorAttribute::Getter iGetter, typename ColorAttribute::Setter iSetter)
Registers a color attribute with the given name and getter/setter.
Definition: CustomViewCreator.h:951
void registerGradientAttribute(std::string const &iName, typename GradientAttribute::Getter iGetter, typename GradientAttribute::Setter iSetter)
Registers a gradient attribute with the given name and getter/setter.
Definition: CustomViewCreator.h:961
IViewCreator::AttrType getType() override
Definition: CustomViewCreator.h:608
IntegerAttribute(std::string const &iName, Getter iGetter, Setter iSetter)
Definition: CustomViewCreator.h:331
IViewCreator::AttrType getType() override
Definition: CustomViewCreator.h:468
Generic base class that implements the logic for a ViewAttribute that uses a getter and setter in TVi...
Definition: CustomViewCreator.h:165
constexpr TagID UNDEFINED_TAG_ID
Constant used to test whether the TagID represents a valid id or an undefined one.
Definition: Types.h:61
char fDelimiter
Definition: CustomViewCreator.h:807
Specialization for an float attribute (which can be a double or a float, etc..).
Definition: CustomViewCreator.h:371
TCustomViewCreator(char const *iViewName=nullptr, char const *iDisplayName=nullptr, char const *iBaseViewName=VSTGUI::UIViewCreator::kCView)
Definition: CustomViewCreator.h:894
Specialization for the margin attribute.
Definition: CustomViewCreator.h:647
ListAttribute(std::string const &iName, typename super_type::Getter iGetter, typename super_type::Setter iSetter, AttrValInitList< T > const &iAttributeValues)
Definition: CustomViewCreator.h:821
RangeAttribute(std::string const &iName, typename ByRefAttribute< Range >::Getter iGetter, typename ByRefAttribute< Range >::Setter iSetter)
Definition: CustomViewCreator.h:712
VectorStringAttribute(std::string const &iName, typename super_type::Getter iGetter, typename super_type::Setter iSetter, char iDelimiter=',', bool iSkipEmptyEntries=false)
Definition: CustomViewCreator.h:765
void registerMarginAttribute(std::string const &iName, typename MarginAttribute::Getter iGetter, typename MarginAttribute::Setter iSetter)
Registers a Margin attribute with the given name and getter/setter.
Definition: CustomViewCreator.h:991
bool fromString(IUIDescription const *iDescription, std::string const &iAttributeValue, TFloat &oValue) const override
Definition: CustomViewCreator.h:388
FloatAttribute(std::string const &iName, Getter iGetter, Setter iSetter)
Definition: CustomViewCreator.h:378
void registerAttributes(TCustomViewCreator< XView > const &iOther)
This method is called to register all the attributes from another CustomViewCreator (used in case of ...
Definition: CustomViewCreator.h:937
IViewCreator::AttrType getType() override
Definition: CustomViewCreator.h:181
Specialization for a vector of strings.
Definition: CustomViewCreator.h:759
FontAttribute(std::string const &iName, typename ByValAttribute< FontPtr >::Getter iGetter, typename ByValAttribute< FontPtr >::Setter iSetter)
Definition: CustomViewCreator.h:602
TSetter Setter
Definition: CustomViewCreator.h:169
AttrType getAttributeType(const std::string &attributeName) const override
Definition: CustomViewCreator.h:1148
T fTo
Definition: Lerp.h:341
void registerListAttribute(std::string const &iName, typename ListAttribute< T >::Getter iGetter, typename ListAttribute< T >::Setter iSetter, AttrValInitList< T > const &iAttributeValues)
Registers a list attribute with the given name and getter/setter.
Definition: CustomViewCreator.h:1037
Specialization for the range attribute.
Definition: CustomViewCreator.h:709
Specialization for a bitmap attribute.
Definition: CustomViewCreator.h:555
Specialization for an Integer attribute (which can be any kind of integer, like short,...
Definition: CustomViewCreator.h:324
CustomViewCreator(char const *iViewName=nullptr, char const *iDisplayName=nullptr, char const *iBaseViewName=VSTGUI::UIViewCreator::kCView)
Definition: CustomViewCreator.h:1315
std::initializer_list< typename AttrValMap< T >::value_type > AttrValInitList
Defines the type to initialize an [AttrValMap], for an example check [TCustomViewCreator::registerLis...
Definition: CustomViewCreator.h:121
TView * createCustomView(CRect const &iSize, const UIAttributes &iAttributes, const IUIDescription *)
Factory method which creates the actual view.
Definition: CustomViewCreator.h:108
void registerTagAttribute(std::string const &iName, typename TagAttribute::Getter iGetter, typename TagAttribute::Setter iSetter)
Registers a tag attribute with the given name and getter/setter.
Definition: CustomViewCreator.h:1048
Specialization for the color attribute.
Definition: CustomViewCreator.h:416
TAttribute< T, T const &(StepButtonView ::*)() const, void(StepButtonView ::*)(T const &)> ByRefAttribute
ByRefAttribute defines getter/setter by const reference.
Definition: CustomViewCreator.h:256
bool fromString(IUIDescription const *iDescription, std::string const &iAttributeValue, TagID &oValue) const override
Definition: CustomViewCreator.h:277
ParamID TagID
Defining a type for tags.
Definition: Types.h:57
TAttribute(std::string const &iName, Getter iGetter, Setter iSetter)
Definition: CustomViewCreator.h:172
std::vector< std::string > splitString(const std::string &iString, char iDelimiter, bool iSkipEmptyEntries)
Split a string according to a delimiter and returns a vector.
Definition: StringUtils.cpp:30
bool fromString(IUIDescription const *iDescription, std::string const &iAttributeValue, BitmapPtr &oValue) const override
Definition: CustomViewCreator.h:571
MarginAttribute(std::string const &iName, typename ByRefAttribute< Margin >::Getter iGetter, typename ByRefAttribute< Margin >::Setter iSetter)
Definition: CustomViewCreator.h:650
char const * fDisplayName
Definition: CustomViewCreator.h:1227
bool apply(CView *view, const UIAttributes &attributes, const IUIDescription *description) const override
Extract all the attribute values and apply them to the view.
Definition: CustomViewCreator.h:1122
std::string getName() const
Name of the attribute (which ends up being an attribute in the xml file) Ex: <view back-color="~ Blac...
Definition: CustomViewCreator.h:68
bool getAttributeNames(std::list< std::string > &attributeNames) const override
Definition: CustomViewCreator.h:1138
CFontDesc * FontPtr
Definition: Types.h:53
AttrValMap< T > const fAttributeValuesMap
Definition: CustomViewCreator.h:886
Specialization for a tag attribute (vst type TagID).
Definition: CustomViewCreator.h:262
bool fromString(IUIDescription const *iDescription, std::string const &iAttributeValue, GradientPtr &oValue) const override
Definition: CustomViewCreator.h:474
TAttribute< T, T(StepButtonView ::*)() const, void(StepButtonView ::*)(T)> ByValAttribute
ByValAttribute defines getter/setter by value (copy)
Definition: CustomViewCreator.h:250
bool fromString(IUIDescription const *iDescription, std::string const &iAttributeValue, FontPtr &oValue) const override
Definition: CustomViewCreator.h:614
CCoord fTop
Definition: LookAndFeel.h:58
char const * fViewName
Definition: CustomViewCreator.h:1226
IViewCreator::AttrType getType() override
Definition: CustomViewCreator.h:565
ViewAttribute(std::string iName)
Definition: CustomViewCreator.h:55
IViewCreator::AttrType getType() override
Definition: CustomViewCreator.h:335
TagAttribute(std::string const &iName, typename ByValAttribute< TagID >::Getter iGetter, typename ByValAttribute< TagID >::Setter iSetter)
Definition: CustomViewCreator.h:265
bool apply(CView *iView, const UIAttributes &iAttributes, const IUIDescription *iDescription) override
apply => calls the setter on the view to set the attribute (use fromString)
Definition: CustomViewCreator.h:196
TGetter Getter
Definition: CustomViewCreator.h:168
Margin is a similar concept to css: used to create space around elements, outside of any defined bord...
Definition: LookAndFeel.h:32
CCoord fRight
Definition: LookAndFeel.h:59
std::string fName
Definition: CustomViewCreator.h:100
IViewCreator::AttrType getType() override
Definition: CustomViewCreator.h:382
Specialization for the color attribute.
Definition: CustomViewCreator.h:457
constexpr auto is_creator_ctor_detected
Definition: CustomViewCreator.h:1239
Specialization for a bitmap attribute.
Definition: CustomViewCreator.h:598
void registerFontAttribute(std::string const &iName, typename FontAttribute::Getter iGetter, typename FontAttribute::Setter iSetter)
Registers a font attribute with the given name and getter/setter.
Definition: CustomViewCreator.h:981
std::map< std::string, T > AttrValMap
Defines a map of string to attribute value.
Definition: CustomViewCreator.h:115
void registerAttribute(std::shared_ptr< ViewAttribute > iAttribute)
Internal method to register an attribute...
Definition: CustomViewCreator.h:1204
T fFrom
Definition: Lerp.h:340
void registerBooleanAttribute(std::string const &iName, typename BooleanAttribute::Getter iGetter, typename BooleanAttribute::Setter iSetter)
Registers a boolean attribute with the given name and getter/setter.
Definition: CustomViewCreator.h:1099
~TCustomViewCreator() override
Definition: CustomViewCreator.h:908
decltype(typename T::Creator()) creator_ctor_t
Definition: CustomViewCreator.h:1236
Definition: CustomController.h:24
bool fromString(IUIDescription const *iDescription, std::string const &iAttributeValue, bool &oValue) const override
Definition: CustomViewCreator.h:524
IdStringPtr getViewName() const override
Definition: CustomViewCreator.h:916
IViewCreator::AttrType getType() override
Definition: CustomViewCreator.h:427
std::map< std::string, std::shared_ptr< ViewAttribute > > fAttributes
Definition: CustomViewCreator.h:1231
bool fromString(IUIDescription const *iDescription, std::string const &iAttributeValue, Margin &oValue) const override
Definition: CustomViewCreator.h:656
void registerRangeAttribute(std::string const &iName, typename RangeAttribute::Getter iGetter, typename RangeAttribute::Setter iSetter)
Registers a Range attribute with the given name and getter/setter.
Definition: CustomViewCreator.h:1001
bool fromString(IUIDescription const *iDescription, std::string const &iAttributeValue, std::vector< std::string > &oValue) const override
Definition: CustomViewCreator.h:776
bool fSkipEmptyEntries
Definition: CustomViewCreator.h:808
CCoord fLeft
Definition: LookAndFeel.h:61
Specialization for a list of possible values defined by the AttributeMap
Definition: CustomViewCreator.h:815
IdStringPtr getBaseViewName() const override
Definition: CustomViewCreator.h:928
void registerIntegerAttribute(std::string const &iName, typename IntegerAttribute< TInt >::Getter iGetter, typename IntegerAttribute< TInt >::Setter iSetter)
Registers an Integer (any kind) attribute with the given name and getter/setter.
Definition: CustomViewCreator.h:1059
void registerVectorStringAttribute(std::string const &iName, typename VectorStringAttribute::Getter iGetter, typename VectorStringAttribute::Setter iSetter, char iDelimiter=',', bool iSkipEmptyEntries=false)
Registers a Range attribute with the given name and getter/setter.
Definition: CustomViewCreator.h:1011
GradientAttribute(std::string const &iName, typename ByValAttribute< GradientPtr >::Getter iGetter, typename ByValAttribute< GradientPtr >::Setter iSetter)
Definition: CustomViewCreator.h:462
ColorAttribute(std::string const &iName, typename ByRefAttribute< CColor >::Getter iGetter, typename ByRefAttribute< CColor >::Setter iSetter)
Definition: CustomViewCreator.h:421
void registerIntAttribute(std::string const &iName, typename IntegerAttribute< int32_t >::Getter iGetter, typename IntegerAttribute< int32_t >::Setter iSetter)
Registers an int attribute with the given name and getter/setter.
Definition: CustomViewCreator.h:1069
UTF8StringPtr getDisplayName() const override
Definition: CustomViewCreator.h:922
bool fromString(IUIDescription const *iDescription, std::string const &iAttributeValue, CColor &oValue) const override
Definition: CustomViewCreator.h:433
virtual bool fromString(IUIDescription const *iDescription, std::string const &iAttributeValue, T &oValue) const
Subclasses need to implement this method to convert a string (iAttributeValue) to a T.
Definition: CustomViewCreator.h:190
Generic custom view creator base class.
Definition: CustomViewCreator.h:156
IViewCreator::AttrType getType() override
Definition: CustomViewCreator.h:834
void registerDoubleAttribute(std::string const &iName, typename FloatAttribute< double >::Getter iGetter, typename FloatAttribute< double >::Setter iSetter)
Registers a double attribute with the given name and getter/setter.
Definition: CustomViewCreator.h:1089
void registerAttribute(std::string const &iName, typename TViewAttribute::Getter iGetter, typename TViewAttribute::Setter iSetter, Args &&...iArgs)
Generic register attribute.
Definition: CustomViewCreator.h:1215
CBitmap * BitmapPtr
Definition: Types.h:49
Specialization for the boolean attribute.
Definition: CustomViewCreator.h:508
CCoord fBottom
Definition: LookAndFeel.h:60
void registerBitmapAttribute(std::string const &iName, typename BitmapAttribute::Getter iGetter, typename BitmapAttribute::Setter iSetter)
Registers a bitmap attribute with the given name and getter/setter.
Definition: CustomViewCreator.h:971
constexpr ParamID UNDEFINED_PARAM_ID
Constant used throughout the code to test whether the ParamID represents a valid id or an undefined o...
Definition: Types.h:47
bool fromString(IUIDescription const *iDescription, std::string const &iAttributeValue, T &oValue) const override
Subclasses need to implement this method to convert a string (iAttributeValue) to a T.
Definition: CustomViewCreator.h:840
bool fromString(IUIDescription const *iDescription, std::string const &iAttributeValue, Range &oValue) const override
Definition: CustomViewCreator.h:718
BooleanAttribute(std::string const &iName, typename ByValAttribute< bool >::Getter iGetter, typename ByValAttribute< bool >::Setter iSetter)
Definition: CustomViewCreator.h:512
bool fromString(IUIDescription const *iDescription, std::string const &iAttributeValue, TInt &oValue) const override
Definition: CustomViewCreator.h:341
Base abstract class for an attribute of a view.
Definition: CustomViewCreator.h:51
IViewCreator::AttrType getType() override
Definition: CustomViewCreator.h:271
Setter fSetter
Definition: CustomViewCreator.h:243
CGradient * GradientPtr
Definition: Types.h:57