floatingtextwidget.h
00001 /*************************************************************************** 00002 * * 00003 * This program is free software; you can redistribute it and/or modify * 00004 * it under the terms of the GNU General Public License as published by * 00005 * the Free Software Foundation; either version 2 of the License, or * 00006 * (at your option) any later version. * 00007 * * 00008 * copyright (C) 2002-2006 * 00009 * Umbrello UML Modeller Authors <uml-devel@uml.sf.net> * 00010 ***************************************************************************/ 00011 00012 #ifndef FLOATINGTEXTWIDGET_H 00013 #define FLOATINGTEXTWIDGET_H 00014 00015 #include "umlwidget.h" 00016 #include "linkwidget.h" 00017 00018 class UMLView; 00019 00020 class FloatingTextWidgetController; 00021 00038 class FloatingTextWidget : public UMLWidget { 00039 Q_OBJECT 00040 public: 00041 friend class FloatingTextWidgetController; 00042 00049 static const int restrictPositionMin = 0; 00050 static const int restrictPositionMax = 3000; 00051 00052 00061 explicit FloatingTextWidget(UMLView * view, Uml::Text_Role role = Uml::tr_Floating, 00062 const QString& text = "", Uml::IDType id = Uml::id_None); 00063 00067 virtual ~FloatingTextWidget(); 00068 00074 void setText(const QString &t); 00075 00080 void setPreText(const QString &t); 00081 00086 void setPostText(const QString &t); 00087 00093 void setSeqNum(const QString &sn); 00094 00100 QString getSeqNum() const; 00101 00107 void setOperation(const QString &op); 00108 00123 QString getText() const; 00124 00131 QString getPreText() const; 00132 00139 QString getPostText() const; 00140 00147 QString getDisplayText() const; 00148 00152 void changeTextDlg(); 00153 00159 void setLink(LinkWidget * l); 00160 00166 LinkWidget * getLink(); 00167 00174 bool isText() { 00175 return true; 00176 } 00177 00184 bool activate( IDChangeLog* ChangeLog = 0 ); 00185 00191 void setRole(Uml::Text_Role role); 00192 00198 Uml::Text_Role getRole() const; 00199 00207 static bool isTextValid(const QString &text); 00208 00212 void draw(QPainter & p, int offsetX, int offsetY); 00213 00218 void handleRename(); 00219 00223 void showOpDlg(); 00224 00231 void showProperties(); 00232 00236 void saveToXMI( QDomDocument & qDoc, QDomElement & qElement ); 00237 00241 bool loadFromXMI( QDomElement & qElement ); 00242 00243 public slots: 00251 void slotMenuSelection(int sel); 00252 00257 void setMessageText(); 00258 00259 protected: 00263 QSize calculateSize(); 00264 00265 private: 00269 void init(); 00270 00274 void resizeEvent(QResizeEvent* /*re*/); 00275 00279 LinkWidget * m_pLink; 00280 00282 00284 QString m_PreText; 00289 QString m_PostText; 00290 00294 Uml::Text_Role m_Role; 00295 00296 }; 00297 00298 #endif
