Base class of variable Props. More...
Public Types | |
using | Specif = int32_t |
Specificity of Properties. | |
Public Member Functions | |
GVarProp * | toVarProp () override |
Type conversions. | |
bool | isMutable () const override |
Returns true if the prop is mutable. More... | |
void | setImmutable () override |
Makes the prop immutable. More... | |
virtual void | set (GString const &value)=0 |
Changes value. | |
virtual void | set (GProp const &value)=0 |
Changes value. More... | |
virtual void | blend (GProp const &value1, GProp const &value2, float mix) |
Changes value by blending the value of two props. More... | |
void | blink (GString const &msg="", GTime duration=500) |
Blinks gadget parents of the prop. More... | |
void | update () |
updates gadget parents of the prop. | |
void | perform (std::function< void(Gadget &)> fun) |
performs this function on gadget parents. | |
GPropList const & | props () const |
Returns callbacks and bound props. | |
virtual void | removeNotifiers (void *object) override |
[Implementation] Notifies this object that it must no longer refer obj. | |
virtual void | removeAll () |
Removes callbacks and notifiers. | |
virtual GProp * | clone (bool copy_value) const |
Clones the prop (when applicable). More... | |
virtual GString | stringValue () const |
Returns the value of the prop as a string. More... | |
virtual float | floatValue () const |
Returns the value of the prop as a float. More... | |
virtual bool | boolValue () const |
Returns the value as a bool. More... | |
virtual bool | isEquivalent (GProp const &other) const |
Returns true if these props are equivalent. More... | |
virtual bool | onAdd (Gadget *) |
Called when the property is added to an object. More... | |
virtual void | onRemove (Gadget *) |
Called when the property is removed from an object. More... | |
virtual void | error (GString const &funname, GString const &message) const |
Prints an error message. More... | |
void | operator delete (void *) |
delete does nothing, see GObject class. | |
void | forgetSmartPointers () |
Forgets all smart pointers pointing this object. More... | |
unsigned int | useCount () const |
Returns the numbers of smart pointers referencing the object. | |
void | unbind (GVarProp &sender) |
Unbinds this prop. More... | |
GString | typeName () const override |
Returns the name and role of the prop's type. | |
GProp * | toProp () override |
Class conversions. | |
bool | write (GString const &filename) const |
Writes the value of the prop on a file or a stream. | |
template<class Subclass > | |
Subclass * | to () |
Class conversions. | |
void | ignoreSmartPointers () |
Checks/sets whether this object can be auto-deleted by smart pointers. More... | |
using | GType = GPropType |
Returns prop's meta-class. More... | |
bool | read (GString const &filename) |
Reads the value of the prop from a file or a stream. | |
Base class of variable Props.
The value of these props can be changed:
For instance, (3) means that txt must verify the isValid() condition of num. So, if num is constrained by a range (see GFloat::setRange()), txt will always be in this range. Moreover, if txt is added to a TextField or a TextArea, the user will be forced to enter a numerical value lying in this range:
Finally, one can also just write:
An internal Text prop is then created and synced with num, so that this code is equivalent to the previous except.
|
inherited |
Returns prop's meta-class.
Both functions return the prop's type, but Type() is a static method and type() a virtual method.
|
inlineoverridevirtual |
Returns true if the prop is mutable.
Returns true only if the prop derives from GVarProp and setImmutable() was not called. Props with another type than GVarProp are always immutable.
Reimplemented from guit::GProp.
|
inlineoverridevirtual |
Makes the prop immutable.
Affects only GVarProp props (other props are always immutable). A prop cannot be made mutable again after this method has been called.
Reimplemented from guit::GProp.
|
pure virtual |
Changes value.
Does nothing if the type of from is not convertible to the type of this prop.
Implemented in guit::GVarProp_< T >, guit::GVarProp_< GMarginValue >, guit::GVarProp_< GFlexValue >, guit::GVarProp_< GSizeValue >, guit::GVarProp_< GIconValue >, guit::GVarProp_< GFontValue >, guit::GVarProp_< GGapValue >, guit::GVarProp_< GPosValue >, guit::GVarProp_< GRgba >, guit::GVarProp_< GBorderValue >, guit::GVarProp_< bool >, guit::GVarProp_< GString >, guit::GVarProp_< GFormatValue >, guit::GVarProp_< GAlignValue >, guit::GVarProp_< GFlowValue >, guit::GPos, guit::GSize, guit::GText, and guit::GBool.
Changes value by blending the value of two props.
Does nothing if the type of from1 or from2 is not convertible to the type of this prop.
Reimplemented in guit::GColor, guit::GPos, and guit::GSize.
void guit::GVarProp::unbind | ( | GVarProp & | sender) |
Unbinds this prop.
Importantly, these methods unbinds props both ways if the binding was done both ways (e.g. by using sync())
void guit::GVarProp::blink | ( | GString const & | msg = "" , |
GTime | duration = 500 |
||
) |
Blinks gadget parents of the prop.
Shows a warning if msg is not empty.
|
inlinevirtualinherited |
Clones the prop (when applicable).
Mutable props (i.e. deriving from GVarProp) can be cloned, otherwise this method returns null. The value is copied if copy_value is used, the default value is used otherwise.
Reimplemented in guit::GTextData, guit::GTip, guit::GBackground, guit::GRelativePos, guit::GCond, guit::GRegText, guit::GDragPos, guit::GDragSize, guit::GExpr, guit::GBorder, guit::GCheck, guit::GColor, guit::GFont, guit::GFlex, guit::GPos, guit::GSize, guit::GFlow, guit::GIcon, guit::GState, guit::GMargin, guit::GShow, guit::GFormat, guit::GCursor, guit::GGap, guit::GAnim, guit::GChoice, guit::GBool, guit::GFloat, guit::GInt, guit::GText, guit::GEnable, and guit::GHotkey.
|
inlinevirtualinherited |
Returns the value of the prop as a string.
Returns "" if the prop has no value of its value cannot be converted to a string.
Reimplemented in guit::GNumExpr, guit::GTextExpr, guit::GBoolExpr, guit::GOtherwise, guit::GGuard, guit::GVarProp_< T >, guit::GVarProp_< GMarginValue >, guit::GVarProp_< GFlexValue >, guit::GVarProp_< GSizeValue >, guit::GVarProp_< GIconValue >, guit::GVarProp_< GFontValue >, guit::GVarProp_< GGapValue >, guit::GVarProp_< GPosValue >, guit::GVarProp_< GRgba >, guit::GVarProp_< GBorderValue >, guit::GVarProp_< bool >, guit::GVarProp_< GString >, guit::GVarProp_< GFormatValue >, guit::GVarProp_< GAlignValue >, guit::GVarProp_< GFlowValue >, guit::GCond, guit::GExpr, guit::GState, guit::GAnim, and guit::GText.
|
inlinevirtualinherited |
Returns the value of the prop as a float.
Returns 0.f if the prop has no value of its value cannot be converted to a float.
Reimplemented in guit::GNumExpr, guit::GTextExpr, guit::GBoolExpr, guit::GExpr, guit::GState, guit::GText, and guit::GBool.
|
inlinevirtualinherited |
Returns the value as a bool.
Returns false if the prop has no value of its value cannot be converted to a bool.
Reimplemented in guit::GNumExpr, guit::GTextExpr, guit::GBoolExpr, guit::GExpr, and guit::GBool.
|
virtualinherited |
Returns true if these props are equivalent.
Adding a prop to a gadget replaces the equivalent prop it contains (if it contains any). In all other cases, the prop is added to the gadget proplist. NOTE: props with a negative role are never equivalent!
Reimplemented in guit::GExpr, guit::GCond, guit::GState, and guit::GAnim.
|
virtualinherited |
Called when the property is added to an object.
note: must call addModes().
Reimplemented in guit::GTextData, guit::GTip, guit::GCond, guit::GDragPos, guit::GDragSize, guit::GPos, guit::GText, guit::GSize, guit::GFlex, guit::GFlow, guit::GItems, and guit::GValue.
|
virtualinherited |
Called when the property is removed from an object.
note: must call removeModes().
Reimplemented in guit::GTextData, guit::GTip, guit::GCond, guit::GDragPos, guit::GDragSize, guit::GPos, guit::GText, guit::GSize, guit::GFlex, and guit::GHotkey.
|
virtualinherited |
Prints an error message.
|
inlineinherited |
Checks/sets whether this object can be auto-deleted by smart pointers.
ignoreSmartPointers() has a permanent effect, contrary to forgetSmartPointers(). Objects not created by calling new are never auto-deleted by smart pointers.
|
inlineinherited |
Forgets all smart pointers pointing this object.
The smart pointers that are currently pointing to the object won't auto-delete it. forgetSmartPointers() has a temporary effect, contrary to ignoreSmartPointers().