The Gnome Chemistry Utils  0.14.0
Public Member Functions | Static Public Member Functions | List of all members
gccv::Text Class Reference

Text. More...

#include <text.h>

Inheritance diagram for gccv::Text:
gccv::Rectangle gccv::FillItem gccv::LineItem gccv::Item

Public Member Functions

 Text (Canvas *canvas, double x, double y)
 Text (Group *parent, double x, double y, ItemClient *client=NULL)
virtual ~Text ()
void SetPosition (double x, double y)
void SetText (char const *text)
void SetText (std::string const &text)
void SetFontDescription (PangoFontDescription *desc)
void SetColor (GOColor color)
void SetEditing (bool editing)
void GetBounds (Rect *ink, Rect *logical)
char const * GetText ()
void InsertTextTag (TextTag *tag, bool rebuild_attributes=true)
void DeleteTextTag (TextTag *tag, bool rebuild_attributes=true)
std::list< TextTag * > const * GetTags ()
void SetCurTagList (TextTagList *l)
void ApplyTagsToSelection (TextTagList const *l)
void ReplaceText (std::string &str, int pos, unsigned length)
void Draw (cairo_t *cr, bool is_vector) const
void Move (double x, double y)
bool OnKeyPressed (GdkEventKey *event)
bool OnKeyReleased (GdkEventKey *event)
void OnButtonPressed (double x, double y)
void OnDrag (double x, double y)
unsigned GetDefaultFontSize ()
void RebuildAttributes ()
void SetInterline (double interline, bool emit_changed=false)
void SetJustification (GtkJustification justification, bool emit_changed=false)
void SetPadding (double val)
double GetPadding (void) const
void SetAnchor (Anchor val)
Anchor GetAnchor (void) const
void SetLineOffset (double val)
double GetLineOffset (void) const
GtkJustification GetJustification (void) const
double GetInterline (void) const
double GetWidth (void) const
double GetHeight (void) const
double GetAscent (void) const
double GetY (void) const
- Public Member Functions inherited from gccv::Rectangle
 Rectangle (Canvas *canvas, double x, double y, double width, double height)
 Rectangle (Group *parent, double x, double y, double width, double height, ItemClient *client=NULL)
virtual ~Rectangle ()
void SetPosition (double x, double y, double width, double height)
void GetPosition (double &x, double &y) const
void GetPosition (double &x, double &y, double &width, double &height) const
double Distance (double x, double y, Item **item) const
- Public Member Functions inherited from gccv::FillItem
 FillItem (Canvas *canvas)
 FillItem (Group *parent, ItemClient *client=NULL)
virtual ~FillItem ()
void SetFillColor (GOColor val)
GOColor GetFillColor (void) const
- Public Member Functions inherited from gccv::LineItem
 LineItem (Canvas *canvas)
 LineItem (Group *parent, ItemClient *client=NULL)
virtual ~LineItem ()
GOColor GetEffectiveLineColor () const
void ApplyLine (cairo_t *cr) const
void SetDashes (double const *dashes, int num_dashes, double offset)
void SetLineWidth (double val)
double GetLineWidth (void) const
void SetLineColor (GOColor val)
GOColor GetLineColor (void) const
void SetAutoColor (bool val)
bool GetAutoColor (void) const
- Public Member Functions inherited from gccv::Item
 Item (Canvas *canvas)
 Item (Group *parent, ItemClient *client=NULL)
virtual ~Item ()
void GetBounds (double &x0, double &y0, double &x1, double &y1) const
void Invalidate () const
void SetVisible (bool visible)
virtual void BuildPath (cairo_t *cr) const
virtual bool Draw (cairo_t *cr, double x0, double y0, double x1, double y1, bool is_vector) const
bool IsTopLevel () const
void SetClient (ItemClient *val)
ItemClientGetClient (void)
Group const * GetParent (void) const
bool GetVisible (void) const
void SetOperator (cairo_operator_t val)
cairo_operator_t GetOperator (void) const

Static Public Member Functions

static PangoContext * GetContext ()

Additional Inherited Members

- Protected Member Functions inherited from gccv::Rectangle
void UpdateBounds ()
- Protected Attributes inherited from gccv::Item
double m_x0
double m_y0
double m_x1
double m_y1

Detailed Description

Text.

The Text item class is used to display text in the canvas.

Definition at line 79 of file gccv/text.h.

Constructor & Destructor Documentation

gccv::Text::Text ( Canvas canvas,
double  x,
double  y 
)
Parameters
canvasa Canvas.
xthe horizontal position.
ythe vertical position.

Creates a new Text sets it as a child of the root Group of canvas. Interpretation of the values x and y relies on the text anchor.

gccv::Text::Text ( Group parent,
double  x,
double  y,
ItemClient client = NULL 
)
Parameters
parentthe Group to which the new Text will be added.
xthe top left corner horizontal position.
ythe top left corner vertical position.
clientthe ItemClient for the new Text if any.

Creates a new Text inside parent and sets client as its associated ItemClient. Interpretation of the values x and y relies on the text anchor.

virtual gccv::Text::~Text ( )
virtual

The destructor.

Member Function Documentation

void gccv::Text::ApplyTagsToSelection ( TextTagList const *  l)
Parameters
ltext tags.

Apply the tags list to the current selection.

void gccv::Text::DeleteTextTag ( TextTag tag,
bool  rebuild_attributes = true 
)
Parameters
taga TextTag
rebuild_attributeswhether to rebuild the PangoAttrList for the text.

Removes an existing TextTag.

void gccv::Text::Draw ( cairo_t *  cr,
bool  is_vector 
) const
virtual
Parameters
cra cairo_t.
is_vectorwhether the cairo_t is a vectorial context.

Draws the Text to cr.

Reimplemented from gccv::Rectangle.

gccv::Text::GetAnchor ( void  ) const
inline
Returns
the Text Anchor.

Definition at line 317 of file gccv/text.h.

gccv::Text::GetAscent ( void  ) const
inline
Returns
the Text first line ascent.

Definition at line 348 of file gccv/text.h.

void gccv::Text::GetBounds ( Rect ink,
Rect logical 
)
Parameters
inkwhere to store the ink bounds, might be NULL.
logicalwhere to store the logical bounds, might be NULL.

Retrieved the ink and logical bounds for the text as defined by Pango.

static PangoContext* gccv::Text::GetContext ( )
static
Returns
the PangoContext used to evaluate sizes and positions for all Text instances.
unsigned gccv::Text::GetDefaultFontSize ( )
inline
Returns
the default font sioze for the item.

Definition at line 263 of file gccv/text.h.

gccv::Text::GetHeight ( void  ) const
inline
Returns
the Text height.

Definition at line 344 of file gccv/text.h.

gccv::Text::GetInterline ( void  ) const
inline
Returns
the Text interline spacing.

Definition at line 336 of file gccv/text.h.

gccv::Text::GetJustification ( void  ) const
inline
Returns
the Text justification.

Definition at line 332 of file gccv/text.h.

gccv::Text::GetLineOffset ( void  ) const
inline
Returns
the Text line offset.

Definition at line 328 of file gccv/text.h.

gccv::Text::GetPadding ( void  ) const
inline
Returns
the Text padding.

Definition at line 308 of file gccv/text.h.

std::list<TextTag *> const* gccv::Text::GetTags ( )
inline
Returns
the current TextTag list for the Text item.

Definition at line 175 of file gccv/text.h.

char const* gccv::Text::GetText ( )
Returns
the text displayed by the item.
gccv::Text::GetWidth ( void  ) const
inline
Returns
the Text width.

Definition at line 340 of file gccv/text.h.

gccv::Text::GetY ( void  ) const
inline
Returns
the vertical alignment position.

Definition at line 352 of file gccv/text.h.

void gccv::Text::InsertTextTag ( TextTag tag,
bool  rebuild_attributes = true 
)
Parameters
taga TextTag
rebuild_attributeswhether to rebuild the PangoAttrList for the text.

Inserts a new TextTag.

void gccv::Text::Move ( double  x,
double  y 
)
virtual
Parameters
xthe horizontal deplacement
ythe vertical deplacement

Moves the Text.

Reimplemented from gccv::Rectangle.

void gccv::Text::OnButtonPressed ( double  x,
double  y 
)
Parameters
xthe cursor horizontal position.
ythe cursor vertical position.

Notifies the Text item that a relevant "button-press" event has occured. This moves the cursor to the new position.

void gccv::Text::OnDrag ( double  x,
double  y 
)
Parameters
xthe cursor horizontal position.
ythe cursor vertical position.

Notifies the Text item that a relevant "mouse-move" event has occured while a button is pressed to extend the selection.

bool gccv::Text::OnKeyPressed ( GdkEventKey *  event)
Parameters
eventa GdkEventKey.

Notifies the Text item that a relevant "key-press" event has occured.

bool gccv::Text::OnKeyReleased ( GdkEventKey *  event)
Parameters
eventa GdkEventKey.

Notifies the Text item that a relevant "key-release" event has occured.

void gccv::Text::RebuildAttributes ( )

Rebuils the Pango attributes lists used by the item.

void gccv::Text::ReplaceText ( std::string &  str,
int  pos,
unsigned  length 
)
Parameters
strthe text to insert
posthe insertion position
lengththe length (in bytes) of the substring to replace

Replaces (or inserts if length is nul) text in the text item. If position is -1, the text will be inserted at the current cursor position. The cursor will be moved to the end of the inserted text.

gccv::Text::SetAnchor ( Anchor  anchor)
inline
Parameters
anchorthe new Anchor.

Sets the Anchor foir the Text.

Definition at line 317 of file gccv/text.h.

void gccv::Text::SetColor ( GOColor  color)
Parameters
colorthe default text color.

Sets the default text color for the item.

void gccv::Text::SetCurTagList ( TextTagList l)
Parameters
ltext tags.

Sets the list of TextTag instances to be applied when text is inserted.

void gccv::Text::SetEditing ( bool  editing)
Parameters
editingwhether to show the cursor or not

When editing a blinking cursor is displayed.

void gccv::Text::SetFontDescription ( PangoFontDescription *  desc)
Parameters
desca font description.

Sets the default font description for the item.

void gccv::Text::SetInterline ( double  interline,
bool  emit_changed = false 
)
Parameters
interlinethe new interline.
emit_changedwhether to call TextClient::InterlineChanged for the client.

Sets the interline spacing and notifies the client if requested, and if there is actually any client.

void gccv::Text::SetJustification ( GtkJustification  justification,
bool  emit_changed = false 
)
Parameters
justificationthe new justification.
emit_changedwhether to call TextClient::JustificationChanged for the client.

Sets the justification and notifies the client if requested, and if there is actually any client. The justification is meaningful only for multiline texts.

gccv::Text::SetLineOffset ( double  offset)
inline
Parameters
offsetthe distance between the base line and the position used for alignment.

Sets a vertical offset for the text alignment relative to other items. Typically the half width of a 'C' character in the default font.

Definition at line 328 of file gccv/text.h.

gccv::Text::SetPadding ( double  padding)
inline
Parameters
paddingthe new padding around the text.

Adds padding in all directions around the text logical area.

Definition at line 308 of file gccv/text.h.

void gccv::Text::SetPosition ( double  x,
double  y 
)
Parameters
xthe top left corner new horizontal position.
ythe top left corner new vertical position.

Sets the position of the Text. Interpretation of the values x and y relies on the text anchor.

void gccv::Text::SetText ( char const *  text)
Parameters
textthe text to display.

Sets the text displayed by the item.

void gccv::Text::SetText ( std::string const &  text)
Parameters
textthe text to display.

Sets the text displayed by the item.


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