text-object.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 /* 
00004  * GChemPaint libray
00005  * text-object.h 
00006  *
00007  * Copyright (C) 2002-2007 Jean Bréfort <jean.brefort@normalesup.org>
00008  *
00009  * This program is free software; you can redistribute it and/or 
00010  * modify it under the terms of the GNU General Public License as 
00011  * published by the Free Software Foundation; either version 2 of the
00012  * License, or (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
00022  * USA
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-tag.h>
00032 #include <pango/pango-layout.h>
00033 #include <string>
00034 
00036 namespace gcp {
00037 
00043 class TextObject: public gcu::Object
00044 {
00045 public:
00051         TextObject (gcu::TypeId Type);
00059         TextObject (double x, double y, gcu::TypeId Type);
00063         virtual ~TextObject ();
00064 
00071         void GetSize (double& x, double& y) {x = m_length; y = m_height;}
00076         xmlNodePtr SaveSelected ();
00082         void LoadSelected (xmlNodePtr node);
00089         virtual bool OnChanged (bool save) = 0;
00096         void OnSelChanged (gccv::TextSelBounds *bounds);
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 protected:
00148         double m_x;
00152         double m_y;
00156         double m_length;
00160         double m_height;
00164         int m_ascent;
00168         int m_InsertOffset;
00172         std::string m_buf;
00176         bool m_bLoading;
00180         unsigned m_StartSel;
00184         unsigned m_EndSel;
00189         bool m_RealSave;
00190 
00199 GCU_PROT_PROP (GtkAnchorType, Anchor);
00206 GCU_PROT_PROP (gccv::TextTagList, TagList);
00207 };
00208 
00209 }       // namespace gcp
00210 
00211 #endif  //GCHEMPAINT_TEXT_OBJECT_H

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