00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef GCHEMPAINT_TEXT_OBJECT_H
00026 #define GCHEMPAINT_TEXT_OBJECT_H
00027
00028 #include <gcu/object.h>
00029 #include <gcu/macros.h>
00030 #include <pango/pango-layout.h>
00031 #include <string>
00032 #include <canvas/gcp-canvas-pango.h>
00033
00034 using namespace gcu;
00035 using namespace std;
00036
00037 namespace gcp {
00038
00039 class TextObject: public Object
00040 {
00041 public:
00042 TextObject (TypeId Type);
00043 TextObject (double x, double y, TypeId Type);
00044 virtual ~TextObject ();
00045
00046 void GetSize (double& x, double& y) {x = m_length; y = m_height;}
00047 xmlNodePtr SaveSelected ();
00048 void LoadSelected (xmlNodePtr node);
00049 virtual bool OnChanged (bool save) = 0;
00050 void OnSelChanged (struct GnomeCanvasPangoSelBounds *bounds);
00051 bool SaveNode (xmlDocPtr xml, xmlNodePtr);
00052 bool Load (xmlNodePtr);
00053 void Move (double x, double y, double z = 0);
00054 bool IsLocked () {return m_bLoading;}
00055 void GetSelectionBounds (unsigned &start, unsigned &end) {start = m_StartSel; end = m_EndSel;}
00056 string GetBuffer () {return m_buf;}
00057
00058 protected:
00059 double m_x, m_y, m_length, m_height;
00060 int m_ascent;
00061 int m_InsertOffset;
00062 string m_buf;
00063 bool m_bLoading;
00064 unsigned m_StartSel, m_EndSel;
00065 bool m_RealSave;
00066
00067 GCU_PROT_PROP (PangoLayout*, Layout);
00068 GCU_PROT_PROP (PangoAttrList*, AttrList);
00069 };
00070
00071 }
00072
00073 #endif //GCHEMPAINT_TEXT_OBJECT_H