|
ubit
|
Color attribute of an element or a widget. More...
#include <ucolor.hpp>
Public Member Functions | |
| UColor () | |
| creates a solid black color. | |
| UColor (const UColor &color) | |
| creates a new color object that is a copy of 'color'. | |
| UColor (const UColor &color, float a) | |
| creates a new color object that is a copy of 'color' but with a different alpha. | |
| UColor (const UColor &color, unsigned int a) | |
| creates a new color object that is a copy of 'color' but with a different alpha. | |
| UColor (const URgba &) | |
| creates a new color object from a URgba value. | |
| UColor (float r, float g, float b, float a=1.0f) | |
| creates a new color object with a RGBA value; see also shortcut ucolor(r,g,b,a). More... | |
| UColor (unsigned int r, unsigned int g, unsigned int b, unsigned int a=255u) | |
| creates a new color object with a RGBA value; see also shortcut ucolor(r,g,b,a). More... | |
| UColor (const UStr &color_name, float a=1.) | |
| creates a new color object from a color name (see setNamedColor()). | |
| UColor & | operator= (const UColor &c) |
| changes color from another color. | |
| UColor & | setRgba (const URgba &) |
| changes color, arguments is a URgba struct. | |
| UColor & | setRgbaF (float r, float g, float b, float a=1.0f) |
| changes color, arguments are floats in range [0 - 1]. | |
| UColor & | setRgbaI (unsigned int r, unsigned int g, unsigned int b, unsigned int a=255u) |
| changes color, arguments are unsigned ints in range [0 - 255]. | |
| UColor & | setNamedColor (const UStr &color_name, float a=1.) |
| changes color, arguments are a color name and an alpha value in range [0,1]. More... | |
| const URgba & | getRgba () const |
| bool | operator== (const UColor &c) const |
| bool | operator!= (const UColor &c) const |
| virtual bool | equals (const UColor &) const |
| virtual bool | equals (const URgba &) const |
| virtual bool | equals (float r, float g, float b, float a) const |
| virtual bool | equals (unsigned int r, unsigned int g, unsigned int b, unsigned int a) const |
| virtual void | update () |
| updates parents graphics. | |
| virtual void | putProp (UUpdateContext *, UElem &) |
| [impl] changes corresponding value in the UUpdateContext | |
Public Member Functions inherited from ubit::UAttr | |
| UAttr (UConst) | |
| virtual UAttr * | toAttr () |
| dynamic cast: returns this object if it derives from UAttr and null otherwise. | |
| virtual const UAttr * | toAttr () const |
| dynamic cast: returns this object if it derives from UAttr and null otherwise. | |
| virtual int | getDisplayType () const |
| virtual int | getNodeType () const |
| returns the XML node type. | |
| virtual const UStr & | getNodeName () const |
| returns the name of this attribute (calls getName()). | |
| virtual UStr | getNodeValue () const |
| returns the value of this attribute (calls getValue()). | |
| virtual const UStr & | getName () const |
| returns the name of this attribute. | |
| virtual bool | getValue (UStr &value) const |
| gets the value of this attribute. More... | |
| virtual void | setValue (const UStr &value) |
| changes the value of this attribute does nothing if not applicable for a given subclass. | |
| virtual void | initNode (UDoc *, UElem *parent) |
| called when the document is created. | |
| virtual UAttr & | onChange (UCall &) |
| adds a callback that is fired when the value of the property is modified. More... | |
| UAttr & | setConst () |
| virtual void | changed (bool update=true) |
| [impl] called when object's content is changed. More... | |
Public Member Functions inherited from ubit::UNode | |
| virtual int | isDisplayable () const |
| virtual UNode * | toNode () |
| dynamic cast: returns this object if it derives from UNode and null otherwise. | |
| virtual const UNode * | toNode () const |
| dynamic cast: returns this object if it derives from UNode and null otherwise. | |
| virtual bool | isChildOf (const UElem &parent, bool indirect=true) const |
| returns true if this object a child of 'parent'. More... | |
| UParentIter | pbegin () const |
| returns an iterator to the beginning of the list of direct parents. More... | |
| UParentIter | pend () const |
| returns an iterator to the end of the parent list ( More... | |
| virtual UParents & | parents () const |
| returns the list of direct parents ( More... | |
| virtual UElem * | getParent (int pos=0) const |
| returns the Nth direct parent. More... | |
| virtual bool | hasSceneGraphParent () const |
| template<class CC > | |
| CC * | findParent () const |
| < this object has at least one parent in the scene graph. More... | |
| virtual int | getBoxParents (std::vector< UBox *> &parvect) const |
| retrieves direct and indirect parents that are boxes. | |
| virtual UBox * | getParent (const UView *) const |
| returns the direct or indirect parent that contains this view. More... | |
| virtual UView * | getParentView (const UView *) const |
| returns the direct or indirect parent's view that contains this view. More... | |
| virtual UBox * | getParent (const UInputEvent &) const |
| virtual UView * | getParentView (const UInputEvent &) const |
| virtual void | removeFromParents (bool update_parents=true) |
| [impl] removes this object from all direct parents. More... | |
| virtual bool | fire (UEvent &) const |
| fires callback functions that match this event. | |
| virtual UNode & | removeAllAttrs (bool autodel=true) |
| removes all attributes (if any, redefined by subclasses). | |
| bool | isAutoUpdate () const |
| return current update policy: see setAutoUpdate(). | |
| UNode & | setAutoUpdate (bool state=true) |
| changes the update policy of this object when its is modified. More... | |
| void | fireParents (const UCond &c, UNode *n) const |
| void | updateAutoParents (const UUpdate &m) |
| virtual void | addChangeCall (UCall &) |
| virtual UElem * | getSubGroup () const |
| void | _addAttr (const UChild &attribute) |
| [impl] to be removed @. | |
| UChildIter | _abegin () const |
| [impl] to be removed @. | |
| UChildIter | _aend () const |
| [impl] to be removed @. | |
Public Member Functions inherited from ubit::UObject | |
| UObject (const UObject &) | |
| UObject & | operator= (const UObject &) |
| virtual const UClass & | getClass () const |
| instance method that returns the metaclass of this object. More... | |
| const UStr & | getClassName () const |
| returns getClass().getName(). | |
| virtual void | error (const char *function_name, const char *format,...) const |
| prints out an error message. More... | |
| virtual void | warning (const char *function_name, const char *format,...) const |
| prints out a warning message: More... | |
| bool | isDeletable () const |
| checks if this object can be destroyed by 'delete'. More... | |
| bool | isConst () const |
| checks whether the content of this object can be modified ( More... | |
| UObject & | setConst () |
| specifies that the content of this object cannot be modified. More... | |
| bool | isAutoUpdate () const |
| return current update policy: More... | |
| UObject & | setAutoUpdate (bool state=true) |
| changes the update policy of this object when its is modified. More... | |
| bool | isIgnoringChangeCallbacks () const |
| return true if change callbacks are fired. | |
| UObject & | ignoreChangeCallbacks (bool state) |
| change callbacks are not fired if argument is true. | |
| virtual UElem * | toElem () |
| dynamic cast: returns this object if it derives from UElem and null otherwise. | |
| virtual const UElem * | toElem () const |
| dynamic cast: returns this object if it derives from UElem and null otherwise. | |
| virtual UData * | toData () |
| dynamic cast: returns this object if it derives from UData and null otherwise. | |
| virtual const UData * | toData () const |
| dynamic cast: returns this object if it derives from UData and null otherwise. | |
| virtual UStr * | toStr () |
| dynamic cast: returns this object if it derives from UStr and null otherwise. | |
| virtual const UStr * | toStr () const |
| dynamic cast: returns this object if it derives from UStr and null otherwise. | |
| virtual UCall * | toCall () |
| dynamic cast: returns this object if it derives from UCall and null otherwise. | |
| virtual const UCall * | toCall () const |
| dynamic cast: returns this object if it derives from UCall and null otherwise. | |
| virtual UBox * | toBox () |
| dynamic cast: returns this object if it derives from UBox and null otherwise. | |
| virtual const UBox * | toBox () const |
| dynamic cast: returns this object if it derives from UBox and null otherwise. | |
| virtual UWin * | toWin () |
| dynamic cast: returns this object if it derives from UWin and null otherwise. | |
| virtual const UWin * | toWin () const |
| dynamic cast: returns this object if it derives from UWin and null otherwise. | |
| virtual UMenu * | toMenu () |
| dynamic cast: returns this object if it derives from UMenu and null otherwise. | |
| virtual const UMenu * | toMenu () const |
| dynamic cast: returns this object if it derives from UMenu and null otherwise. | |
| State | getState () const |
| returns the current object state. | |
| void | setState (State s) |
| changes the object state. | |
| PtrCount | getPtrCount () const |
| [impl] returns the number of uptr<> smart pointers that are pointing to this object. | |
| bool | checkConst () const |
| [impl] produces an error if this object is logically constant ( More... | |
| bool | isDestructed () const |
| [impl] this object has been destructed (but memory has not been freed yet). | |
| bool | isDestructing () const |
| [impl] this object is being destructed (one of its destructors has been called). | |
| void * | operator new (size_t) |
| < [impl] returns true if there is at least one scene graph parent (redefined by UNode). More... | |
| void | operator delete (void *) |
| delete operator is forbidden on instances that derive from UObject. | |
| void | addPtr () const |
| [Impl] a uptr is added to this object. | |
| void | removePtr () const |
| [Impl] a uptr is removed from this object. | |
Static Public Member Functions | |
| static void | addNamedColor (const char *name, const URgba &) |
| adds a color to the database of named colors. | |
| static bool | parseColor (const char *name, URgba &) |
| returns the URgba corresponding to this color name, if found. | |
Static Public Member Functions inherited from ubit::UObject | |
| static const char * | getVersion () |
| returns the version of the Ubit package. | |
| static const UClass & | Class () |
| class method that returns the metaclass of this class. More... | |
| static UStyle * | createStyle () |
Static Public Attributes | |
| static UColor | none |
| static UColor | inherit |
| static UColor | white |
| static UColor | black |
| static UColor | grey |
| static UColor | lightgrey |
| static UColor | darkgrey |
| static UColor | navy |
| static UColor | lightblue |
| static UColor | blue |
| static UColor | red |
| static UColor | green |
| static UColor | yellow |
| static UColor | orange |
| static UColor | wheat |
| static UColor | teal |
| static UColor | disabled |
| predefined colors. More... | |
Static Public Attributes inherited from ubit::UObject | |
| static UConst | UCONST |
| UCONST can be given as an argument to some constructors to make the object constant. More... | |
Protected Member Functions | |
| UColor (unsigned int r, unsigned int g, unsigned int b, unsigned int a, UConst) | |
| UColor (unsigned char special, UConst) | |
Protected Member Functions inherited from ubit::UNode | |
| UNode () | |
| constructor, can anly be called by subclasses because UNode is abstract. | |
| virtual | ~UNode () |
| destructor, note that children are recursively destroyed except if pointed elsewhere ( More... | |
| virtual void | addingTo (UChild &, UElem &parent) |
| called when this object is added to a parent. | |
| virtual void | removingFrom (UChild &, UElem &parent) |
| called when this object is removed from a parent (SEE DETAILS IF YOU REDEFINE THIS METHOD). More... | |
| virtual void | destructs () |
| unlinks the object from its parents and destroys its children. | |
Protected Attributes | |
| URgba | rgba |
Protected Attributes inherited from ubit::UNode | |
| UParents | _parents |
| UChildren | _attributes |
Protected Attributes inherited from ubit::UObject | |
| PtrCount | ptr_count |
| Modes | omodes |
| State | ostate |
Friends | |
| class | UGraph |
Additional Inherited Members | |
Public Types inherited from ubit::UNode | |
| enum | NodeType { ELEMENT_NODE = 1, ATTRIBUTE_NODE = 2, TEXT_NODE = 3, CDATA_SECTION_NODE = 4, ENTITY_REFERENCE_NODE = 5, ENTITY_NODE = 6, PROCESSING_INSTRUCTION_NODE = 7, COMMENT_NODE = 8, DOCUMENT_NODE = 9, DOCUMENT_TYPE_NODE = 10, DOCUMENT_FRAGMENT_NODE = 11, NOTATION_NODE = 12 } |
| redefines Class() and getClass() methods ( More... | |
| enum | DisplayType { WINLIST =-1, UNDISPLAYBLE =0, ATTRIBUTE, DATA, INLINE, BLOCK, BORDER, HARDWIN, SOFTWIN } |
| Ubit display types. | |
Public Types inherited from ubit::UObject | |
| typedef unsigned char | State |
| typedef short | PtrCount |
Color attribute of an element or a widget.
This attributes specifies the foreground color of an object that derives from UElem (i.e. element nodes and widgets). This color will be inherited by the children of this element if they dont't specify a color of their own.
UColor attributes can either be added to the element's attribute or child list.
The alpha value is ignored if OpenGL is not used: see UAppli::isUsingGL().
| ubit::UColor::UColor | ( | float | r, |
| float | g, | ||
| float | b, | ||
| float | a = 1.0f |
||
| ) |
creates a new color object with a RGBA value; see also shortcut ucolor(r,g,b,a).
r,g,b,a are floats in the range [0 - 1]. To avoid ambiguities, they MUST be explicitely specified as floats, for instance: UColor(1f, 0f, 0f, 0.5f).
| ubit::UColor::UColor | ( | unsigned int | r, |
| unsigned int | g, | ||
| unsigned int | b, | ||
| unsigned int | a = 255u |
||
| ) |
creates a new color object with a RGBA value; see also shortcut ucolor(r,g,b,a).
r,g,b,a are unsigned integers in the range [0 - 255]. To avoid ambiguities, they MUST be explicitely specified as unsigned ints, e.g.: UColor(255u, 0u, 0u, 125u).
changes color, arguments are a color name and an alpha value in range [0,1].
'color_name' can be on of the following:
|
static |
predefined colors.
the value of these color are predefined and unmutable (attempting to change them would produce an error)
1.8.12