text-object.h
Go to the documentation of this file.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
00035 namespace gcp {
00036
00042 class TextObject: public gcu::Object
00043 {
00044 public:
00050 TextObject (gcu::TypeId Type);
00058 TextObject (double x, double y, gcu::TypeId Type);
00062 virtual ~TextObject ();
00063
00070 void GetSize (double& x, double& y) {x = m_length; y = m_height;}
00075 xmlNodePtr SaveSelected ();
00081 void LoadSelected (xmlNodePtr node);
00088 virtual bool OnChanged (bool save) = 0;
00095 void OnSelChanged (struct GnomeCanvasPangoSelBounds *bounds);
00102 bool SaveNode (xmlDocPtr xml, xmlNodePtr node) const;
00108 bool Load (xmlNodePtr node);
00116 void Move (double x, double y, double z = 0);
00123 bool IsLocked () {return m_bLoading;}
00130 void GetSelectionBounds (unsigned &start, unsigned &end) {start = m_StartSel; end = m_EndSel;}
00134 std::string GetBuffer () {return m_buf;}
00141 virtual std::string GetProperty (unsigned property) const;
00142
00143 protected:
00147 double m_x;
00151 double m_y;
00155 double m_length;
00159 double m_height;
00163 int m_ascent;
00167 int m_InsertOffset;
00171 std::string m_buf;
00175 bool m_bLoading;
00179 unsigned m_StartSel;
00183 unsigned m_EndSel;
00188 bool m_RealSave;
00189
00196 GCU_PROT_PROP (PangoLayout*, Layout);
00203 GCU_PROT_PROP (PangoAttrList*, AttrList);
00212 GCU_PROT_PROP (GtkAnchorType, Anchor);
00213 };
00214
00215 }
00216
00217 #endif //GCHEMPAINT_TEXT_OBJECT_H