gcp::TextObject Class Reference

#include <gcp/text-object.h>

Inheritance diagram for gcp::TextObject:

gcu::Object gcp::Fragment gcp::Text

List of all members.

Public Member Functions

 TextObject (gcu::TypeId Type)
 TextObject (double x, double y, gcu::TypeId Type)
virtual ~TextObject ()
void GetSize (double &x, double &y)
xmlNodePtr SaveSelected ()
void LoadSelected (xmlNodePtr node)
virtual bool OnChanged (bool save)=0
void OnSelChanged (gccv::TextSelBounds *bounds)
bool SaveNode (xmlDocPtr xml, xmlNodePtr node) const
bool Load (xmlNodePtr node)
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
GtkAnchorType GetAnchor (void)
gccv::TextTagList GetTagList (void)

Protected Attributes

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
GtkAnchorType m_Anchor
gccv::TextTagList m_TagList


Detailed Description

The base class for texts. This class is virtual with one pure virtual method (gcp::TextObject::OnSave).

Definition at line 43 of file text-object.h.


Constructor & Destructor Documentation

gcp::TextObject::TextObject ( gcu::TypeId  Type  ) 

Parameters:
Type the TypeId of the derived class.
The default constructor.

gcp::TextObject::TextObject ( double  x,
double  y,
gcu::TypeId  Type 
)

Parameters:
Type the TypeId of the derived class.
x the horizontal poisition.
y the vertical poisition.
Constructs and sets the position of the text object.

virtual gcp::TextObject::~TextObject (  )  [virtual]

The destructor.


Member Function Documentation

gcp::TextObject::GetAnchor ( void   )  [inline]

Returns:
the current GtkAnchor.

Definition at line 199 of file text-object.h.

std::string gcp::TextObject::GetBuffer (  )  [inline]

Returns:
the raw text contained in the object.

Definition at line 135 of file text-object.h.

References m_buf.

virtual std::string gcp::TextObject::GetProperty ( unsigned  property  )  const [virtual]

Parameters:
property the property id as defined in gcu/objprops.h
Used when saving to get properties from a text object. Only on eproperty is supported: GCU_PROP_TEXT_TEXT

Reimplemented from gcu::Object.

void gcp::TextObject::GetSelectionBounds ( unsigned &  start,
unsigned &  end 
) [inline]

Parameters:
start where to store the start of the selection.
end where to store the end of the selection.
The values set as bounds are in bytes.

Definition at line 131 of file text-object.h.

References m_EndSel, and m_StartSel.

void gcp::TextObject::GetSize ( double &  x,
double &  y 
) [inline]

Parameters:
x the variable to be set to the width value.
y the variable to be set to the height value.
Retrieves the size of the text in canvas coordinates.

Reimplemented in gcp::Text.

Definition at line 71 of file text-object.h.

References m_height, and m_length.

gcp::TextObject::GetTagList ( void   )  [inline]

Returns:
a copy of the tags list for this object.

Definition at line 206 of file text-object.h.

bool gcp::TextObject::IsLocked (  )  [inline]

This is used because updates are not needed while loading util the whole text has been loaded.

Returns:
true while loading, false otherwise.

Reimplemented from gcu::Object.

Definition at line 124 of file text-object.h.

References m_bLoading.

bool gcp::TextObject::Load ( xmlNodePtr  node  )  [virtual]

Parameters:
node the xml node representing the text.
Loads the position and Id.

Reimplemented from gcu::Object.

Reimplemented in gcp::Fragment, and gcp::Text.

void gcp::TextObject::LoadSelected ( xmlNodePtr  node  ) 

Parameters:
node the xml node representing the text to import.
Replaces the contents of the text object by what is represented by the node.

void gcp::TextObject::Move ( double  x,
double  y,
double  z = 0 
) [virtual]

Parameters:
x the horizontal translation.
y the vertical translation.
z the depth translation.
The z variable is not useful.

Reimplemented from gcu::Object.

Reimplemented in gcp::Fragment.

virtual bool gcp::TextObject::OnChanged ( bool  save  )  [pure virtual]

Parameters:
save whether the text should be saved for undo/redo operations.
Must be called after any change in the text. This method is pure virtual and must be overloaded in derived classes.

Implemented in gcp::Fragment, and gcp::Text.

void gcp::TextObject::OnSelChanged ( gccv::TextSelBounds *  bounds  ) 

Parameters:
bounds the bounds of the selection.
Called during edition when the selection has changed, that is after any change. The signature of this method will change with the deprecation of GnomeCanvas.

bool gcp::TextObject::SaveNode ( xmlDocPtr  xml,
xmlNodePtr  node 
) const

Parameters:
xml the xml document.
node the node representing the text.
Saves the position and Id. Called by derived classes when saving if meaningful.

xmlNodePtr gcp::TextObject::SaveSelected (  ) 

Saves the selection.

Returns:
the xml node representing the selection.


Member Data Documentation

The GtkAnchor used for the text object. Default is GTK_ANCHOR_W. When GTK_ANCHOR_W, GTK_ANCHOR_CENTER, or GTK_ANCHOR_E is used, the base of the first line is used for vertical alignment.

Definition at line 199 of file text-object.h.

int gcp::TextObject::m_ascent [protected]

The ascent of the text.

Definition at line 164 of file text-object.h.

bool gcp::TextObject::m_bLoading [protected]

treu on loading, false otherwise.

Definition at line 176 of file text-object.h.

Referenced by IsLocked().

std::string gcp::TextObject::m_buf [protected]

The text owned byt the object.

Definition at line 172 of file text-object.h.

Referenced by GetBuffer(), and gcp::Text::SetText().

unsigned gcp::TextObject::m_EndSel [protected]

The index in bytes of the end of the selection.

Definition at line 184 of file text-object.h.

Referenced by GetSelectionBounds().

double gcp::TextObject::m_height [protected]

The height of the object in canvas units.

Definition at line 160 of file text-object.h.

Referenced by gcp::Text::GetSize(), and GetSize().

The current insertionposition.

Definition at line 168 of file text-object.h.

double gcp::TextObject::m_length [protected]

The width of the object in canvas units.

Definition at line 156 of file text-object.h.

Referenced by gcp::Text::GetSize(), and GetSize().

bool gcp::TextObject::m_RealSave [protected]

Tells whether the Save method is called for the whole text or just the selection.

Definition at line 189 of file text-object.h.

unsigned gcp::TextObject::m_StartSel [protected]

The index in bytes of the start of the selection.

Definition at line 180 of file text-object.h.

Referenced by GetSelectionBounds().

The tags list associated with the object.

Definition at line 206 of file text-object.h.

double gcp::TextObject::m_x [protected]

The horizontal of the object in canvas units.

Definition at line 148 of file text-object.h.

double gcp::TextObject::m_y [protected]

The vertical of the object in canvas units.

Definition at line 152 of file text-object.h.


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

Generated on Wed Mar 25 12:27:22 2009 for The Gnome Chemistry Utils by  doxygen 1.5.8