IvfInteractionHandler.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 _CIvfInteractionHandler_h_
00026 #define _CIvfInteractionHandler_h_
00027 
00028 #include <ivf/IvfScene.h>
00029 #include <ivf/IvfBufferSelection.h>
00030 
00031 #include <ivfwidget/IvfHandlerBase.h>
00032 #include <ivfwidget/IvfWidgetBase.h>
00033 
00034 #include <ivf3dui/IvfUIInteractiveBase.h>
00035 
00037 class IVFWIDGET_API CIvfShapeDownEvent : public CIvfEventBase {
00038 public:
00047         virtual void onShapeDown(CIvfShape* shape) {};
00048 };
00049 
00051 class IVFWIDGET_API CIvfShapeClickEvent : public CIvfEventBase {
00052 public:
00061         virtual void onShapeClick(CIvfShape* shape) {};
00062 };
00063 
00065 class IVFWIDGET_API CIvfShapeUpEvent : public CIvfEventBase {
00066 public:
00075         virtual void onShapeUp(CIvfShape* shape) {};
00076 };
00077 
00079 class IVFWIDGET_API CIvfShapeEnterEvent : public CIvfEventBase {
00080 public:
00089         virtual void onShapeEnter(CIvfShape* shape) {};
00090 };
00091 
00093 class IVFWIDGET_API CIvfShapeOverEvent : public CIvfEventBase {
00094 public:
00103         virtual void onShapeOver(CIvfShape* shape) {};
00104 };
00105 
00107 class IVFWIDGET_API CIvfShapeLeaveEvent : public CIvfEventBase {
00108 public:
00117         virtual void onShapeLeave(CIvfShape* shape) {};
00118 };
00119 
00121 class IVFWIDGET_API CIvfShapeDragEvent : public CIvfEventBase {
00122 public:
00132         virtual void onShapeDrag(CIvfShape* shape) {};
00133 };
00134 
00136 class IVFWIDGET_API CIvfControlEnterEvent : public CIvfEventBase {
00137 public:
00146         virtual void onControlEnter(CIvfUIInteractiveBase* uiControl) {};
00147 };
00148 
00150 class IVFWIDGET_API CIvfControlOverEvent : public CIvfEventBase {
00151 public:
00160          virtual void onControlOver(CIvfUIInteractiveBase* uiControl) {};
00161 };
00162 
00164 class IVFWIDGET_API CIvfControlLeaveEvent : public CIvfEventBase {
00165 public:
00174         virtual void onControlLeave(CIvfUIInteractiveBase* uiControl) {};
00175 };
00176 
00178 class IVFWIDGET_API CIvfControlDragEvent : public CIvfEventBase {
00179 public:
00189         virtual void onControlDrag(CIvfUIInteractiveBase* uiControl) {};
00190 };
00191 
00193 class IVFWIDGET_API CIvfControlUpEvent : public CIvfEventBase {
00194 public:
00203          virtual void onControlUp(CIvfUIInteractiveBase* uiControl) {};
00204 };
00205 
00207 class IVFWIDGET_API CIvfControlClickEvent : public CIvfEventBase {
00208 public:
00217         virtual void onControlClick(CIvfUIInteractiveBase* uiControl) {};
00218 };
00219 
00221 class IVFWIDGET_API CIvfControlDownEvent : public CIvfEventBase {
00222 public:
00231         virtual void onControlDown(CIvfUIInteractiveBase* uiControl) {};
00232 };
00233 
00234 IvfSmartPointer(CIvfInteractionHandler);
00235 
00247 class IVFWIDGET_API CIvfInteractionHandler : public CIvfHandlerBase,
00248         CIvfMouseDownEvent,
00249         CIvfMouseMoveEvent,
00250         CIvfMouseUpEvent
00251 {
00252 private:
00253         CIvfWidgetBase* m_widget;
00254         CIvfScenePtr m_scene;
00255         CIvfShapePtr m_oldShape;
00256         CIvfBufferSelectionPtr m_selection;
00257 
00258         CIvfShapePtr m_lastShape;
00259         CIvfShapePtr m_currentShape;
00260 
00261         CIvfUIInteractiveBasePtr m_lastControl;
00262         CIvfUIInteractiveBasePtr m_currentControl;
00263 
00264         int     m_lastPos[2];
00265 
00266         CIvfShapeDownEvent*             m_shapeDownEvent;
00267         CIvfShapeClickEvent*    m_shapeClickEvent;
00268         CIvfShapeUpEvent*               m_shapeUpEvent;
00269         CIvfShapeEnterEvent*    m_shapeEnterEvent;
00270         CIvfShapeOverEvent*             m_shapeOverEvent;
00271         CIvfShapeLeaveEvent*    m_shapeLeaveEvent;
00272         CIvfShapeDragEvent*             m_shapeDragEvent;
00273 
00274         CIvfControlEnterEvent*  m_controlEnterEvent;
00275         CIvfControlOverEvent*   m_controlOverEvent;
00276         CIvfControlLeaveEvent*  m_controlLeaveEvent;
00277         CIvfControlDragEvent*   m_controlDragEvent;
00278         CIvfControlUpEvent*             m_controlUpEvent;
00279         CIvfControlClickEvent*  m_controlClickEvent;
00280         CIvfControlDownEvent*   m_controlDownEvent;
00281 public:
00290         CIvfInteractionHandler(CIvfWidgetBase* widget, CIvfScene* scene);
00291 
00293         virtual ~CIvfInteractionHandler();
00294 
00295         IvfClassInfo("CIvfInteractionHandler",CIvfHandlerBase);
00296 
00298         void setControlDragEvent(CIvfControlDragEvent* event);
00299 
00301         void setControlEnterEvent(CIvfControlEnterEvent* event);
00302 
00304         void setControlLeaveEvent(CIvfControlLeaveEvent* event);
00305 
00307         void setControlOverEvent(CIvfControlOverEvent* event);
00308 
00310         void setControlClickEvent(CIvfControlClickEvent* event);
00311 
00313         void setControlUpEvent(CIvfControlUpEvent* event);
00314 
00316         void setControlDownEvent(CIvfControlDownEvent* event);
00317 
00319         void setShapeDragEvent(CIvfShapeDragEvent* event);
00320 
00322         void setShapeEnterEvent(CIvfShapeEnterEvent* event);
00323 
00325         void setShapeOverEvent(CIvfShapeOverEvent* event);
00326 
00328         void setShapeLeaveEvent(CIvfShapeLeaveEvent* event);
00329 
00331         void setShapeClickEvent(CIvfShapeClickEvent* event);
00332 
00334         void setShapeUpEvent(CIvfShapeUpEvent* event);
00335 
00337         void setShapeDownEvent(CIvfShapeDownEvent* event);
00338 
00339         virtual void doMouseUp(int x, int y);
00340         virtual void doMouseMove(int x, int y);
00341         virtual void doMouseDown(int x, int y);
00342 
00343         // Implemeted events
00344 
00345         virtual void onMouseMove(int x, int y);
00346         virtual void onMouseUp(int x, int y);
00347         virtual void onMouseDown(int x, int y);
00348 };
00354 #endif

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