ubit
Public Types | Public Member Functions | Static Public Attributes | Friends | List of all members
ubit::UFont Class Reference

Font of a UElem or UBox container. More...

#include <ufont.hpp>

Inheritance diagram for ubit::UFont:
ubit::UAttr ubit::UNode ubit::UObject ubit::UHtmlFontFace ubit::UHtmlFontSize

Public Types

enum  Style {
  PLAIN = 0, BOLD = 1<<0, ITALIC = 1<<1, FILL = 1<<2,
  UNDERLINE = 1<<3, OVERLINE = 1<<4, STRIKETHROUGH = 1<<5
}
 
- 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
 

Public Member Functions

 UFont ()
 create a new UFont; More...
 
 UFont (const UFont &)
 create a new UFont; More...
 
 UFont (const UFont &font, int style, float pixel_size)
 create a new UFont. More...
 
 UFont (const UFontFamily &, int style, float point_size)
 create a new UFont. More...
 
virtual UFontoperator= (const UFont &f)
 copies font.
 
virtual void set (const UFont &)
 copies font.
 
virtual bool operator== (const UFont &f) const
 
virtual bool operator!= (const UFont &f) const
 
virtual bool equals (const UFont &) const
 compares fonts.
 
const UFontFamilygetFamily () const
 returns the font family.
 
float getPixelSize () const
 returns the font size (in pixels).
 
float getPointSize () const
 returns the font size (in points).
 
int getStyles () const
 returns the font styles.
 
UFontsetFamily (const UFontFamily &)
 changes the font family.
 
UFontsetFamily (const UStr &font_families)
 changes the font family (takes the closest one in a comma separated list).
 
UFontsetSize (const UStr &size)
 changes the font size.
 
UFontsetPixelSize (float pixel_size)
 changes the font size (in pixels).
 
UFontsetPointSize (float point_size)
 changes the font size (in points).
 
UFontsetStyles (int styles)
 changes the font styles.
 
UFontchangeStyles (int styles, bool add)
 changes the font style. More...
 
bool isPlain () const
 
bool isBold () const
 
bool isItalic () const
 
bool isFilled () const
 
bool isUnderlined () const
 
bool isOverlined () const
 
bool isStrikethrough () const
 
UFontsetBold (bool=true)
 
UFontsetItalic (bool=true)
 
UFontsetFilled (bool=true)
 
UFontsetUnderlined (bool=true)
 
UFontsetOverlined (bool=true)
 
UFontsetStrikethrough (bool=true)
 
void merge (const UFont &)
 merge font characteristics. More...
 
virtual void update ()
 update parents' graphics.
 
virtual void realize (UDisp *)
 [impl] allocates physical resources. More...
 
virtual void putProp (UUpdateContext *, UElem &)
 [impl] changes corresponding value in the UUpdateContext
 
- Public Member Functions inherited from ubit::UAttr
 UAttr (UConst)
 
virtual UAttrtoAttr ()
 dynamic cast: returns this object if it derives from UAttr and null otherwise.
 
virtual const UAttrtoAttr () 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 UStrgetNodeName () const
 returns the name of this attribute (calls getName()).
 
virtual UStr getNodeValue () const
 returns the value of this attribute (calls getValue()).
 
virtual const UStrgetName () 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 UAttronChange (UCall &)
 adds a callback that is fired when the value of the property is modified. More...
 
UAttrsetConst ()
 
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 UNodetoNode ()
 dynamic cast: returns this object if it derives from UNode and null otherwise.
 
virtual const UNodetoNode () 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 UParentsparents () const
 returns the list of direct parents ( More...
 
virtual UElemgetParent (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 UBoxgetParent (const UView *) const
 returns the direct or indirect parent that contains this view. More...
 
virtual UViewgetParentView (const UView *) const
 returns the direct or indirect parent's view that contains this view. More...
 
virtual UBoxgetParent (const UInputEvent &) const
 
virtual UViewgetParentView (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 UNoderemoveAllAttrs (bool autodel=true)
 removes all attributes (if any, redefined by subclasses).
 
bool isAutoUpdate () const
 return current update policy: see setAutoUpdate().
 
UNodesetAutoUpdate (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 UElemgetSubGroup () 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 &)
 
UObjectoperator= (const UObject &)
 
virtual const UClassgetClass () const
 instance method that returns the metaclass of this object. More...
 
const UStrgetClassName () 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...
 
UObjectsetConst ()
 specifies that the content of this object cannot be modified. More...
 
bool isAutoUpdate () const
 return current update policy: More...
 
UObjectsetAutoUpdate (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.
 
UObjectignoreChangeCallbacks (bool state)
 change callbacks are not fired if argument is true.
 
virtual UElemtoElem ()
 dynamic cast: returns this object if it derives from UElem and null otherwise.
 
virtual const UElemtoElem () const
 dynamic cast: returns this object if it derives from UElem and null otherwise.
 
virtual UDatatoData ()
 dynamic cast: returns this object if it derives from UData and null otherwise.
 
virtual const UDatatoData () const
 dynamic cast: returns this object if it derives from UData and null otherwise.
 
virtual UStrtoStr ()
 dynamic cast: returns this object if it derives from UStr and null otherwise.
 
virtual const UStrtoStr () const
 dynamic cast: returns this object if it derives from UStr and null otherwise.
 
virtual UCalltoCall ()
 dynamic cast: returns this object if it derives from UCall and null otherwise.
 
virtual const UCalltoCall () const
 dynamic cast: returns this object if it derives from UCall and null otherwise.
 
virtual UBoxtoBox ()
 dynamic cast: returns this object if it derives from UBox and null otherwise.
 
virtual const UBoxtoBox () const
 dynamic cast: returns this object if it derives from UBox and null otherwise.
 
virtual UWintoWin ()
 dynamic cast: returns this object if it derives from UWin and null otherwise.
 
virtual const UWintoWin () const
 dynamic cast: returns this object if it derives from UWin and null otherwise.
 
virtual UMenutoMenu ()
 dynamic cast: returns this object if it derives from UMenu and null otherwise.
 
virtual const UMenutoMenu () 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 Attributes

static UFont sans_serif
 
static UFont serif
 
static UFont monospace
 default font family modifiers.
 
static UFont xx_small
 
static UFont x_small
 
static UFont small
 
static UFont medium
 
static UFont large
 
static UFont x_large
 
static UFont xx_large
 default font size modifiers.
 
static UFont plain
 
static UFont bold
 
static UFont italic
 
static UFont fill
 
static UFont underline
 
static UFont overline
 
static UFont strikethrough
 font style modifiers. 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...
 

Friends

class UDisp
 
class UFontDesc
 

Additional Inherited Members

- Static Public Member Functions inherited from ubit::UObject
static const char * getVersion ()
 returns the version of the Ubit package.
 
static const UClassClass ()
 class method that returns the metaclass of this class. More...
 
static UStylecreateStyle ()
 
- 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 inherited from ubit::UNode
UParents _parents
 
UChildren _attributes
 
- Protected Attributes inherited from ubit::UObject
PtrCount ptr_count
 
Modes omodes
 
State ostate
 

Detailed Description

Font of a UElem or UBox container.

this property specifies the font in a UElem or a UBox. It is inherited by children, except if they have their own UFont, or if their UStyle specifies another font. As other UAttr(s), a UScale instance must be added to the attribute list or child list of the container:

See also
: UAttr.

Constructor & Destructor Documentation

§ UFont() [1/4]

UFont::UFont ( )

create a new UFont;

See also
also shortcut ufont().

§ UFont() [2/4]

ubit::UFont::UFont ( const UFont )

create a new UFont;

See also
also shortcut ufont().

§ UFont() [3/4]

ubit::UFont::UFont ( const UFont font,
int  style,
float  pixel_size 
)

create a new UFont.

keeps the same characteristics as 'font' with a specific 'style' and 'point_size' style' is an ORed combination of UFont::FontStyle constants such as BOLD|ITALIC or -BOLD|-ITALIC (negative values deactivate these styles)

See also
also shortcut ufont().

§ UFont() [4/4]

ubit::UFont::UFont ( const UFontFamily ,
int  style,
float  point_size 
)

create a new UFont.

style' is an ORed combination of UFont::FontStyle constants such as BOLD|ITALIC or -BOLD|-ITALIC (negative values deactivate these styles)

See also
also shortcut ufont().

Member Function Documentation

§ changeStyles()

UFont & UFont::changeStyles ( int  styles,
bool  add 
)

changes the font style.

'styles' is an ORed bitmask of UFont::Style values 'styles' can be negative, which means 'disable these styles'

§ merge()

void UFont::merge ( const UFont f)

merge font characteristics.

sets NON default values and combines styles

§ realize()

void UFont::realize ( UDisp d)
virtual

[impl] allocates physical resources.

this function is automatically called when this font is used for the first time. There no need to call it in client code except for loading fonts in advance.

  • note: the argument can be the UAppli (the Application Context)

Member Data Documentation

§ strikethrough

UFont UFont::strikethrough
static

font style modifiers.

  • 'plain' means not bold, not italic, not underlined
  • mofifiers can be combined: example:
       ubox( UFont::bold + UFont::italic + "abcd" )  

The documentation for this class was generated from the following files: