Update of /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views In directory usw-pr-cvs1:/tmp/cvs-serv2714/common/views Modified Files: AbstractView.cpp AbstractView.h CircleView.h LineView.cpp LineView.h ManipulatorHandle.h PaintAttributes.cpp PaintAttributes.h PolygonView.h Positionable.h Rectangle.h RectangleView.cpp RectangleView.h Selectable.h SelectableView.cpp SelectableView.h SelectionHandle.cpp SelectionHandle.h TextView.cpp TextView.h View.h ViewFactory.cpp Log Message: Added more basic implementation for user interaction Index: AbstractView.cpp =================================================================== RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/AbstractView.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -r1.1.1.1 -r1.2 *** AbstractView.cpp 2001/06/20 19:21:28 1.1.1.1 --- AbstractView.cpp 2001/07/22 23:21:38 1.2 *************** *** 1,2 **** --- 1,4 ---- + + /*************************************************************************** AbstractView.cpp - description *************** *** 7,25 **** email : sta...@in... ***************************************************************************/ ! /*************************************************************************** ! * * ! * 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. * ! * * ! ***************************************************************************/ ! class View; class ViewLayouter; - #include "AbstractView.h" - void AbstractView::paint(QPainter * painter){ // Set paint attributes --- 9,35 ---- email : sta...@in... ***************************************************************************/ + #include "AbstractView.h" ! #include <qevent.h> ! void AbstractView::mouseRMBPress(QMouseEvent * e){ ! } ! void AbstractView::mouseRelease(QMouseEvent* e){ ! } ! void AbstractView::mousePress(QMouseEvent * e){ ! if(Qt::LeftButton == e->button()) ! mouseLMBPress(e); ! else ! if(Qt::RightButton == e->button()) ! mouseRMBPress(e); ! } ! void AbstractView::mouseMove(QMouseEvent* e){ ! } ! void AbstractView::mouseLMBPress(QMouseEvent * e){ ! } ! void AbstractView::mouseDblClick(QMouseEvent* e){ ! } class ViewLayouter; void AbstractView::paint(QPainter * painter){ // Set paint attributes *************** *** 38,46 **** } ! AbstractView::AbstractView(){ } ! void AbstractView::setCenter(QPoint& p){ } ! QPoint& AbstractView::getCenter(){ } --- 48,57 ---- } ! AbstractView::AbstractView(Viewer* viewer, View * parent){ ! this->parent = parent; } ! void AbstractView::setCenter(const QPoint& p){ } ! QPoint AbstractView::getCenter(){ } *************** *** 50,62 **** } - void AbstractView::mouseDblClick(QMouseEvent* e){ - } - void AbstractView::mouseRelease(QMouseEvent* e){ - } - void AbstractView::mousePress(QMouseEvent* e){ - } - void AbstractView::mouseMove(QMouseEvent* e){ - } View* AbstractView::getParent(){ } void AbstractView::remove(View * v){ --- 61,66 ---- } View* AbstractView::getParent(){ + return parent; } void AbstractView::remove(View * v){ *************** *** 64,68 **** void AbstractView::add(View * v){ } ! bool AbstractView::intersects(QPoint &p){ } QRect & AbstractView::bounds() { --- 68,72 ---- void AbstractView::add(View * v){ } ! bool AbstractView::intersects(const QPoint &p){ } QRect & AbstractView::bounds() { Index: AbstractView.h =================================================================== RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/AbstractView.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -r1.1.1.1 -r1.2 *** AbstractView.h 2001/06/20 19:21:27 1.1.1.1 --- AbstractView.h 2001/07/22 23:21:38 1.2 *************** *** 28,32 **** --- 28,34 ---- #include <vector.h> + class Editor; + class QPopupMenu; class ViewLayouter; *************** *** 34,38 **** public: ! AbstractView(); virtual ~AbstractView(); --- 36,40 ---- public: ! AbstractView(Viewer* viewer = 0, View * parent = 0); virtual ~AbstractView(); *************** *** 40,44 **** virtual QRect & bounds(); ! virtual bool intersects(QPoint & p); virtual void remove(View * v); --- 42,46 ---- virtual QRect & bounds(); ! virtual bool intersects(const QPoint & p); virtual void remove(View * v); *************** *** 46,50 **** virtual void add(View * v); ! View* getParent(); virtual void mouseDblClick(QMouseEvent* e); --- 48,52 ---- virtual void add(View * v); ! virtual View* getParent(); virtual void mouseDblClick(QMouseEvent* e); *************** *** 52,57 **** virtual void mouseRelease(QMouseEvent* e); - virtual void mousePress(QMouseEvent* e); - virtual void mouseMove(QMouseEvent* e); --- 54,57 ---- *************** *** 60,76 **** void setLayouter(ViewLayouter* l); ! virtual QPoint& getCenter(); ! virtual void setCenter(QPoint& p); ! void changed(); virtual void update(); - private: ! /** @link aggregation */ ! PaintAttributes paintAttributes; /** @link aggregation */ --- 60,87 ---- void setLayouter(ViewLayouter* l); ! virtual QPoint getCenter(); ! virtual void setCenter(const QPoint& p); ! virtual void changed(); virtual void update(); + /** + * This implementation sets the paint attributes and call paintContents() + * to paint the content. + */ + virtual void paint(QPainter * painter); + + virtual Viewer* getViewer() { + return viewer; + } + + virtual void setViewer(Viewer *v) { + viewer = v; + } ! private: /** @link aggregation */ *************** *** 79,83 **** --- 90,99 ---- ViewLayouter * lnkLayouter; + View *parent; + Viewer *viewer; + protected: + /** @link aggregation */ + PaintAttributes paintAttributes; /** *************** *** 90,100 **** public: - /** - * This implementation sets the paint attributes and call drawContents() - * to paint the content. - */ - virtual void paint(QPainter * painter); ! protected: }; #endif //ABSTRACTVIEW_H --- 106,122 ---- public: ! /** Left mouse button clicked ! * Implement this in your sub classes ! */ ! virtual void mouseLMBPress(QMouseEvent * e); ! ! /** Right mouse button clicked ! * Implement this in your sub classes ! */ ! virtual void mouseRMBPress(QMouseEvent * e); ! ! virtual void mousePress(QMouseEvent * e); ! }; #endif //ABSTRACTVIEW_H Index: CircleView.h =================================================================== RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/CircleView.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -r1.1.1.1 -r1.2 *** CircleView.h 2001/06/20 19:21:27 1.1.1.1 --- CircleView.h 2001/07/22 23:21:38 1.2 *************** *** 22,25 **** --- 22,30 ---- class CircleView : public SelectableView { + public: + + virtual ~CircleView(); + + CircleView(Viewer * viewer = 0, View * parent = 0): SelectableView(viewer, parent) {} }; #endif //CIRCLEVIEW_H Index: LineView.cpp =================================================================== RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/LineView.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -r1.1.1.1 -r1.2 *** LineView.cpp 2001/06/20 19:21:29 1.1.1.1 --- LineView.cpp 2001/07/22 23:21:38 1.2 *************** *** 19,20 **** --- 19,23 ---- #include "LineView.h" + LineView::~LineView(){} + LineView::LineView(Viewer * viewer, View * parent) : SelectableView(viewer, parent) { + } Index: LineView.h =================================================================== RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/LineView.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -r1.1.1.1 -r1.2 *** LineView.h 2001/06/20 19:21:27 1.1.1.1 --- LineView.h 2001/07/22 23:21:38 1.2 *************** *** 27,30 **** --- 27,34 ---- public: + LineView(Viewer * viewer = 0, View * parent = 0); + + virtual ~LineView(); + virtual QPoint& getStartPoint() {} virtual void setStartPoint(QPoint& p) {} Index: ManipulatorHandle.h =================================================================== RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/ManipulatorHandle.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -r1.1.1.1 -r1.2 *** ManipulatorHandle.h 2001/06/20 19:21:29 1.1.1.1 --- ManipulatorHandle.h 2001/07/22 23:21:38 1.2 *************** *** 31,34 **** --- 31,36 ---- virtual void setName(string& n) = 0; + + virtual int getId() = 0; }; Index: PaintAttributes.cpp =================================================================== RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/PaintAttributes.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -r1.1.1.1 -r1.2 *** PaintAttributes.cpp 2001/06/20 19:21:29 1.1.1.1 --- PaintAttributes.cpp 2001/07/22 23:21:38 1.2 *************** *** 35,39 **** painter->setFont(font); ! painter->setPen(QPen(lineColor, lineWidth, Qt::SolidLine)); } QColor& PaintAttributes::getLineColor(){ --- 35,39 ---- painter->setFont(font); ! // painter->setPen(QPen(lineColor, lineWidth, Qt::SolidLine)); } QColor& PaintAttributes::getLineColor(){ *************** *** 48,52 **** return font; } ! void PaintAttributes::setBackgroundColor(QColor& backgroundColor){ this->backgroundColor = backgroundColor; } --- 48,52 ---- return font; } ! void PaintAttributes::setBackgroundColor(const QColor & backgroundColor){ this->backgroundColor = backgroundColor; } Index: PaintAttributes.h =================================================================== RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/PaintAttributes.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -r1.1.1.1 -r1.2 *** PaintAttributes.h 2001/06/20 19:21:27 1.1.1.1 --- PaintAttributes.h 2001/07/22 23:21:38 1.2 *************** *** 25,32 **** class PaintAttributes { public: ! QColor& getBackgroundColor(); ! void setBackgroundColor(QColor& backgroundColor); QFont& getFont(); --- 25,32 ---- class PaintAttributes { public: ! PaintAttributes() : backgroundColor(Qt::white), lineColor(Qt::black) {} QColor& getBackgroundColor(); ! void setBackgroundColor(const QColor & backgroundColor); QFont& getFont(); Index: PolygonView.h =================================================================== RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/PolygonView.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -r1.1.1.1 -r1.2 *** PolygonView.h 2001/06/20 19:21:27 1.1.1.1 --- PolygonView.h 2001/07/22 23:21:38 1.2 *************** *** 22,25 **** --- 22,30 ---- class PolygonView : public SelectableView { + public: + + virtual ~PolygonView(); + + PolygonView(Viewer * viewer = 0, View * parent = 0): SelectableView(viewer, parent) {} }; #endif //POLYGONVIEW_H Index: Positionable.h =================================================================== RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/Positionable.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -r1.1.1.1 -r1.2 *** Positionable.h 2001/06/20 19:21:27 1.1.1.1 --- Positionable.h 2001/07/22 23:21:38 1.2 *************** *** 26,32 **** public: ! virtual void setCenter(QPoint& p) = 0; ! virtual QPoint& getCenter() = 0; }; #endif //POSITIONABLE_H --- 26,32 ---- public: ! virtual void setCenter(const QPoint& p) = 0; ! virtual QPoint getCenter() = 0; }; #endif //POSITIONABLE_H Index: Rectangle.h =================================================================== RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/Rectangle.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -r1.1.1.1 -r1.2 *** Rectangle.h 2001/06/20 19:21:29 1.1.1.1 --- Rectangle.h 2001/07/22 23:21:38 1.2 *************** *** 26,37 **** public: ! virtual void setRectangle(QRect& r) = 0; virtual QRect& getRectangle() = 0; ! virtual void setTopLeft(QPoint& r) = 0; ! virtual QPoint& getTopLeft() = 0; ! virtual void setBottomRight(QPoint& r) = 0; ! virtual QPoint& getBottomRight() = 0; }; --- 26,37 ---- public: ! virtual void setRectangle(const QRect& r) = 0; virtual QRect& getRectangle() = 0; ! virtual void setTopLeft(const QPoint& r) = 0; ! virtual QPoint getTopLeft() = 0; ! virtual void setBottomRight(const QPoint& r) = 0; ! virtual QPoint getBottomRight() = 0; }; Index: RectangleView.cpp =================================================================== RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/RectangleView.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -r1.1.1.1 -r1.2 *** RectangleView.cpp 2001/06/20 19:21:29 1.1.1.1 --- RectangleView.cpp 2001/07/22 23:21:38 1.2 *************** *** 1,2 **** --- 1,4 ---- + + /*************************************************************************** RectangleView.cpp - description *************** *** 7,41 **** email : sta...@in... ***************************************************************************/ - - /*************************************************************************** - * * - * 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. * - * * - ***************************************************************************/ - #include "RectangleView.h" #include <qpainter.h> RectangleView::~RectangleView(){ } ! RectangleView::RectangleView(){ } QRect& RectangleView::bounds() { return getRectangle(); } - void RectangleView::setRectangle(QRect& rectangle){ - this->rectangle = rectangle; } QRect& RectangleView::getRectangle(){ ! return rectangle; } ! QPoint& RectangleView::getTopLeft() { } ! void RectangleView::setTopLeft(QPoint& p) { } ! QPoint& RectangleView::getBottomRight() { } ! void RectangleView::setBottomRight(QPoint& p) { } void RectangleView::paintContents(QPainter * painter) { --- 9,59 ---- email : sta...@in... ***************************************************************************/ #include "RectangleView.h" + #include "ige/common/manipulators/RectangleViewResizer.h" + #include <qpainter.h> + QPoint RectangleView::getCenter(){ + return rectangle.center(); + } + void RectangleView::setCenter(const QPoint& p){ + rectangle.moveCenter(p); + } + ViewManipulator* RectangleView::createManipulator() { + // qDebug("RectangleView::createManipulator() executed"); + RectangleViewResizer *manipulator = new RectangleViewResizer(this); + return manipulator; + } + bool RectangleView::intersects(const QPoint &p) { + if(rectangle.contains(p)) + return true; + else + return false; + } RectangleView::~RectangleView(){ } ! RectangleView::RectangleView(Viewer * viewer, View * parent) : rectangle(70,80,100,70), SelectableView(viewer, parent) { ! paintAttributes.setBackgroundColor(Qt::green); } QRect& RectangleView::bounds() { return getRectangle(); + } + void RectangleView::setRectangle(const QRect& rectangle){ + this->rectangle = rectangle; } QRect& RectangleView::getRectangle(){ ! return rectangle; ! } ! QPoint RectangleView::getTopLeft() { ! return rectangle.topLeft(); } ! void RectangleView::setTopLeft(const QPoint& p) { ! rectangle.moveTopLeft(p); } ! QPoint RectangleView::getBottomRight() { ! return rectangle.bottomRight(); } ! void RectangleView::setBottomRight(const QPoint& p) { ! rectangle.moveBottomRight(p); } void RectangleView::paintContents(QPainter * painter) { Index: RectangleView.h =================================================================== RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/RectangleView.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -r1.1.1.1 -r1.2 *** RectangleView.h 2001/06/20 19:21:28 1.1.1.1 --- RectangleView.h 2001/07/22 23:21:38 1.2 *************** *** 25,51 **** public: ! RectangleView(); virtual ~RectangleView(); ! virtual void setTopLeft(QPoint& p); ! virtual QPoint& getTopLeft(); ! virtual void setBottomRight(QPoint& p); ! virtual QPoint& getBottomRight(); virtual QRect& getRectangle(); ! virtual void setRectangle(QRect& rectangle); virtual QRect& bounds(); private: QRect rectangle; protected: virtual void paintContents(QPainter * painter); }; #endif //RECTANGLEVIEW_H --- 25,65 ---- public: ! RectangleView(Viewer * viewer = 0, View * parent = 0); virtual ~RectangleView(); ! virtual void setTopLeft(const QPoint& p); ! virtual QPoint getTopLeft(); ! virtual void setBottomRight(const QPoint& p); ! virtual QPoint getBottomRight(); virtual QRect& getRectangle(); ! virtual void setRectangle(const QRect& rectangle); virtual QRect& bounds(); + /** + * Returns true if the view collides with the given mouse position + */ + virtual bool intersects(const QPoint &p); + + virtual ViewManipulator* createManipulator(); + private: QRect rectangle; protected: virtual void paintContents(QPainter * painter); + public: + + virtual void setCenter(const QPoint& p); + + virtual QPoint getCenter(); + + protected: }; #endif //RECTANGLEVIEW_H Index: Selectable.h =================================================================== RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/Selectable.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -r1.1.1.1 -r1.2 *** Selectable.h 2001/06/20 19:21:28 1.1.1.1 --- Selectable.h 2001/07/22 23:21:38 1.2 *************** *** 34,37 **** --- 34,41 ---- virtual bool isSelected() = 0; + + virtual void select() = 0; + + virtual void unselect() = 0; }; #endif //SELECTABLE_H Index: SelectableView.cpp =================================================================== RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/SelectableView.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -r1.1.1.1 -r1.2 *** SelectableView.cpp 2001/06/20 19:21:29 1.1.1.1 --- SelectableView.cpp 2001/07/22 23:21:38 1.2 *************** *** 1,2 **** --- 1,4 ---- + + /*************************************************************************** SelectableView.cpp - description *************** *** 7,22 **** email : sta...@in... ***************************************************************************/ ! /*************************************************************************** ! * * ! * 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. * ! * * ! ***************************************************************************/ - #include "SelectableView.h" SelectableView::~SelectableView(){} ! SelectableView::SelectableView(){} --- 9,81 ---- email : sta...@in... ***************************************************************************/ + #include "SelectableView.h" + #include "ige/common/editors/Viewer.h" + #include "ige/common/editors/Editor.h" + #include "ige/common/manipulators/ViewSelector.h" ! #include <qpopupmenu.h> + void SelectableView::mouseRMBPress(QMouseEvent * e){ + if(isSelected() == false) { + select(); + Viewer *v = getViewer(); + Editor *ed = v->getEditor(); + + selector = (ViewSelector*) ed->addManipulator(this); + } + + // A right mouse button click on the view opens the context menu + QPopupMenu *menu = 0; + menu = createPopupMenu(); + if(menu) { + menu->exec(QCursor::pos()); + delete menu; + } + } + void SelectableView::mouseLMBPress(QMouseEvent * e){ + qDebug("View clicked"); + // A left mouse button click on the view selects it + if(isSelected() == false) { + select(); + Viewer *v = getViewer(); + Editor *ed = v->getEditor(); + + selector = (ViewSelector*) ed->addManipulator(this); + } + + // Hier morgen weitermachen !!!! + /* ViewManipulator *m = createManipulator(); + CHECK_PTR(m); + ed->addManipulator(m); + selector = (ViewSelector*)m;*/ + + } + QPopupMenu* SelectableView::createPopupMenu() { + QPopupMenu *menu = new QPopupMenu(); + menu->setCaption("Selectable View"); + menu ->insertItem("Copy (N/A)"); + menu ->insertItem("Cut (N/A)"); + menu ->insertItem("Delete (N/A)"); + // menu ->insertSeperator(); + menu ->insertItem("Properties (N/A)"); + + return menu; + } + void SelectableView::select(){ + if(selected == false) { + selected = true; + } + } + void SelectableView::unselect(){ + if(selected == true) { + selected = false; + if(selector) + delete selector; + } + } SelectableView::~SelectableView(){} ! SelectableView::SelectableView(Viewer* viewer, View * parent) : AbstractView(viewer, parent) { ! selector = 0; ! selected = false; ! } Index: SelectableView.h =================================================================== RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/SelectableView.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -r1.1.1.1 -r1.2 *** SelectableView.h 2001/06/20 19:21:28 1.1.1.1 --- SelectableView.h 2001/07/22 23:21:38 1.2 *************** *** 24,27 **** --- 24,28 ---- #include "Clonable.h" class ViewManipulator; + class ViewSelector; class View; *************** *** 29,47 **** public: ! /** Factory method. Implement this your subclasses to create the desired object. ! */ ! - SelectableView(); - virtual ~SelectableView(); - virtual SelectableView* createShallowCopy() { - return 0; - } - /** Factory method. Implement this your subclasses to create the desired object. */ ! virtual SelectableView* createDeepCopy() { return 0; } --- 30,40 ---- public: ! SelectableView(Viewer* viewer = 0, View * parent = 0); virtual ~SelectableView(); /** Factory method. Implement this your subclasses to create the desired object. */ ! virtual SelectableView* createShallowCopy() { return 0; } *************** *** 49,53 **** /** Factory method. Implement this your subclasses to create the desired object. */ ! virtual QPopupMenu* createPopupMenu() { return 0; } --- 42,46 ---- /** Factory method. Implement this your subclasses to create the desired object. */ ! virtual SelectableView* createDeepCopy() { return 0; } *************** *** 62,65 **** --- 55,59 ---- */ virtual ViewManipulator* createManipulator() { + qDebug("SelectableView::createManipulator() executed"); return 0; } *************** *** 73,78 **** --- 67,83 ---- } + virtual void unselect(); + + virtual void select(); + + virtual QPopupMenu* createPopupMenu(); + + virtual void mouseLMBPress(QMouseEvent * e); + + virtual void mouseRMBPress(QMouseEvent * e); + private: bool selected; + ViewSelector *selector; }; #endif //SELECTABLEVIEW_H Index: SelectionHandle.cpp =================================================================== RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/SelectionHandle.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -r1.1.1.1 -r1.2 *** SelectionHandle.cpp 2001/06/20 19:21:29 1.1.1.1 --- SelectionHandle.cpp 2001/07/22 23:21:38 1.2 *************** *** 20,34 **** #include <qbrush.h> #include "SelectionHandle.h" void SelectionHandle::paintContents(QPainter * painter) { ! painter->drawRect(bounds()); } SelectionHandle::~SelectionHandle(){} ! class ViewManipulator; ! ! SelectionHandle::SelectionHandle(){} ! void SelectionHandle::setName(string& name){ this->name = name; } ! string& SelectionHandle::getName(){ return name; } ! void SelectionHandle::setOwner(ViewManipulator * owner){ this->owner = owner; } ! ViewManipulator * SelectionHandle::getOwner(){ return owner; } --- 20,59 ---- #include <qbrush.h> + //class ViewManipulator; + #include "SelectionHandle.h" + #include "ige/common/manipulators/ViewSelector.h" + + int SelectionHandle::SIZE = 6; void SelectionHandle::paintContents(QPainter * painter) { ! static QBrush b(Qt::Dense4Pattern); ! painter->fillRect(bounds(), b); } SelectionHandle::~SelectionHandle(){} ! SelectionHandle::SelectionHandle(ViewSelector * vs, int id, Viewer* viewer, View * parent) ! : RectangleView(viewer, parent) { ! getRectangle().setWidth(SIZE); ! getRectangle().setHeight(SIZE); ! CHECK_PTR(vs); ! owner = vs; ! this->id = id; ! } ! void SelectionHandle::mouseMove(QMouseEvent* e){ ! getOwner()->handleMoveEvent(this, e); ! } ! void SelectionHandle::mouseLMBPress(QMouseEvent * e) { ! getOwner()->handlePressEvent(this,e); ! } ! void SelectionHandle::setName(string& name){ ! this->name = name; ! } ! string& SelectionHandle::getName(){ ! return name; ! } ! void SelectionHandle::setOwner(ViewSelector * owner){ ! this->owner = owner; ! } ! ViewSelector * SelectionHandle::getOwner(){ ! return owner; ! } Index: SelectionHandle.h =================================================================== RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/SelectionHandle.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -r1.1.1.1 -r1.2 *** SelectionHandle.h 2001/06/20 19:21:28 1.1.1.1 --- SelectionHandle.h 2001/07/22 23:21:38 1.2 *************** *** 24,52 **** #include <string> - class ViewManipulator; - class SelectionHandle : public RectangleView , public ManipulatorHandle{ public: ! SelectionHandle(); virtual ~SelectionHandle(); ! ViewManipulator * getOwner(); ! void setOwner(ViewManipulator * owner); virtual string& getName(); virtual void setName(string& name); protected: virtual void paintContents(QPainter * painter); - - public: ! private: ! ViewManipulator * owner; string name; }; --- 24,66 ---- #include <string> + class ViewSelector; class SelectionHandle : public RectangleView , public ManipulatorHandle{ public: ! SelectionHandle(ViewSelector * vs, int id, Viewer* viewer = 0, View * parent = 0); virtual ~SelectionHandle(); + + /** This method will be invoked when the user clicks on the selection handle + */ + virtual void mouseLMBPress(QMouseEvent * e); ! ViewSelector * getOwner(); ! void setOwner(ViewSelector * owner); virtual string& getName(); virtual void setName(string& name); + + virtual int getId() { + return id; + } + + + + static int SIZE; + + /** Implementation of interface EventHandler */ + virtual void mouseMove(QMouseEvent* e); + protected: virtual void paintContents(QPainter * painter); ! private: ! int id; ! ViewSelector * owner; string name; }; Index: TextView.cpp =================================================================== RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/TextView.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -r1.1.1.1 -r1.2 *** TextView.cpp 2001/06/20 19:21:29 1.1.1.1 --- TextView.cpp 2001/07/22 23:21:38 1.2 *************** *** 22,27 **** TextView::~TextView(){} ! TextView::TextView(int param){} ! TextView::TextView(){} void TextView::paintContents(QPainter * painter) { painter->drawRect(bounds()); --- 22,28 ---- TextView::~TextView(){} ! ! TextView::TextView(Viewer * viewer, View * parent) : RectangleView(viewer, parent) { ! } void TextView::paintContents(QPainter * painter) { painter->drawRect(bounds()); Index: TextView.h =================================================================== RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/TextView.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -r1.1.1.1 -r1.2 *** TextView.h 2001/06/20 19:21:28 1.1.1.1 --- TextView.h 2001/07/22 23:21:38 1.2 *************** *** 26,32 **** public: ! TextView(); ! ! TextView(int param); virtual ~TextView(); --- 26,30 ---- public: ! TextView(Viewer * viewer = 0, View * parent = 0); virtual ~TextView(); Index: View.h =================================================================== RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/View.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -r1.1.1.1 -r1.2 *** View.h 2001/06/20 19:21:28 1.1.1.1 --- View.h 2001/07/22 23:21:38 1.2 *************** *** 25,28 **** --- 25,29 ---- #include <qrect.h> #include "ige/common/Observer.h" + class Viewer; class View; *************** *** 43,47 **** * Returns true if the view collides with the given mouse position */ ! virtual bool intersects(QPoint &p) = 0; /** --- 44,48 ---- * Returns true if the view collides with the given mouse position */ ! virtual bool intersects(const QPoint &p) = 0; /** *************** *** 61,64 **** --- 62,69 ---- */ virtual void changed() = 0; + + virtual Viewer* getViewer() = 0; + + virtual void setViewer(Viewer* v) = 0; }; #endif //VIEW_H Index: ViewFactory.cpp =================================================================== RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/ViewFactory.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -r1.1.1.1 -r1.2 *** ViewFactory.cpp 2001/06/20 19:21:29 1.1.1.1 --- ViewFactory.cpp 2001/07/22 23:21:38 1.2 *************** *** 18,24 **** #include "ViewFactory.h" ! TextView* ViewFactory::createText(){} class TextView; ViewFactory * ViewFactory::instance= 0; ViewFactory * ViewFactory::getInstance(){ --- 18,33 ---- #include "ViewFactory.h" ! #include "TextView.h" ! class TextView; + TextView* ViewFactory::createText(){ + qDebug("ViewFactory::createText() not implemented!"); + } + TextView* ViewFactory::create(TextModel * m){ + TextView *view = new TextView(); + return view; + } + ViewFactory * ViewFactory::instance= 0; ViewFactory * ViewFactory::getInstance(){ *************** *** 28,31 **** return instance; } - TextView* ViewFactory::create(TextModel * m){} ViewFactory::ViewFactory(){} --- 37,39 ---- |