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> 30 #include <pongasoft/logging/logging.h> 55 fName(std::move(iName))
61 virtual IViewCreator::AttrType getType() = 0;
78 virtual bool apply(CView *iView,
const UIAttributes &iAttributes,
const IUIDescription *iDescription) = 0;
87 virtual bool getAttributeValue(CView *iView,
const IUIDescription *iDescription, std::string &oStringValue)
const = 0;
92 virtual bool getPossibleListValues(std::list<const std::string *> &iValues)
const 106 template<
typename TView>
108 const UIAttributes &iAttributes,
109 const IUIDescription * ) {
return new TView(iSize); }
154 template<
typename TView>
163 template<
typename T,
typename TGetter,
typename TSetter>
182 return IViewCreator::kUnknownType;
189 virtual bool fromString(IUIDescription
const *iDescription, std::string
const &iAttributeValue, T &oValue)
const 195 bool apply(CView *iView,
const UIAttributes &iAttributes,
const IUIDescription *iDescription)
override 197 auto *tv = dynamic_cast<TView *>(iView);
200 auto attributeValue = iAttributes.getAttributeValue(getName());
204 if(fromString(iDescription, *attributeValue, value))
206 (tv->*fSetter)(value);
219 virtual bool toString(IUIDescription
const *iDescription, T
const &iValue, std::string &oStringValue)
const 226 bool getAttributeValue(CView *iView,
const IUIDescription *iDescription, std::string &oStringValue)
const override 228 auto *tv = dynamic_cast<TView *>(iView);
231 auto value = (tv->*fGetter)();
232 return toString(iDescription, value, oStringValue);
255 using ByRefAttribute = TAttribute<T, T
const &(TView::*)() const,
void (TView::*)(T const &)>;
272 return IViewCreator::kTagType;
276 bool fromString(IUIDescription
const *iDescription, std::string
const &iAttributeValue,
TagID &oValue)
const override 278 if(iAttributeValue.length() != 0)
280 auto tag = static_cast<TagID>(iDescription->getTagForName(iAttributeValue.c_str()));
283 char *endPtr =
nullptr;
284 tag = static_cast<TagID>(strtol(iAttributeValue.c_str(), &endPtr, 10));
285 if(endPtr == iAttributeValue.c_str())
301 bool toString(IUIDescription
const *iDescription,
const TagID &iValue, std::string &oStringValue)
const override 305 UTF8StringPtr controlTag = iDescription->lookupControlTagName(iValue);
308 oStringValue = controlTag;
322 template<
typename TInt>
336 return IViewCreator::kIntegerType;
340 bool fromString(IUIDescription
const *iDescription, std::string
const &iAttributeValue, TInt &oValue)
const override 342 char *endPtr =
nullptr;
343 auto value = static_cast<TInt>(strtol(iAttributeValue.c_str(), &endPtr, 10));
344 if(endPtr == iAttributeValue.c_str())
346 DLOG_F(WARNING,
"could not convert <%s> to an integer", iAttributeValue.c_str());
355 bool toString(IUIDescription
const *iDescription,
const TInt &iValue, std::string &oStringValue)
const override 357 std::stringstream str;
359 oStringValue = str.str();
369 template<
typename TFloat>
383 return IViewCreator::kFloatType;
387 bool fromString(IUIDescription
const *iDescription, std::string
const &iAttributeValue, TFloat &oValue)
const override 390 if(Utils::stringToFloat<TFloat>(iAttributeValue, value))
395 DLOG_F(WARNING,
"could not convert <%s> to a float", iAttributeValue.c_str());
401 bool toString(IUIDescription
const *iDescription,
const TFloat &iValue, std::string &oStringValue)
const override 403 std::stringstream str;
405 oStringValue = str.str();
428 return IViewCreator::kColorType;
432 bool fromString(IUIDescription
const *iDescription, std::string
const &iAttributeValue, CColor &oValue)
const override 435 if(UIViewCreator::stringToColor(&iAttributeValue, color, iDescription))
445 bool toString(IUIDescription
const *iDescription,
const CColor &iValue, std::string &oStringValue)
const override 447 return UIViewCreator::colorToString(iValue, oStringValue, iDescription);
469 return IViewCreator::kGradientType;
473 bool fromString(IUIDescription
const *iDescription, std::string
const &iAttributeValue,
GradientPtr &oValue)
const override 475 auto gradient = iDescription->getGradient(iAttributeValue.c_str());
486 bool toString(IUIDescription
const *iDescription,
GradientPtr const &iValue, std::string &oStringValue)
const override 490 auto name = iDescription->lookupGradientName(iValue);
519 return IViewCreator::kBooleanType;
523 bool fromString(IUIDescription
const *iDescription, std::string
const &iAttributeValue,
bool &oValue)
const override 525 if(iAttributeValue ==
"true")
531 if(iAttributeValue ==
"false")
542 bool toString(IUIDescription
const *iDescription,
const bool &iValue, std::string &oStringValue)
const override 544 oStringValue = iValue ?
"true" :
"false";
566 return IViewCreator::kBitmapType;
570 bool fromString(IUIDescription
const *iDescription, std::string
const &iAttributeValue,
BitmapPtr &oValue)
const override 573 if(UIViewCreator::stringToBitmap(&iAttributeValue, bitmap, iDescription))
583 bool toString(IUIDescription
const *iDescription,
BitmapPtr const &iValue, std::string &oStringValue)
const override 586 return UIViewCreator::bitmapToString(iValue, oStringValue, iDescription);
609 return IViewCreator::kFontType;
613 bool fromString(IUIDescription
const *iDescription, std::string
const &iAttributeValue,
FontPtr &oValue)
const override 615 auto font = iDescription->getFont(iAttributeValue.c_str());
626 bool toString(IUIDescription
const *iDescription,
FontPtr const &iValue, std::string &oStringValue)
const override 630 auto fontName = iDescription->lookupFontName(iValue);
633 oStringValue = fontName;
655 bool fromString(IUIDescription
const *iDescription, std::string
const &iAttributeValue,
Margin &oValue)
const override 657 auto parts = Utils::splitFloats<CCoord>(iAttributeValue,
',');
663 if(std::find_if(parts.cbegin(), parts.cend(), [] (
auto f) {
return std::isnan(f);}) != parts.cend())
666 if(parts.size() == 1)
668 oValue =
Margin{parts[0]};
675 oValue =
Margin{parts[0], parts[1], parts[2], parts[3]};
683 bool toString(IUIDescription
const *iDescription,
const Margin &iValue, std::string &oStringValue)
const override 685 std::stringstream str;
698 oStringValue = str.str();
717 bool fromString(IUIDescription
const *iDescription, std::string
const &iAttributeValue,
Range &oValue)
const override 719 auto parts = Utils::splitFloats<CCoord>(iAttributeValue,
',');
725 if(std::find_if(parts.cbegin(), parts.cend(), [] (
auto f) {
return std::isnan(f);}) != parts.cend())
728 if(parts.size() == 1)
729 oValue =
Range{parts[0]};
731 oValue =
Range{parts[0], parts[1]};
738 bool toString(IUIDescription
const *iDescription,
const Range &iValue, std::string &oStringValue)
const override 740 std::stringstream str;
749 oStringValue = str.str();
767 char iDelimiter =
',',
768 bool iSkipEmptyEntries =
false) :
770 fDelimiter{iDelimiter},
771 fSkipEmptyEntries{iSkipEmptyEntries}
776 std::string
const &iAttributeValue,
777 std::vector<std::string> &oValue)
const override 785 bool toString(IUIDescription
const *iDescription,
786 const std::vector<std::string> &iValue,
787 std::string &oStringValue)
const override 789 oStringValue.clear();
791 for(
auto &entry : iValue)
794 oStringValue += fDelimiter;
795 if(!entry.empty() || !fSkipEmptyEntries)
797 oStringValue += entry;
825 fAttributeValuesMap(iAttributeValues)
827 ,fAttributeValuesList{iAttributeValues}
835 return IViewCreator::kListType;
840 std::string
const &iAttributeValue,
841 T &oValue)
const override 843 if(fAttributeValuesMap.find(iAttributeValue) != fAttributeValuesMap.cend())
845 oValue = fAttributeValuesMap.at(iAttributeValue);
849 DLOG_F(WARNING,
"Attribute value '%s' is not valid for '%s'", iAttributeValue.c_str(),
ViewAttribute::getName().c_str());
855 bool toString(IUIDescription
const *iDescription,
857 std::string &oStringValue)
const override 859 auto pos = std::find_if(std::begin(fAttributeValuesList),
860 std::end(fAttributeValuesList),
861 [&iValue](
auto entry) ->
bool {
862 return entry.second == iValue;
864 if(pos != std::end(fAttributeValuesList))
866 oStringValue = pos->first;
874 bool getPossibleListValues(std::list<const std::string *> &iValues)
const override 876 for(
auto const &p : fAttributeValuesList)
878 iValues.emplace_back(&p.first);
887 std::vector<typename AttrValMap<T>::value_type>
const fAttributeValuesList;
894 char const *iDisplayName =
nullptr,
895 char const *iBaseViewName = VSTGUI::UIViewCreator::kCView) :
896 fViewName{iViewName},
897 fDisplayName{iDisplayName},
898 fBaseViewName{iBaseViewName},
902 if(iViewName !=
nullptr && iDisplayName !=
nullptr)
903 VSTGUI::UIViewFactory::registerViewCreator(*
this);
929 return fBaseViewName;
935 template<
typename XView>
940 registerAttribute(attribute.second);
943 if(std::string(fBaseViewName) == std::string(VSTGUI::UIViewCreator::kCView))
951 typename ColorAttribute::Getter iGetter,
952 typename ColorAttribute::Setter iSetter)
954 registerAttribute<ColorAttribute>(iName, iGetter, iSetter);
961 typename GradientAttribute::Getter iGetter,
962 typename GradientAttribute::Setter iSetter)
964 registerAttribute<GradientAttribute>(iName, iGetter, iSetter);
971 typename BitmapAttribute::Getter iGetter,
972 typename BitmapAttribute::Setter iSetter)
974 registerAttribute<BitmapAttribute>(iName, iGetter, iSetter);
981 typename FontAttribute::Getter iGetter,
982 typename FontAttribute::Setter iSetter)
984 registerAttribute<FontAttribute>(iName, iGetter, iSetter);
991 typename MarginAttribute::Getter iGetter,
992 typename MarginAttribute::Setter iSetter)
994 registerAttribute<MarginAttribute>(iName, iGetter, iSetter);
1001 typename RangeAttribute::Getter iGetter,
1002 typename RangeAttribute::Setter iSetter)
1004 registerAttribute<RangeAttribute>(iName, iGetter, iSetter);
1011 typename VectorStringAttribute::Getter iGetter,
1012 typename VectorStringAttribute::Setter iSetter,
1013 char iDelimiter =
',',
1014 bool iSkipEmptyEntries =
false)
1016 registerAttribute<VectorStringAttribute>(iName, iGetter, iSetter, iDelimiter, iSkipEmptyEntries);
1035 template<
typename T>
1037 typename ListAttribute<T>::Getter iGetter,
1038 typename ListAttribute<T>::Setter iSetter,
1041 registerAttribute<ListAttribute<T>>(iName, iGetter, iSetter, iAttributeValues);
1048 typename TagAttribute::Getter iGetter,
1049 typename TagAttribute::Setter iSetter)
1051 registerAttribute<TagAttribute>(iName, iGetter, iSetter);
1057 template<
typename TInt>
1059 typename IntegerAttribute<TInt>::Getter iGetter,
1060 typename IntegerAttribute<TInt>::Setter iSetter)
1062 registerAttribute<IntegerAttribute<TInt>>(iName, iGetter, iSetter);
1069 typename IntegerAttribute<int32_t>::Getter iGetter,
1070 typename IntegerAttribute<int32_t>::Setter iSetter)
1072 registerIntegerAttribute<int32_t>(iName, iGetter, iSetter);
1079 typename FloatAttribute<float>::Getter iGetter,
1080 typename FloatAttribute<float>::Setter iSetter)
1082 registerAttribute<FloatAttribute<float>>(iName, iGetter, iSetter);
1089 typename FloatAttribute<double>::Getter iGetter,
1090 typename FloatAttribute<double>::Setter iSetter)
1092 registerAttribute<FloatAttribute<double>>(iName, iGetter, iSetter);
1099 typename BooleanAttribute::Getter iGetter,
1100 typename BooleanAttribute::Setter iSetter)
1102 registerAttribute<BooleanAttribute>(iName, iGetter, iSetter);
1108 CView *
create(
const UIAttributes &attributes,
const IUIDescription *description)
const override 1110 #ifdef JAMBA_DEBUG_LOGGING 1111 DLOG_F(INFO,
"CustomViewCreator<%s>::create()", getViewName());
1114 return createCustomView<TView>(CRect(0, 0, 0, 0), attributes, description);
1121 bool apply(CView *view,
const UIAttributes &attributes,
const IUIDescription *description)
const override 1123 auto *tv = dynamic_cast<TView *>(view);
1128 for(
auto attribute : fAttributes)
1130 attribute.second->apply(tv, attributes, description);
1139 for(
auto attribute : fAttributes)
1141 attributeNames.emplace_back(attribute.first);
1149 auto iter = fAttributes.find(attributeName);
1150 if(iter != fAttributes.cend())
1152 return iter->second->getType();
1154 return kUnknownType;
1161 bool getAttributeValue(CView *iView,
1162 const std::string &iAttributeName,
1163 std::string &oStringValue,
1164 const IUIDescription *iDescription)
const override 1166 auto *cdv = dynamic_cast<TView *>(iView);
1171 auto iter = fAttributes.find(iAttributeName);
1172 if(iter != fAttributes.cend())
1174 return iter->second->getAttributeValue(cdv, iDescription, oStringValue);
1183 bool getPossibleListValues(
const std::string &iAttributeName, std::list<const std::string *> &iValues)
const override 1185 auto iter = fAttributes.find(iAttributeName);
1186 if(iter != fAttributes.cend())
1188 return iter->second->getPossibleListValues(iValues);
1197 template<
typename XView>
1206 assert(fAttributes.find(iAttribute->getName()) == fAttributes.cend());
1207 fAttributes[iAttribute->getName()] = std::move(iAttribute);
1213 template<
typename TViewAttribute,
typename... Args>
1215 typename TViewAttribute::Getter iGetter,
1216 typename TViewAttribute::Setter iSetter,
1219 std::shared_ptr<ViewAttribute> cva;
1220 cva.reset(
new TViewAttribute(iName, iGetter, iSetter, std::forward<Args>(iArgs)...));
1221 registerAttribute(cva);
1234 template<
typename T>
1237 template<
typename T>
1310 template<
typename TView,
typename TBaseView =
void>
1315 char const *iDisplayName =
nullptr,
1316 char const *iBaseViewName = VSTGUI::UIViewCreator::kCView) :
1319 if constexpr(impl::is_creator_ctor_detected<TBaseView>)
char const * fBaseViewName
Definition: CustomViewCreator.h:1227
BitmapAttribute(std::string const &iName, typename ByValAttribute< BitmapPtr >::Getter iGetter, typename ByValAttribute< BitmapPtr >::Setter iSetter)
Definition: CustomViewCreator.h:558
IViewCreator::AttrType getType() override
Definition: CustomViewCreator.h:517
CView * create(const UIAttributes &attributes, const IUIDescription *description) const override
This is the factory method which will instantiate the view.
Definition: CustomViewCreator.h:1108
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:1078
Inherit from this class to provide the factory for a custom view.
Definition: CustomViewCreator.h:1311
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:950
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:960
IViewCreator::AttrType getType() override
Definition: CustomViewCreator.h:607
IntegerAttribute(std::string const &iName, Getter iGetter, Setter iSetter)
Definition: CustomViewCreator.h:330
IViewCreator::AttrType getType() override
Definition: CustomViewCreator.h:467
Generic base class that implements the logic for a ViewAttribute that uses a getter and setter in TVi...
Definition: CustomViewCreator.h:164
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:806
Specialization for an float attribute (which can be a double or a float, etc..).
Definition: CustomViewCreator.h:370
TCustomViewCreator(char const *iViewName=nullptr, char const *iDisplayName=nullptr, char const *iBaseViewName=VSTGUI::UIViewCreator::kCView)
Definition: CustomViewCreator.h:893
Specialization for the margin attribute.
Definition: CustomViewCreator.h:646
ListAttribute(std::string const &iName, typename super_type::Getter iGetter, typename super_type::Setter iSetter, AttrValInitList< T > const &iAttributeValues)
Definition: CustomViewCreator.h:820
RangeAttribute(std::string const &iName, typename ByRefAttribute< Range >::Getter iGetter, typename ByRefAttribute< Range >::Setter iSetter)
Definition: CustomViewCreator.h:711
VectorStringAttribute(std::string const &iName, typename super_type::Getter iGetter, typename super_type::Setter iSetter, char iDelimiter=',', bool iSkipEmptyEntries=false)
Definition: CustomViewCreator.h:764
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:990
bool fromString(IUIDescription const *iDescription, std::string const &iAttributeValue, TFloat &oValue) const override
Definition: CustomViewCreator.h:387
FloatAttribute(std::string const &iName, Getter iGetter, Setter iSetter)
Definition: CustomViewCreator.h:377
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:936
IViewCreator::AttrType getType() override
Definition: CustomViewCreator.h:180
Specialization for a vector of strings.
Definition: CustomViewCreator.h:758
FontAttribute(std::string const &iName, typename ByValAttribute< FontPtr >::Getter iGetter, typename ByValAttribute< FontPtr >::Setter iSetter)
Definition: CustomViewCreator.h:601
TSetter Setter
Definition: CustomViewCreator.h:168
AttrType getAttributeType(const std::string &attributeName) const override
Definition: CustomViewCreator.h:1147
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:1036
Specialization for the range attribute.
Definition: CustomViewCreator.h:708
Specialization for a bitmap attribute.
Definition: CustomViewCreator.h:554
Specialization for an Integer attribute (which can be any kind of integer, like short,...
Definition: CustomViewCreator.h:323
CustomViewCreator(char const *iViewName=nullptr, char const *iDisplayName=nullptr, char const *iBaseViewName=VSTGUI::UIViewCreator::kCView)
Definition: CustomViewCreator.h:1314
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:120
TView * createCustomView(CRect const &iSize, const UIAttributes &iAttributes, const IUIDescription *)
Factory method which creates the actual view.
Definition: CustomViewCreator.h:107
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:1047
Specialization for the color attribute.
Definition: CustomViewCreator.h:415
TAttribute< T, T const &(StepButtonView ::*)() const, void(StepButtonView ::*)(T const &)> ByRefAttribute
ByRefAttribute defines getter/setter by const reference.
Definition: CustomViewCreator.h:255
bool fromString(IUIDescription const *iDescription, std::string const &iAttributeValue, TagID &oValue) const override
Definition: CustomViewCreator.h:276
ParamID TagID
Defining a type for tags.
Definition: Types.h:57
TAttribute(std::string const &iName, Getter iGetter, Setter iSetter)
Definition: CustomViewCreator.h:171
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:570
MarginAttribute(std::string const &iName, typename ByRefAttribute< Margin >::Getter iGetter, typename ByRefAttribute< Margin >::Setter iSetter)
Definition: CustomViewCreator.h:649
char const * fDisplayName
Definition: CustomViewCreator.h:1226
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:1121
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:67
bool getAttributeNames(std::list< std::string > &attributeNames) const override
Definition: CustomViewCreator.h:1137
CFontDesc * FontPtr
Definition: Types.h:53
AttrValMap< T > const fAttributeValuesMap
Definition: CustomViewCreator.h:885
Specialization for a tag attribute (vst type TagID).
Definition: CustomViewCreator.h:261
bool fromString(IUIDescription const *iDescription, std::string const &iAttributeValue, GradientPtr &oValue) const override
Definition: CustomViewCreator.h:473
TAttribute< T, T(StepButtonView ::*)() const, void(StepButtonView ::*)(T)> ByValAttribute
ByValAttribute defines getter/setter by value (copy)
Definition: CustomViewCreator.h:249
bool fromString(IUIDescription const *iDescription, std::string const &iAttributeValue, FontPtr &oValue) const override
Definition: CustomViewCreator.h:613
CCoord fTop
Definition: LookAndFeel.h:58
char const * fViewName
Definition: CustomViewCreator.h:1225
IViewCreator::AttrType getType() override
Definition: CustomViewCreator.h:564
ViewAttribute(std::string iName)
Definition: CustomViewCreator.h:54
IViewCreator::AttrType getType() override
Definition: CustomViewCreator.h:334
TagAttribute(std::string const &iName, typename ByValAttribute< TagID >::Getter iGetter, typename ByValAttribute< TagID >::Setter iSetter)
Definition: CustomViewCreator.h:264
bool apply(CView *iView, const UIAttributes &iAttributes, const IUIDescription *iDescription) override
Extracts the value from iAttributes for getName() attribute and "apply" it on the view provided.
Definition: CustomViewCreator.h:195
TGetter Getter
Definition: CustomViewCreator.h:167
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:99
IViewCreator::AttrType getType() override
Definition: CustomViewCreator.h:381
Specialization for the color attribute.
Definition: CustomViewCreator.h:456
constexpr auto is_creator_ctor_detected
Definition: CustomViewCreator.h:1238
Specialization for a bitmap attribute.
Definition: CustomViewCreator.h:597
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:980
std::map< std::string, T > AttrValMap
Defines a map of string to attribute value.
Definition: CustomViewCreator.h:114
void registerAttribute(std::shared_ptr< ViewAttribute > iAttribute)
Internal method to register an attribute...
Definition: CustomViewCreator.h:1203
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:1098
~TCustomViewCreator() override
Definition: CustomViewCreator.h:907
decltype(typename T::Creator()) creator_ctor_t
Definition: CustomViewCreator.h:1235
Definition: CustomController.h:24
bool fromString(IUIDescription const *iDescription, std::string const &iAttributeValue, bool &oValue) const override
Definition: CustomViewCreator.h:523
IdStringPtr getViewName() const override
Definition: CustomViewCreator.h:915
IViewCreator::AttrType getType() override
Definition: CustomViewCreator.h:426
std::map< std::string, std::shared_ptr< ViewAttribute > > fAttributes
Definition: CustomViewCreator.h:1230
bool fromString(IUIDescription const *iDescription, std::string const &iAttributeValue, Margin &oValue) const override
Definition: CustomViewCreator.h:655
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:1000
bool fromString(IUIDescription const *iDescription, std::string const &iAttributeValue, std::vector< std::string > &oValue) const override
Definition: CustomViewCreator.h:775
bool fSkipEmptyEntries
Definition: CustomViewCreator.h:807
CCoord fLeft
Definition: LookAndFeel.h:61
Specialization for a list of possible values defined by the AttributeMap
Definition: CustomViewCreator.h:814
IdStringPtr getBaseViewName() const override
Definition: CustomViewCreator.h:927
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:1058
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:1010
GradientAttribute(std::string const &iName, typename ByValAttribute< GradientPtr >::Getter iGetter, typename ByValAttribute< GradientPtr >::Setter iSetter)
Definition: CustomViewCreator.h:461
ColorAttribute(std::string const &iName, typename ByRefAttribute< CColor >::Getter iGetter, typename ByRefAttribute< CColor >::Setter iSetter)
Definition: CustomViewCreator.h:420
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:1068
UTF8StringPtr getDisplayName() const override
Definition: CustomViewCreator.h:921
bool fromString(IUIDescription const *iDescription, std::string const &iAttributeValue, CColor &oValue) const override
Definition: CustomViewCreator.h:432
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:189
Generic custom view creator base class.
Definition: CustomViewCreator.h:155
IViewCreator::AttrType getType() override
Definition: CustomViewCreator.h:833
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:1088
void registerAttribute(std::string const &iName, typename TViewAttribute::Getter iGetter, typename TViewAttribute::Setter iSetter, Args &&...iArgs)
Generic register attribute.
Definition: CustomViewCreator.h:1214
CBitmap * BitmapPtr
Definition: Types.h:49
Specialization for the boolean attribute.
Definition: CustomViewCreator.h:507
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:970
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:839
bool fromString(IUIDescription const *iDescription, std::string const &iAttributeValue, Range &oValue) const override
Definition: CustomViewCreator.h:717
BooleanAttribute(std::string const &iName, typename ByValAttribute< bool >::Getter iGetter, typename ByValAttribute< bool >::Setter iSetter)
Definition: CustomViewCreator.h:511
bool fromString(IUIDescription const *iDescription, std::string const &iAttributeValue, TInt &oValue) const override
Definition: CustomViewCreator.h:340
Base abstract class for an attribute of a view.
Definition: CustomViewCreator.h:50
IViewCreator::AttrType getType() override
Definition: CustomViewCreator.h:270
Setter fSetter
Definition: CustomViewCreator.h:242
CGradient * GradientPtr
Definition: Types.h:57