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 namespace gcp {
00035
00036 class TextObject: public gcu::Object
00037 {
00038 public:
00039 TextObject (gcu::TypeId Type);
00040 TextObject (double x, double y, gcu::TypeId Type);
00041 virtual ~TextObject ();
00042
00043 void GetSize (double& x, double& y) {x = m_length; y = m_height;}
00044 xmlNodePtr SaveSelected ();
00045 void LoadSelected (xmlNodePtr node);
00046 virtual bool OnChanged (bool save) = 0;
00047 void OnSelChanged (struct GnomeCanvasPangoSelBounds *bounds);
00048 bool SaveNode (xmlDocPtr xml, xmlNodePtr);
00049 bool Load (xmlNodePtr);
00050 void Move (double x, double y, double z = 0);
00051 bool IsLocked () {return m_bLoading;}
00052 void GetSelectionBounds (unsigned &start, unsigned &end) {start = m_StartSel; end = m_EndSel;}
00053 std::string GetBuffer () {return m_buf;}
00054
00055 protected:
00056 double m_x, m_y, m_length, m_height;
00057 int m_ascent;
00058 int m_InsertOffset;
00059 std::string m_buf;
00060 bool m_bLoading;
00061 unsigned m_StartSel, m_EndSel;
00062 bool m_RealSave;
00063
00064 GCU_PROT_PROP (PangoLayout*, Layout);
00065 GCU_PROT_PROP (PangoAttrList*, AttrList);
00066 };
00067
00068 }
00069
00070 #endif //GCHEMPAINT_TEXT_OBJECT_H