SciFigs/TextEdit.h
Go to the documentation of this file.
00001 /***************************************************************************
00002 **
00003 **  This file is part of SciFigs.
00004 **
00005 **  This library is free software; you can redistribute it and/or
00006 **  modify it under the terms of the GNU Lesser General Public
00007 **  License as published by the Free Software Foundation; either
00008 **  version 2.1 of the License, or (at your option) any later version.
00009 **
00010 **  This file is distributed in the hope that it will be useful, but WITHOUT
00011 **  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 **  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
00013 **  License for more details.
00014 **
00015 **  You should have received a copy of the GNU Lesser General Public
00016 **  License along with this library; if not, write to the Free Software
00017 **  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00018 **
00019 **  See http://www.geopsy.org for more information.
00020 **
00021 **  Created : 2003-07-30
00022 **  Authors :
00023 **    Marc Wathelet
00024 **    Marc Wathelet (ULg, Liège, Belgium)
00025 **    Marc Wathelet (LGIT, Grenoble, France)
00026 **
00027 ***************************************************************************/
00028 
00029 #ifndef TEXTEDIT_H
00030 #define TEXTEDIT_H
00031 
00032 #include "GraphicObject.h"
00033 
00034 namespace SciFigs {
00035 
00036 class TextEditProperties;
00037 
00038 class SCIFIGS_EXPORT TextEdit :  public GraphicObject
00039 {
00040   Q_OBJECT
00041   Q_PROPERTY(bool textAsData READ isTextAsData WRITE setTextAsData SCRIPTABLE true)
00042   Q_PROPERTY(QString text READ text WRITE setText SCRIPTABLE true)
00043   Q_PROPERTY(QString font READ fontString WRITE setFontString SCRIPTABLE true)
00044   Q_PROPERTY(bool adjustBox READ adjustBox WRITE setAdjustBox SCRIPTABLE true)
00045 public:
00046   TextEdit(QWidget * parent=0);
00047   ~TextEdit();
00048 
00049   virtual const QString& xml_tagName() const {return xmlTextEditTag;}
00050   static const QString xmlTextEditTag;
00051 
00052   QString text() const {return _text;}
00053   void setText(QString t) {_text=t;}
00054 
00055   bool adjustBox() const {return _adjustBox;}
00056   void setAdjustBox(bool t) {_adjustBox=t;}
00057 
00058   bool isTextAsData() const {return _textAsData;}
00059   void setTextAsData(bool b) {_textAsData=b;}
00060 
00061   QString fontString() const {return font().toString();}
00062   void setFontString(QString fs) {QFont f;f.fromString(fs);setFont(f);}
00063 
00064   virtual void polish();
00065   virtual void update();
00066 
00067   virtual void addProperties(PropertyProxy * pp);
00068   virtual void removeProperties(PropertyProxy * pp);
00069   virtual void properties(PropertyWidget * w) const;
00070   virtual void setProperty(uint wid, int pid, QVariant val);
00071 protected:
00072   void adjustSize();
00073   void adjustSize(int& width, int& height);
00074   virtual void paint(QPainter& p, double dotpercm,int w, int h, bool mask);
00075   virtual void setPrintSize(double dotpercm);
00076 
00077   virtual XMLMember xml_member(XML_MEMBER_ARGS);
00078   virtual bool xml_setProperty(XML_SETPROPERTY_ARGS);
00079 
00080   QString _text;
00081   bool _adjustBox;
00082   bool _textAsData;
00083 
00084   static uint _category, _tabFormat;
00085 };
00086 
00087 } // namespace SciFigs
00088 
00089 #endif // TEXTEDIT_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines