00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00023 #ifndef INCLUDE_CONTROL_H
00024 #define INCLUDE_CONTROL_H
00025
00026 #include "MyList.h"
00027 #include "MyString.h"
00028 #include "MyDebug.h"
00029 #include "input.h"
00030 #include "faces.h"
00031 #include "inertia.h"
00032
00033
00034 #define DEFAULT_DELTAZ_TEXTBOX 0.3
00035 #define DEFAULT_DELTAZ_MAX_BUTTON 0.4
00036 #define DEFAULT_DELTAZ_MIN_BUTTON 0.1 // ne peut etre =0 sinon erreur de picking
00037 #define DEFAULT_DELTAZ_CONTAINER 0.2
00038 #define DEFAULT_DELTAZ_TITLE 0.3
00039 #define DEFAULT_DELTAZ_WINDOW 1
00040 #define DEFAULT_DELTAX_UNIVERS 10
00041 #define DEFAULT_DELTAY_UNIVERS 7
00042 #define TIME_OUT_PUSH_DOWN_BUTTON 0.3
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056 #define Debug0Param(text)
00057 #define Debug1Param(text,p1)
00058 #define Debug2Param(text,p1,p2)
00059 #define Debug3Param(text,p1,p2,p3)
00060
00061 typedef Point2D<int> Point2D_int;
00062 typedef Point2D<double> Point2D_double;
00063
00072 [event_source(native)]
00073 class EventClick
00074 {
00075 public:
00076 __event void Up(StateMouse *mouse,int face);
00077 __event void Down(StateMouse *mouse,int face);
00078 __event void Double(StateMouse *mouse,int face);
00079 __event void Click();
00080 };
00081
00082 [event_source(native)]
00083 class EventKey
00084 {
00085 public:
00086 __event void Up(StateKey *key,int face);
00087 __event void Down(StateKey *key,int face);
00088 __event void Double(StateKey *key,int face);
00089 };
00090
00110 [event_source(native)]
00111 class EventMouse
00112 {
00113 public:
00114 EventClick left,right,mid;
00115 __event void Move(StateMouse *mouse,int face);
00116 __event void Wheel(StateMouse *mouse,int face);
00117 } ;
00118
00126 [event_source(native)]
00127 class EventOver
00128 {
00129 public:
00130 __event void In(Control *oldControl,int face);
00131 __event void Out(Control *newControl,int face);
00132 } ;
00133
00134 [event_source(native)]
00135 class EventFaceOver
00136 {
00137 public:
00138 __event void In(int face);
00139 __event void Out(int face);
00140
00141 } ;
00142
00143 class EventControl
00144 {
00145 public:
00146 EventMouse mouse;
00147 EventKey key;
00148 EventOver over;
00149 EventFaceOver faceOver;
00150 };
00151
00165 class Control
00166 {
00167 public:
00168
00169 static Control *lastSelected;
00170 static int lastFaceSelected;
00171 static MyList<Control *> list;
00172 static int nextId;
00173 static Inertia inertia;
00174
00175
00176 int id;
00177 MyTreeNode<Face> *faceNode;
00178 MyString debugInfo;
00179 BOOL isEnable;
00180 BOOL isView;
00181 Timer timerAutoWheel;
00182
00183
00184 EventControl onControl;
00185
00186
00187 private:
00188 void TestSelected(int face);
00189 void OverIn(Control *oldControl,int face);
00190 void OverOut(Control *newControl,int face);
00191 void FaceOverIn (int oldFace);
00192 void FaceOverOut (int newFace);
00193 BOOL UseInertia(int numButton,StateMouse *mouse,int face);
00194 void AutoMouseWheel(Timer *timer);
00195
00196 public:
00197 Control();
00198 ~Control();
00199 BOOL Delete();
00200 static Control * Find(int _idControl);
00201 void operator= (Control &src);
00202 virtual void Create() {};
00203 void ToString(MyString &str);
00204 BOOL Move(double x,double y,double z,BOOL asAbsolute=FALSE);
00205 BOOL Rotate(double x,double y,double z,BOOL asAbsolute=FALSE);
00206
00207 void OnMouseWheel(StateMouse *mouse,int face);
00208 void OnMouseMove(StateMouse *mouse,int face);
00209 void OnLButtonDown(StateMouse *mouse,int face);
00210 void OnMButtonDown(StateMouse *mouse,int face);
00211 void OnRButtonDown(StateMouse *mouse,int face);
00212 void OnLButtonUp(StateMouse *mouse,int face);
00213 void OnMButtonUp(StateMouse *mouse,int face);
00214 void OnRButtonUp(StateMouse *mouse,int face);
00215 void OnLButtonDouble(StateMouse *mouse,int face);
00216 void OnMButtonDouble(StateMouse *mouse,int face);
00217 void OnRButtonDouble(StateMouse *mouse,int face);
00218 void OnKeyUp(StateKey *key,int face);
00219 void OnKeyDown(StateKey *key,int face);
00220 void OnKeyDouble(StateKey *key,int face);
00221 };
00222
00223 #endif