The Gnome Chemistry Utils
0.14.0
|
#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 |
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) |
ItemClient * | GetClient (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 |
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 |
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 |
||
) |
|
virtual |
cr | a cairo_t. |
is_vector | whether the cairo_t is a vectorial context. |
Draws the Text to cr.
Reimplemented from gccv::Rectangle.
|
inline |
Definition at line 317 of file gccv/text.h.
|
inline |
Definition at line 348 of file gccv/text.h.
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 |
|
inline |
Definition at line 263 of file gccv/text.h.
|
inline |
Definition at line 344 of file gccv/text.h.
|
inline |
Definition at line 336 of file gccv/text.h.
|
inline |
Definition at line 332 of file gccv/text.h.
|
inline |
Definition at line 328 of file gccv/text.h.
|
inline |
Definition at line 308 of file gccv/text.h.
|
inline |
Definition at line 175 of file gccv/text.h.
char const* gccv::Text::GetText | ( | ) |
|
inline |
Definition at line 340 of file gccv/text.h.
|
inline |
Definition at line 352 of file gccv/text.h.
void gccv::Text::InsertTextTag | ( | TextTag * | tag, |
bool | rebuild_attributes = true |
||
) |
|
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.
|
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.
|
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.
|
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.