00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
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
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