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 <gccv/structs.h>
00031 #include <gccv/text-client.h>
00032 #include <gccv/text-tag.h>
00033 #include <pango/pango-layout.h>
00034 #include <string>
00035
00036 namespace gccv {
00037 class Text;
00038 }
00039
00041 namespace gcp {
00042
00043 class TextEditor;
00044
00050 class TextObject: public gcu::Object, public gccv::TextClient
00051 {
00052 public:
00058 TextObject (gcu::TypeId Type);
00066 TextObject (double x, double y, gcu::TypeId Type);
00070 virtual ~TextObject ();
00071
00078 void GetSize (double& x, double& y) {x = m_length; y = m_height;}
00083 xmlNodePtr SaveSelected ();
00089 void LoadSelected (xmlNodePtr node);
00096 virtual bool OnChanged (bool save) = 0;
00103 bool SaveNode (xmlDocPtr xml, xmlNodePtr node) const;
00109 bool Load (xmlNodePtr node);
00117 void Move (double x, double y, double z = 0);
00124 bool IsLocked () {return m_bLoading;}
00131 void GetSelectionBounds (unsigned &start, unsigned &end) {start = m_StartSel; end = m_EndSel;}
00135 std::string GetBuffer () {return m_buf;}
00142 virtual std::string GetProperty (unsigned property) const;
00143
00144
00147 void SelectionChanged (unsigned start, unsigned end);
00150 void TextChanged (unsigned pos);
00151
00152 protected:
00156 double m_x;
00160 double m_y;
00164 double m_length;
00168 double m_height;
00172 int m_ascent;
00176 int m_InsertOffset;
00180 std::string m_buf;
00184 bool m_bLoading;
00188 unsigned m_StartSel;
00192 unsigned m_EndSel;
00197 bool m_RealSave;
00198
00199
00206 GCU_PROT_PROP (gccv::TextTagList, TagList)
00207 GCU_PROP (TextEditor*, Editor)
00208 GCU_PROT_PROP (gccv::Text*, TextItem)
00209 };
00210
00211 }
00212
00213 #endif //GCHEMPAINT_TEXT_OBJECT_H