IvfSelectionHandler.h

00001 //
00002 // Copyright 1999-2006 by Structural Mechanics, Lund University.
00003 //
00004 // This library is free software; you can redistribute it and/or
00005 // modify it under the terms of the GNU Library General Public
00006 // License as published by the Free Software Foundation; either
00007 // version 2 of the License, or (at your option) any later version.
00008 //
00009 // This library is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 // Library General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU Library General Public
00015 // License along with this library; if not, write to the Free Software
00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00017 // USA.
00018 //
00019 // Please report all bugs and problems to "ivf@byggmek.lth.se".
00020 //
00021 //
00022 // Written by Jonas Lindemann
00023 //
00024 
00025 #ifndef _CIvfSelectionHandler_h_
00026 #define _CIvfSelectionHandler_h_
00027 
00028 #include <ivfwidget/IvfHandlerBase.h>
00029 #include <ivfwidget/IvfWidgetBase.h>
00030 
00031 #include <ivf/IvfScene.h>
00032 #include <ivf/IvfBufferSelection.h>
00033 
00035 class IVFWIDGET_API CIvfSingleSelectionEvent : public CIvfEventBase {
00036 public:
00043         virtual void onSelect(CIvfShape* shape) {};
00044 };
00045 
00047 class IVFWIDGET_API CIvfMultipleSelectionEvent : public CIvfEventBase {
00048 public:
00058         virtual void onSelectMultiple(CIvfSelectedShapesVector& shapes) {};
00059 };
00060 
00062 class IVFWIDGET_API CIvfHighlightEvent : public CIvfEventBase {
00063 public:
00072         virtual void onHighlight(CIvfShape* shape) {};
00073 };
00074 
00075 IvfSmartPointer(CIvfSelectionHandler);
00076 
00087 class IVFWIDGET_API CIvfSelectionHandler : public CIvfHandlerBase,
00088         CIvfMouseDownEvent,
00089         CIvfMouseMoveEvent,
00090         CIvfMouseUpEvent
00091 {
00092 private:
00093         CIvfWidgetBase* m_widget;
00094         CIvfScenePtr m_scene;
00095         CIvfShapePtr m_oldShape;
00096         CIvfBufferSelectionPtr m_selection;
00097         CIvfSingleSelectionEvent* m_singleSelectionEvent;
00098         CIvfMultipleSelectionEvent* m_multipleSelectionEvent;
00099         CIvfHighlightEvent* m_highlightEvent;
00100 
00101         void dispatchSingleSelectionEvent(CIvfShape* shape);
00102         void dispatchMultipleSelectionEvent(CIvfSelectedShapesVector& selectedShapes);
00103         void dispatchHighlightEvent(CIvfShape* shape);
00104 public:
00112         CIvfSelectionHandler(CIvfWidgetBase* widget, CIvfScene* scene);
00113         virtual ~CIvfSelectionHandler();
00114 
00115         IvfClassInfo("CIvfSelectionHandler",CIvfHandlerBase);
00116 
00118         void setSingleSelectionEvent(CIvfSingleSelectionEvent* event);
00119 
00121         void setMultipleSelectionEvent(CIvfMultipleSelectionEvent* event);
00122 
00124         void setHighlightEvent(CIvfHighlightEvent* event);
00125 
00126         virtual void doMouseUp(int x, int y);
00127         virtual void doMouseMove(int x, int y);
00128         virtual void doMouseDown(int x, int y);
00129 
00130         // Implemeted events
00131 
00132         virtual void onMouseMove(int x, int y);
00133         virtual void onMouseUp(int x, int y);
00134         virtual void onMouseDown(int x, int y);
00135 };
00138 #endif

Generated on Fri Sep 1 15:36:47 2006 for Interactive Visualisation Framework - Ivf++ by  doxygen 1.4.6-NO