Go to the
documentation of this file.
00001
00002
00003
00004
00005
00006
00007
00008
00009 #pragma once
00010
00011 #include "coreexp.h"
00012 #include "baseinterface.h"
00013 #include "ipoint2.h"
00014
00015
00016 class MouseManager;
00017
00022 class MouseCallBack : public BaseInterfaceServer {
00023 MouseManager * mouseMan;
00024 public:
00025 virtual ~MouseCallBack() {}
00026
00048 CoreExport virtual int proc(
00049 HWND hwnd,
00050 int msg,
00051 int point,
00052 int flags,
00053 IPoint2 m );
00054 virtual void pan(IPoint2 offset) { UNUSED_PARAM(offset); }
00055
00075 virtual int override(int mode) { return mode; }
00076
00078 void setMouseManager(MouseManager *mm) { mouseMan = mm; }
00079
00081 MouseManager *getMouseManager() { return mouseMan; }
00082
00117 virtual BOOL SupportTransformGizmo() { return FALSE; }
00118
00121 virtual void DeactivateTransformGizmo() {}
00122
00123
00130 virtual BOOL SupportAutoGrid(){return FALSE;}
00131
00135 virtual BOOL TolerateOrthoMode(){return FALSE; }
00136 };
00137
00138
00140
00141
00143 #define MOUSE_ABORT 0
00144
00145 #define MOUSE_IDLE 0
00146
00147 #define MOUSE_POINT 1
00148
00152 #define MOUSE_MOVE 2
00153
00154 #define MOUSE_DBLCLICK 3
00155
00158 #define MOUSE_INIT 4
00159
00160 #define MOUSE_UNINIT 5
00161
00166 #define MOUSE_FREEMOVE 6
00167
00171 #define MOUSE_KEYBOARD 7
00172
00177 #define MOUSE_PROPCLICK 8
00178 #define MOUSE_SNAPCLICK 9
00179
00180
00182
00183 #define CLICK_MODE_DEFAULT 0 //!< Returned by CreateMouseCallBack to indicate use of system mouse mode
00184 #define CLICK_DRAG_CLICK 1 //!< The default behaviour as described in override()
00185
00189 #define CLICK_MOVE_CLICK 2
00190 #define CLICK_DOWN_POINT 3 //!< In this mode, point messages are sent on mouse-down only.
00191
00192
00193
00195
00196 #define LEFT_BUTTON 0 //!< Left button
00197 #define MIDDLE_BUTTON 1 //!< Middle button
00198 #define RIGHT_BUTTON 2 //!< Right button
00199
00200
00202
00203 #define MOUSE_SHIFT (1<<0) //!< Indicates the Shift key is pressed.
00204 #define MOUSE_CTRL (1<<1) //!< Indicates the Ctrl key is pressed.
00205 #define MOUSE_ALT (1<<2) //!< Indicates the Alt key is pressed.
00206 #define MOUSE_LBUTTON (1<<3) //!< Indicates the Left button is down.
00207 #define MOUSE_MBUTTON (1<<4) //!< Indicates the Middle button is down.
00208 #define MOUSE_RBUTTON (1<<5) //!< Indicates the Right button is down.
00209
00210
00211 class MouseOverride;
00212
00213
00214
00215
00216
00217
00223 class MouseManager : public BaseInterfaceServer {
00224 private:
00225 static int clickDragMode;
00226
00227 int mouseMode;
00228 int curPoint;
00229 int curButton;
00230 MouseCallBack *TheMouseProc[3];
00231 int numPoints[3];
00232 int buttonState[3];
00233 int mouseProcReplaced;
00234 int inMouseProc;
00235 #ifdef _OSNAP
00236 UINT m_msg;
00237 #endif
00238 HWND captureWnd;
00239
00240
00241
00242 WNDPROC mpMouseWindProc;
00243
00244 public:
00245
00246 friend class MouseManagerStateInterface;
00247 friend class MouseOverride;
00248
00249 CoreExport MouseManager();
00250 CoreExport ~MouseManager();
00251
00252 CoreExport int SetMouseProc( MouseCallBack *mproc, int button, int numPoints=2 );
00253 CoreExport int SetDragMode( int mode );
00254 CoreExport int GetDragMode( );
00255 CoreExport int SetNumPoints( int numPoints, int button );
00256 CoreExport int ButtonFlags();
00257 CoreExport void Pan(IPoint2 p);
00258 CoreExport LRESULT CALLBACK MouseWinProc(
00259 HWND hwnd,
00260 UINT message,
00261 WPARAM wParam,
00262 LPARAM lParam );
00263
00264
00265 CoreExport void Reset();
00266 int GetMouseMode() {return mouseMode;}
00267 #ifdef _OSNAP
00268 UINT GetMouseMsg() {return m_msg;}
00269 int GetMousePoint() {return curPoint;}
00270 #endif
00271
00272 CoreExport void SetCapture(HWND hWnd);
00273 CoreExport HWND HasCapture();
00274 CoreExport void ReleaseCapture();
00275 CoreExport void RestoreCapture();
00276
00277 CoreExport void SetMouseWindProcCallback(WNDPROC pMouseWindProc)
00278 { mpMouseWindProc = pMouseWindProc; }
00279
00280
00281
00282
00283 WNDPROC GetMouseWindProcCallback() const
00284 { return mpMouseWindProc; }
00285
00286 };
00287
00288
00289 #define WM_MOUSEABORT (WM_USER + 7834)
00290
00301 CoreExport BOOL GetInMouseAbort();
00302
00303