gccv::Text Class Reference

Text. More...

#include <text.h>

Inheritance diagram for gccv::Text:

gccv::Rectangle gccv::FillItem gccv::LineItem gccv::Item

List of all members.

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

Static Public Member Functions

static PangoContext * GetContext ()


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:
canvas a Canvas.
x the horizontal position.
y the 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:
parent the Group to which the new Text will be added.
x the top left corner horizontal position.
y the top left corner vertical position.
client the 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:
l text tags.
Apply the tags list to the current selection.

void gccv::Text::DeleteTextTag ( TextTag tag,
bool  rebuild_attributes = true 
)

Parameters:
tag a TextTag
rebuild_attributes whether to rebuild the PangoAttrList for the text.
Removes an existing TextTag.

void gccv::Text::Draw ( cairo_t *  cr,
bool  is_vector 
) const [virtual]

Parameters:
cr a cairo_t.
is_vector whether 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:
ink where to store the ink bounds, might be NULL.
logical where 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:
tag a TextTag
rebuild_attributes whether to rebuild the PangoAttrList for the text.
Inserts a new TextTag.

void gccv::Text::Move ( double  x,
double  y 
) [virtual]

Parameters:
x the horizontal deplacement
y the vertical deplacement
Moves the Text.

Reimplemented from gccv::Rectangle.

void gccv::Text::OnButtonPressed ( double  x,
double  y 
)

Parameters:
x the cursor horizontal position.
y the 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:
x the cursor horizontal position.
y the 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:
event a GdkEventKey.
Notifies the Text item that a relevant "key-press" event has occured.

bool gccv::Text::OnKeyReleased ( GdkEventKey *  event  ) 

Parameters:
event a 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:
str the text to insert
pos the insertion position
length the 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:
anchor the new Anchor.
Sets the Anchor foir the Text.

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

void gccv::Text::SetColor ( GOColor  color  ) 

Parameters:
color the default text color.
Sets the default text color for the item.

void gccv::Text::SetCurTagList ( TextTagList l  ) 

Parameters:
l text tags.
Sets the list of TextTag instances to be applied when text is inserted.

void gccv::Text::SetEditing ( bool  editing  ) 

Parameters:
editing whether to show the cursor or not
When editing a blinking cursor is displayed.

void gccv::Text::SetFontDescription ( PangoFontDescription *  desc  ) 

Parameters:
desc a font description.
Sets the default font description for the item.

void gccv::Text::SetInterline ( double  interline,
bool  emit_changed = false 
)

Parameters:
interline the new interline.
emit_changed whether 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:
justification the new justification.
emit_changed whether 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:
offset the 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:
padding the 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:
x the top left corner new horizontal position.
y the 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 ( std::string const &  text  ) 

Parameters:
text the text to display.
Sets the text displayed by the item.

void gccv::Text::SetText ( char const *  text  ) 

Parameters:
text the text to display.
Sets the text displayed by the item.


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

Generated on Fri Sep 24 15:58:43 2010 for The Gnome Chemistry Utils by  doxygen 1.5.9