The Gnome Chemistry Utils
0.13.7
|
#include <text.h>
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 () |
Text.
The Text item class is used to display text in the canvas.
Definition at line 79 of file gccv/text.h.
gccv::Text::Text | ( | Canvas * | canvas, |
double | x, | ||
double | y | ||
) |
gccv::Text::Text | ( | Group * | parent, |
double | x, | ||
double | y, | ||
ItemClient * | client = NULL |
||
) |
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.
void gccv::Text::ApplyTagsToSelection | ( | TextTagList const * | l | ) |
l | text tags. |
Apply the tags list to the current selection.
void gccv::Text::DeleteTextTag | ( | TextTag * | tag, |
bool | rebuild_attributes = true |
||
) |
void gccv::Text::Draw | ( | cairo_t * | cr, |
bool | is_vector | ||
) | const [virtual] |
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] |
Definition at line 317 of file gccv/text.h.
gccv::Text::GetAscent | ( | void | ) | const [inline] |
Definition at line 348 of file gccv/text.h.
void gccv::Text::GetBounds | ( | Rect * | ink, |
Rect * | logical | ||
) |
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] |
unsigned gccv::Text::GetDefaultFontSize | ( | ) | [inline] |
Definition at line 263 of file gccv/text.h.
gccv::Text::GetHeight | ( | void | ) | const [inline] |
Definition at line 344 of file gccv/text.h.
gccv::Text::GetInterline | ( | void | ) | const [inline] |
Definition at line 336 of file gccv/text.h.
gccv::Text::GetJustification | ( | void | ) | const [inline] |
Definition at line 332 of file gccv/text.h.
gccv::Text::GetLineOffset | ( | void | ) | const [inline] |
Definition at line 328 of file gccv/text.h.
gccv::Text::GetPadding | ( | void | ) | const [inline] |
Definition at line 308 of file gccv/text.h.
std::list<TextTag *> const* gccv::Text::GetTags | ( | ) | [inline] |
Definition at line 175 of file gccv/text.h.
char const* gccv::Text::GetText | ( | ) |
gccv::Text::GetWidth | ( | void | ) | const [inline] |
Definition at line 340 of file gccv/text.h.
gccv::Text::GetY | ( | void | ) | const [inline] |
Definition at line 352 of file gccv/text.h.
void gccv::Text::InsertTextTag | ( | TextTag * | tag, |
bool | rebuild_attributes = true |
||
) |
void gccv::Text::Move | ( | double | x, |
double | y | ||
) | [virtual] |
x | the horizontal deplacement |
y | the vertical deplacement |
Moves the Text.
Reimplemented from gccv::Rectangle.
void gccv::Text::OnButtonPressed | ( | double | x, |
double | y | ||
) |
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 | ||
) |
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 | ) |
event | a GdkEventKey. |
Notifies the Text item that a relevant "key-press" event has occured.
bool gccv::Text::OnKeyReleased | ( | GdkEventKey * | event | ) |
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 | ||
) |
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] |
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 | ) |
color | the default text color. |
Sets the default text color for the item.
void gccv::Text::SetCurTagList | ( | TextTagList * | l | ) |
l | text tags. |
Sets the list of TextTag instances to be applied when text is inserted.
void gccv::Text::SetEditing | ( | bool | editing | ) |
editing | whether to show the cursor or not |
When editing a blinking cursor is displayed.
void gccv::Text::SetFontDescription | ( | PangoFontDescription * | desc | ) |
desc | a font description. |
Sets the default font description for the item.
void gccv::Text::SetInterline | ( | double | interline, |
bool | emit_changed = false |
||
) |
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 |
||
) |
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] |
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] |
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 | ||
) |
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 | ( | char const * | text | ) |
text | the text to display. |
Sets the text displayed by the item.
void gccv::Text::SetText | ( | std::string const & | text | ) |
text | the text to display. |
Sets the text displayed by the item.