umbrello API Documentation

messagewidget.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-2007                                               *
00009  *   Umbrello UML Modeller Authors <uml-devel@uml.sf.net>                  *
00010  ***************************************************************************/
00011 
00012 #ifndef MESSAGEWIDGET_H
00013 #define MESSAGEWIDGET_H
00014 
00015 #include "umlwidget.h"
00016 #include "linkwidget.h"
00017 
00018 // forward declarations
00019 class FloatingTextWidget;
00020 class ObjectWidget;
00021 class UMLOperation;
00022 class MessageWidgetController;
00023 
00041 class MessageWidget : public UMLWidget, public LinkWidget {
00042     Q_OBJECT
00043 public:
00044     friend class MessageWidgetController;
00045 
00057     MessageWidget(UMLView * view, ObjectWidget* a, ObjectWidget* b,
00058                   int y, Uml::Sequence_Message_Type sequenceMessageType,
00059                   Uml::IDType id = Uml::id_None);
00060 
00067     MessageWidget(UMLView * view, Uml::Sequence_Message_Type sequenceMessageType, Uml::IDType id = Uml::id_None);
00068 
00072     void init();
00073 
00077     virtual ~MessageWidget();
00078 
00082     void setSequenceNumber( const QString &sequenceNumber );
00083 
00087     QString getSequenceNumber() const;
00088 
00092     Uml::Sequence_Message_Type getSequenceMessageType() const {
00093         return m_sequenceMessageType;
00094     }
00095 
00102     bool contains(ObjectWidget * w);
00103 
00109     ObjectWidget* getWidget(Uml::Role_Type role);
00110 
00116     void setWidget(ObjectWidget * ow, Uml::Role_Type role) ;
00117 
00123     FloatingTextWidget * getFloatingTextWidget() {
00124         return m_pFText;
00125     }
00126 
00132     void setFloatingTextWidget(FloatingTextWidget * f) {
00133         m_pFText = f;
00134     }
00135 
00140     void lwSetFont (QFont font);
00141 
00147     UMLClassifier *getOperationOwner();
00148 
00153     UMLOperation *getOperation();
00154 
00159     void setOperation(UMLOperation *op);
00160 
00165     QString getCustomOpText();
00166 
00171     void setCustomOpText(const QString &opText);
00172 
00179     void setMessageText(FloatingTextWidget *ft);
00180 
00188     void setText(FloatingTextWidget *ft, const QString &newText);
00189 
00197     void setSeqNumAndOp(const QString &seqNum, const QString &op);
00198 
00206     UMLClassifier * getSeqNumAndOp(QString& seqNum, QString& op);
00207 
00211     void calculateWidget();
00212 
00217     bool activate(IDChangeLog * Log = 0);
00218 
00225     void calculateDimensions();
00226 
00230     void calculateDimensionsSynchronous();
00231 
00235     void calculateDimensionsAsynchronous();
00236 
00240     void calculateDimensionsCreation();
00241 
00245     void draw(QPainter& p, int offsetX, int offsetY);
00246 
00252     void drawSynchronous(QPainter& p, int offsetX, int offsetY);
00253 
00257     void drawAsynchronous(QPainter& p, int offsetX, int offsetY);
00258 
00264     void drawCreation(QPainter& p, int offsetX, int offsetY);
00265 
00269     void setTextPosition();
00270 
00281     void constrainTextPos(int &textX, int &textY, int textWidth, int textHeight,
00282                           Uml::Text_Role tr);
00283 
00287     void cleanup();
00288 
00294     void setSelected(bool _select);
00295 
00301     int getMinY();
00302 
00308     int getMaxY();
00309 
00320     int onWidget(const QPoint & p);
00321 
00325     void saveToXMI( QDomDocument & qDoc, QDomElement & qElement );
00326 
00330     bool loadFromXMI( QDomElement & qElement );
00331 
00332 protected:
00337     void setLinkAndTextPos();
00338 
00343     int constrainX(int textX, int textWidth, Uml::Text_Role tr);
00344 
00351     static void drawArrow( QPainter& p, int x, int y, int w,
00352                            Qt::ArrowType direction, bool useDottedLine = false );
00353 
00358     static void drawSolidArrowhead(QPainter& p, int x, int y, Qt::ArrowType direction);
00359 
00364     void updateResizability();
00365 
00366     // Data loaded/saved
00367     QString m_SequenceNumber;
00368     QString m_CustomOp;
00372     Uml::Sequence_Message_Type m_sequenceMessageType;
00373 
00374 private:
00375     void moveEvent(QMoveEvent */*m*/);
00376     void resizeEvent(QResizeEvent */*re*/);
00377 
00378     ObjectWidget * m_pOw[2];
00379     FloatingTextWidget * m_pFText;
00380     int m_nY;
00386     Uml::IDType m_widgetAId, m_widgetBId, m_textId;
00387 
00388 public slots:
00389     void slotWidgetMoved(Uml::IDType id);
00390     void slotMenuSelection(int sel);
00391 signals:
00396     void sigMessageMoved();
00397 };
00398 
00399 #endif
KDE Logo
This file is part of the documentation for umbrello Version 3.1.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Jun 26 08:07:58 2007 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003