From bd9e6617827818fd043452c08c606f07b78014a0 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdesdk@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- umbrello/umbrello/seqlinewidget.h | 135 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 umbrello/umbrello/seqlinewidget.h (limited to 'umbrello/umbrello/seqlinewidget.h') diff --git a/umbrello/umbrello/seqlinewidget.h b/umbrello/umbrello/seqlinewidget.h new file mode 100644 index 00000000..1978fafd --- /dev/null +++ b/umbrello/umbrello/seqlinewidget.h @@ -0,0 +1,135 @@ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * copyright (C) 2002-2007 * + * Umbrello UML Modeller Authors * + ***************************************************************************/ + +#ifndef SEQLINEWIDGET_H +#define SEQLINEWIDGET_H + +#include + +class UMLView; +class ObjectWidget; + +/** + * @short Widget class for graphical representation of sequence lines + * @author Paul Hensgen + * Bugs and comments to uml-devel@lists.sf.net or http://bugs.kde.org + */ +class SeqLineWidget : public QCanvasLine { +public: + /** + * Constructor. + */ + SeqLineWidget( UMLView * pView, ObjectWidget * pObject ); + + /** + * Destructor. + */ + ~SeqLineWidget(); + + /** + * Return whether on seq. line. + * Takes into account destruction box if shown. + * + * @param p The point to investigate. + * @return Non-zero if point is on this sequence line. + */ + int onWidget(const QPoint & p); + + /** + * Clean up anything before deletion. + */ + void cleanup(); + + /** + * Set up destruction box. + */ + void setupDestructionBox(); + + /** + * Set the start point of the line. + * + * @param startX X coordinate of the start point. + * @param startY Y coordinate of the start point. + */ + void setStartPoint( int startX, int startY ); + + /** + * Gets the length of the line. + * + * @return Length of the line. + */ + int getLineLength() { + return m_nLengthY; + } + + /** + * Returns the @ref ObjectWidget associated with this sequence line. + * + * @return Pointer to the associated ObjectWidget. + */ + ObjectWidget * getObjectWidget() { + return m_pObject; + } + + /** + * Sets the y position of the bottom of the vertical line. + * + * @param yPosition The y coordinate for the bottom of the line. + */ + void setEndOfLine(int yPosition); + +protected: + /** + * Clean up destruction box. + */ + void cleanupDestructionBox(); + + /** + * Move destruction box. + */ + void moveDestructionBox(); + + /** + * ObjectWidget associated with this sequence line. + */ + ObjectWidget * m_pObject; + + /** + * View displayed on. + */ + UMLView * m_pView; + + /// The destruction box. + struct DestructionBox { + QCanvasLine * line1; + QCanvasLine * line2; + void setLine1Points(QRect rect) { + line1->setPoints( rect.x(), rect.y(), + rect.x() + rect.width(), rect.y() + rect.height() ); + } + void setLine2Points(QRect rect) { + line2->setPoints( rect.x(), rect.y() + rect.height(), + rect.x() + rect.width(), rect.y() ); + } + } m_DestructionBox; + + /** + * The length of the line. + */ + int m_nLengthY; + + /** + * Margin used for mouse clicks. + */ + static int const m_nMouseDownEpsilonX; +}; + +#endif -- cgit v1.2.3