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

#include <text.h>

Inheritance diagram for gcp::Text:
gcp::TextObject gcu::Object gccv::TextClient gccv::ItemClient

Public Member Functions

 Text ()
 Text (double x, double y)
 Text (gccv::Tag tag, double x, double y)
virtual ~Text ()
void GetCoords (double *x, double *y)
void SetCoords (double x, double y)
xmlNodePtr Save (xmlDocPtr xml) const
xmlNodePtr SaveSelection (xmlDocPtr xml) const
bool Load (xmlNodePtr node)
bool LoadSelection (xmlNodePtr node, unsigned pos)
bool LoadNode (xmlNodePtr node, unsigned &pos, int cur_size=0)
void AddItem ()
void UpdateItem ()
void SetSelected (int state)
bool OnChanged (bool save)
void Transform2D (gcu::Matrix2D &m, double x, double y)
void GetSize (double &x, double &y)
double GetYAlign ()
void SetText (char const *text)
bool SetProperty (unsigned property, char const *value)
void InterlineChanged (double interline)
void JustificationChanged (GtkJustification justification)
std::string Name ()
bool GetCoords (double *x, double *y, double *z=NULL) const
void SetAnchor (gccv::Anchor val)
gccv::Anchor GetAnchor (void) const
gccv::Tag GetGlobalTag (void) const
- Public Member Functions inherited from gcp::TextObject
 TextObject (gcu::TypeId Type)
 TextObject (double x, double y, gcu::TypeId Type)
virtual ~TextObject ()
xmlNodePtr SaveSelected ()
void LoadSelected (xmlNodePtr node)
bool SaveNode (xmlDocPtr xml, xmlNodePtr node) const
void Move (double x, double y, double z=0)
bool IsLocked ()
void GetSelectionBounds (unsigned &start, unsigned &end)
std::string GetBuffer ()
virtual std::string GetProperty (unsigned property) const
void SelectionChanged (unsigned start, unsigned end)
void TextChanged (unsigned pos)
gccv::TextTagList GetTagList (void)
void SetEditor (TextEditor *val)
TextEditorGetEditor (void) const
TextEditor *& GetRefEditor (void)
gccv::TextGetTextItem (void)
- Public Member Functions inherited from gcu::Object
 Object (TypeId Id=OtherType)
virtual ~Object ()
TypeId GetType () const
void SetId (gchar const *Id)
char const * GetId () const
virtual void AddChild (Object *object)
ObjectGetMolecule () const
ObjectGetReaction () const
ObjectGetGroup () const
DocumentGetDocument () const
ApplicationGetApplication () const
ObjectGetParentOfType (TypeId Id) const
ObjectGetChild (const gchar *Id) const
ObjectGetFirstChild (std::map< std::string, Object * >::iterator &i)
ObjectGetNextChild (std::map< std::string, Object * >::iterator &i)
ObjectGetDescendant (const char *Id) const
ObjectGetParent () const
void SetParent (Object *Parent)
bool SaveChildren (xmlDocPtr xml, xmlNodePtr node) const
void SaveId (xmlNodePtr node) const
xmlNodePtr GetNodeByProp (xmlNodePtr node, char const *Property, char const *Id)
xmlNodePtr GetNextNodeByProp (xmlNodePtr node, char const *Property, char const *Id)
xmlNodePtr GetNodeByName (xmlNodePtr node, char const *Name)
xmlNodePtr GetNextNodeByName (xmlNodePtr node, char const *Name)
bool HasChildren () const
unsigned GetChildrenNumber () const
virtual ObjectGetAtomAt (double x, double y, double z=0.)
virtual bool Build (std::set< Object * > const &Children) throw (std::invalid_argument)
virtual bool BuildContextualMenu (UIManager *uim, Object *object, double x, double y)
void EmitSignal (SignalId Signal)
virtual bool OnSignal (SignalId Signal, Object *Child)
void Lock (bool state=true)
ObjectGetFirstLink (std::set< Object * >::iterator &i)
ObjectGetNextLink (std::set< Object * >::iterator &i)
void Link (Object *object)
void Unlink (Object *object)
virtual void OnUnlink (Object *object)
void GetPossibleAncestorTypes (std::set< TypeId > &types) const
virtual void OnLoaded ()
void SetDirty (bool dirty=true)
virtual void Clear ()
std::string Identity ()
virtual char const * HasPropertiesDialog () const
virtual bool CanSelect () const
virtual void NotifyEmpty ()
void ShowPropertiesDialog ()
bool GetDirty (void) const
- Public Member Functions inherited from gccv::TextClient
 TextClient ()
virtual ~TextClient ()
virtual void InterlineChanged (G_GNUC_UNUSED double interline)
virtual void JustificationChanged (G_GNUC_UNUSED GtkJustification justification)
- Public Member Functions inherited from gccv::ItemClient
 ItemClient ()
virtual ~ItemClient ()
ItemGetItem (void)

Additional Inherited Members

- Static Public Member Functions inherited from gcu::Object
static TypeId AddType (std::string TypeName, Object *(*CreateFunc)(), TypeId id=OtherType)
static void AddAlias (TypeId id, std::string TypeName)
static ObjectCreateObject (const std::string &TypeName, Object *parent=NULL)
static TypeId GetTypeId (const std::string &Name)
static std::string GetTypeName (TypeId Id)
static void AddMenuCallback (TypeId Id, BuildMenuCb cb)
static void AddRule (TypeId type1, RuleId rule, TypeId type2)
static void AddRule (const std::string &type1, RuleId rule, const std::string &type2)
static const std::set< TypeId > & GetRules (TypeId type, RuleId rule)
static const std::set< TypeId > & GetRules (const std::string &type, RuleId rule)
static void SetCreationLabel (TypeId Id, std::string Label)
static const std::string & GetCreationLabel (TypeId Id)
static const std::string & GetCreationLabel (const std::string &TypeName)
static SignalId CreateNewSignalId ()
- Protected Member Functions inherited from gcu::Object
virtual DialogBuildPropertiesDialog ()
- Protected Attributes inherited from gcp::TextObject
double m_x
double m_y
double m_length
double m_height
int m_ascent
int m_InsertOffset
std::string m_buf
bool m_bLoading
unsigned m_StartSel
unsigned m_EndSel
bool m_RealSave
gccv::TextTagList m_TagList
gccv::Textm_TextItem

Detailed Description

The text objects in GChemPaint, excluding atomic symbols. Using this class to represent chemical objects looses the chemical significance.

Definition at line 41 of file gcp/text.h.

Constructor & Destructor Documentation

gcp::Text::Text ( )

The default constructor for an empty and unpositioned text.

gcp::Text::Text ( double  x,
double  y 
)
Parameters
xthe x coordinate.
ythe y coordinate.

Constructs a new empty text positioned according to the given coordiantes

gcp::Text::Text ( gccv::Tag  tag,
double  x,
double  y 
)
Parameters
taga gccv::Tag to apply to the whole text.
xthe x coordinate.
ythe y coordinate.

Constructs a new empty text positioned according to the given coordiantes

virtual gcp::Text::~Text ( )
virtual

The destructor.

Member Function Documentation

void gcp::Text::AddItem ( )
virtual

Used to add a representation of the text in the view.

Reimplemented from gccv::ItemClient.

gcp::Text::GetAnchor ( void  ) const
inline
Returns
the gccv::Anchor used for the text.

Definition at line 220 of file gcp/text.h.

void gcp::Text::GetCoords ( double *  x,
double *  y 
)
Parameters
xa pointer to the double value which will receive the x coordinate of the text.
ya pointer to the double value which will receive the y coordinate of the text.

Retrieves the coordinates of this text.

bool gcp::Text::GetCoords ( double *  x,
double *  y,
double *  z = NULL 
) const
virtual
Parameters
xwhere to store the x coordinate of the center of the text.
ywhere to store the y coordinate of the center of the text.
zwhere to store the z coordinate of the center of the text or NULL.

Retrieves the current coordinates of the operator. Aways set z to 0.

Returns
true if successful and false if an error occurs (if x or y is NULL).

Reimplemented from gcu::Object.

gcp::Text::GetGlobalTag ( void  ) const
inline
Returns
the global gccv::TextTag applied to this text or gccv::Invalid if none has been explicitly set in the constructor.

Definition at line 226 of file gcp/text.h.

void gcp::Text::GetSize ( double &  x,
double &  y 
)
inline
Parameters
xwhere to store the width of the text.
ywhere to store the height of the text.

The sizes are given in canvas coordinates.

Reimplemented from gcp::TextObject.

Definition at line 155 of file gcp/text.h.

References gcp::TextObject::m_height, and gcp::TextObject::m_length.

double gcp::Text::GetYAlign ( )
virtual
Returns
the y coordinate at half height of a carbon atom symbol if any was present at default size so that all texts and chemicalk symbols will have the same base line when aligned.

Reimplemented from gcu::Object.

void gcp::Text::InterlineChanged ( double  interline)
Parameters
interlinethe spacing.

Sets the Text interline spacing expressed as points.

void gcp::Text::JustificationChanged ( GtkJustification  justification)
Parameters
justificationa GtkJustification.

Sets the justification for the Text. Only meaningful for multiline text.

bool gcp::Text::Load ( xmlNodePtr  node)
virtual
Parameters
nodethe xml node representing the text.

Loads the text in memory.

Reimplemented from gcp::TextObject.

bool gcp::Text::LoadNode ( xmlNodePtr  node,
unsigned &  pos,
int  cur_size = 0 
)
Parameters
nodethe xml node representing a portion of the text.
poswhere to insert the new text.
cur_sizethe current size in bytes.

Loads a portion of a text with a unique set of attributes. pos and cur_size are updated.

bool gcp::Text::LoadSelection ( xmlNodePtr  node,
unsigned  pos 
)
Parameters
nodethe xml node representing the text to insert.
poswhere to insert the new text.

Inserts a text inside an existing instance during a paste operation.

std::string gcp::Text::Name ( )
virtual
Returns
the localized object generic name.

Reimplemented from gcu::Object.

bool gcp::Text::OnChanged ( bool  save)
virtual
Parameters
savewhether the text should be saved for undo/redo operations.

Called after any change in the text.

Implements gcp::TextObject.

xmlNodePtr gcp::Text::Save ( xmlDocPtr  xml) const
virtual
Parameters
xmlthe xmlDoc used to save the document.
Returns
a pointer to the xmlNode representing this text or NULL if an error occured.

Reimplemented from gcu::Object.

xmlNodePtr gcp::Text::SaveSelection ( xmlDocPtr  xml) const
Parameters
xmlthe xmlDoc used for clipboard operations.

Saves the currently selected text. This method is used by the framework when editing the textual object.

Returns
the xmlNode containing the serialized selection.
gcp::Text::SetAnchor ( gccv::Anchor  Anchor)
inline

fn GetRefAnchor()

Returns
the gccv::Anchor used for the text as a reference.
Parameters
Anchorthe new gccv::Anchor for the text.

Sets the gccv::Anchor used for this text. Default is GTK_ANCHOR_W. The vertical alignment being based on the base line with an offset equal to the half height of a carbon atom symbol using the current document theme.

Definition at line 220 of file gcp/text.h.

void gcp::Text::SetCoords ( double  x,
double  y 
)
Parameters
xthe new x coordinate of the text.
ythe new y coordinate of the text.

Changes the position of this text.

bool gcp::Text::SetProperty ( unsigned  property,
char const *  value 
)
virtual
Parameters
propertythe property id as defined in objprops.h
valuethe property value as a string

Used when loading to set properties for the fragment. This method supports GCU_PROP_POS2D, GCU_PROP_TEXT_MARKUP, GCU_PROP_TEXT_TEXT, GCU_PROP_TEXT_ALIGNMENT and GCU_PROP_TEXT_JUSTIFICATION.

Returns
true if the property could be set, or if the property is not relevant, false otherwise.

Reimplemented from gcu::Object.

void gcp::Text::SetSelected ( int  state)
virtual
Parameters
statethe selection state of the text.

Used to set the selection state of text inside. The values of state might be gcp::SelStateUnselected, gcp::SelStateSelected, gcp::SelStateUpdating, or gcp::SelStateErasing.

Reimplemented from gccv::ItemClient.

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

Sets the text for this instance. The text will be displayed using the default font settings.

Definition at line 168 of file gcp/text.h.

References gcp::TextObject::m_buf.

void gcp::Text::Transform2D ( gcu::Matrix2D m,
double  x,
double  y 
)
virtual
Parameters
mthe Matrix2D of the transformation.
xthe x component of the center of the transformation.
ythe y component of the center of the transformation.

Used to move and/or transform a text object. Text rotation is not currently supported. The text which just be moved after transformation of its coordinates.

Reimplemented from gcu::Object.

void gcp::Text::UpdateItem ( )
virtual

Used to update the representation of the text in the view.

Reimplemented from gccv::ItemClient.


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