00001 #ifndef MOUSEHANDLERH
00002 #define MOUSEHANDLERH
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00038
00039
00040 #include "CoreMainHeader.h"
00041 #include <vcl\controls.hpp>
00042 #include <vcl\classes.hpp>
00043
00044 #include "Selection.h"
00045 #include "Point.h"
00046
00047
00048
00049 class TOpenGLWin;
00050 class CManipulator;
00051 class CProject;
00052
00053
00054
00055
00056
00058
00061 class NEMESIS_CORE_PACKAGE CMouseHandlerPrefs{
00062 public:
00063 enum EMouseAction{
00064 SELECT,
00065 RECTSEL,
00066 RECTSELMOVE,
00067 MOVE,
00068 ROTATE,
00069 NOTHING,
00070 };
00071
00072 class CMouseStatus{
00073 public:
00074 __fastcall CMouseStatus(void);
00075 unsigned LeftButton:1;
00076 unsigned MiddleButton:1;
00077 unsigned RightButton:1;
00078 unsigned RectSelMode:1;
00079 };
00080
00081 static CPoint RSensitivity;
00082 static CPoint MSensitivity;
00083 static bool ThreeButtonSimul;
00084
00085 static bool __fastcall EncodingShift(TShiftState Shift);
00086 static bool __fastcall EncodingFirstManipulator(TShiftState Shift);
00087 static EMouseAction __fastcall EncodingButton(TMouseButton Button,CMouseStatus &Status,
00088 bool down);
00089 };
00090
00091
00092
00093 typedef void __fastcall (__closure *TMouseHandlerEvent)(void);
00094 typedef void __fastcall (__closure *TMouseRectHandlerEvent)(int x,int y,int w,int h,bool add);
00095
00097
00100 class NEMESIS_CORE_PACKAGE CMouseHandler:public CMouseHandlerPrefs{
00101 public:
00102
00103 __fastcall CMouseHandler(void);
00104 __fastcall CMouseHandler(CProject* p_project);
00105 __fastcall CMouseHandler(TOpenGLWin *win,CManipulator *manip);
00106 void __fastcall MouseDown(TObject* Sender,TMouseButton Button,TShiftState Shift,int mousex,int mousey);
00107 void __fastcall MouseUp(TObject* Sender,TMouseButton Button,TShiftState Shift,int mousex,int mousey);
00108 void __fastcall MouseMove(TObject* Sender,TShiftState Shift,int mousex, int mousey);
00109
00110 inline void __fastcall SetManipulator(CManipulator *manip);
00111 inline void __fastcall SetSecondManipulator(CManipulator* manip);
00112 inline CManipulator* __fastcall GetSecondManipulator(void);
00113 inline bool __fastcall IsActiveSecondManipulator(void);
00114 inline void __fastcall SetWindowHandler(TOpenGLWin* win);
00115
00116 void __fastcall ActivateSecondManipulator(void);
00117 void __fastcall DeactivateSecondManipulator(void);
00118
00119 void __fastcall SetRectangleSelMode(bool set,bool addmode);
00120
00121 int MouseX,MouseY;
00122
00123 __property TMouseHandlerEvent OnSelectClick={write = SelectClick};
00124 __property TMouseRectHandlerEvent OnRectSelectClick={write = RectSelectClick};
00125
00126 private:
00127 TMouseHandlerEvent SelectClick;
00128 TMouseRectHandlerEvent RectSelectClick;
00129
00130 CProject* Project;
00131 TOpenGLWin* Win;
00132 TBevel* Bevel;
00133 CManipulator* Manipulator;
00134 CManipulator* DefaultManipulator;
00135 CManipulator* SecondManipulator;
00136 bool SecondIsActive;
00137 CMouseStatus Status;
00138 EMouseAction Action;
00139 bool LevelX;
00140 int StartX,StartY;
00141 bool RectangleSelMode;
00142 bool AddMode;
00143 };
00144
00145
00146
00147 inline void __fastcall CMouseHandler::SetManipulator(CManipulator *manip)
00148 {
00149 DefaultManipulator = manip;
00150 if( SecondIsActive == false) Manipulator = DefaultManipulator;
00151 }
00152
00153
00154
00155 inline void __fastcall CMouseHandler::SetSecondManipulator(CManipulator *manip)
00156 {
00157 SecondManipulator = manip;
00158 if( SecondIsActive == true) Manipulator = SecondManipulator;
00159 }
00160
00161
00162
00163 inline CManipulator* __fastcall CMouseHandler::GetSecondManipulator(void)
00164 {
00165 return(SecondManipulator);
00166 }
00167
00168
00169
00170 inline bool __fastcall CMouseHandler::IsActiveSecondManipulator(void)
00171 {
00172 return(SecondIsActive);
00173 }
00174
00175
00176
00177 inline void __fastcall CMouseHandler::SetWindowHandler(TOpenGLWin* win)
00178 {
00179 Win = win;
00180 }
00181
00182
00183
00184 inline void __fastcall CMouseHandler::ActivateSecondManipulator(void)
00185 {
00186 Manipulator = SecondManipulator;
00187 SecondIsActive = true;
00188 }
00189
00190
00191
00192 inline void __fastcall CMouseHandler::DeactivateSecondManipulator(void)
00193 {
00194 Manipulator = DefaultManipulator;
00195 SecondIsActive = false;
00196 }
00197
00198
00199 #endif