widgetbase.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) 2004-2007 * 00009 * Umbrello UML Modeller Authors <uml-devel@uml.sf.net> * 00010 ***************************************************************************/ 00011 00012 #ifndef WIDGETBASE_H 00013 #define WIDGETBASE_H 00014 00015 #include <qobject.h> 00016 #include <qcolor.h> 00017 #include <qdom.h> 00018 00019 #include "umlnamespace.h" 00020 00021 // forward declarations 00022 class UMLView; 00023 class UMLObject; 00024 00030 class WidgetBase : public QObject { 00031 Q_OBJECT 00032 public: 00038 WidgetBase(UMLView * view); 00039 00043 virtual ~WidgetBase() {} 00044 00048 void setBaseType(Uml::Widget_Type type); 00049 00053 Uml::Widget_Type getBaseType() const; 00054 00060 UMLObject *getUMLObject(); 00061 00066 const UMLView *getUMLView() const { return m_pView; }; 00067 00073 virtual void setUMLObject(UMLObject * o); 00074 00080 virtual QString getDoc() const; 00081 00088 virtual void setDoc( const QString &doc ); 00089 00095 virtual void setLineColor(const QColor &colour); 00096 00102 virtual void setLineWidth(uint width); 00103 00107 QColor getLineColor() const { 00108 return m_LineColour; 00109 } 00110 00114 uint getLineWidth() const { 00115 return m_LineWidth; 00116 } 00117 00121 bool getUsesDiagramLineColour() const { 00122 return m_bUsesDiagramLineColour; 00123 } 00124 00128 bool getUsesDiagramLineWidth() const { 00129 return m_bUsesDiagramLineWidth; 00130 } 00131 00135 void setUsesDiagramLineColour(bool usesDiagramLineColour) { 00136 m_bUsesDiagramLineColour = usesDiagramLineColour; 00137 } 00138 00142 void setUsesDiagramLineWidth(bool usesDiagramLineWidth) { 00143 m_bUsesDiagramLineWidth = usesDiagramLineWidth; 00144 } 00145 00149 void setID( Uml::IDType id ); 00150 00154 Uml::IDType getID() const; 00155 00156 virtual void saveToXMI( QDomDocument & qDoc, QDomElement & qElement ); 00157 00158 virtual bool loadFromXMI( QDomElement & qElement ); 00159 00160 protected: 00164 void init(UMLView *view, Uml::Widget_Type type = Uml::wt_UMLWidget); 00165 00169 Uml::Widget_Type m_Type; 00170 00171 UMLView *m_pView; 00172 UMLObject *m_pObject; 00173 QString m_Doc; 00174 00180 Uml::IDType m_nId; 00181 00185 QColor m_LineColour; 00186 00190 uint m_LineWidth; 00191 00197 bool m_bUsesDiagramLineColour, m_bUsesDiagramLineWidth; 00198 00199 }; 00200 00201 #endif
