Page principale | Hiérarchie des classes | Liste par ordre alphabétique | Liste des composants | Liste des fichiers | Composants | Déclarations | Pages associées

control.h

Aller à la documentation de ce fichier.
00001 /* ***********************************************************************************
00002         Writer:         Sebastien Bloc
00003         Copyright:      2004
00004         eMail:          sebastien.bloc@free.fr
00005         URL:            http://mignonsoft.free.fr
00006 
00007         This program is free software; you can redistribute it and/or
00008         modify it under the terms of the GNU General Public License
00009         as published by the Free Software Foundation; either version 2
00010         of the License, or (at your option) any later version.
00011 
00012         This program is distributed in the hope that it will be useful,
00013         but WITHOUT ANY WARRANTY; without even the implied warranty of
00014         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015         GNU General Public License for more details.
00016         http://www.gnu.org/copyleft/gpl.html
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 // parametre des dimentions des controls
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  *      Gestion des debugs
00046  */
00047 
00048 // Info de debug
00049 //#define Debug0Param(text) MyDebug::SendEvent(debugInfo,text);
00050 //#define Debug1Param(text,p1) MyDebug::SendEvent(debugInfo,text,p1);
00051 //#define Debug2Param(text,p1,p2) MyDebug::SendEvent(debugInfo,text,p1,p2);
00052 //#define Debug3Param(text,p1,p2,p3) MyDebug::SendEvent(debugInfo,text,p1,p2,p3);
00053 
00054 // Pas d'info de debug
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         // list des instansition de control
00169         static Control *lastSelected;
00170         static int lastFaceSelected;
00171         static MyList<Control *> list; // list de toute les instances de control
00172         static int nextId;
00173         static Inertia inertia;
00174 
00175         // variable membre
00176         int id;
00177         MyTreeNode<Face> *faceNode; // graphics
00178         MyString debugInfo;
00179         BOOL isEnable;
00180         BOOL isView;
00181         Timer timerAutoWheel;
00182 
00183         // evenement disponible
00184         EventControl onControl;
00185 
00186         // methodes
00187 private:
00188         void TestSelected(int face);                                    // test si on entre ou sort du control ==> onEnter onLeave
00189         void OverIn(Control *oldControl,int face);              // on rentre sur le control
00190         void OverOut(Control *newControl,int face);             // on part du control
00191         void FaceOverIn (int oldFace);                                  // on entre sur un nouvelle face du control
00192         void FaceOverOut (int newFace);                                 // on sort d'un face
00193         BOOL UseInertia(int numButton,StateMouse *mouse,int face);//utilise une inertie sur bouton souris up uniquement
00194         void AutoMouseWheel(Timer *timer);
00195 
00196 public:
00197         Control();
00198         ~Control();
00199         BOOL Delete();                                  // supression de l'element dans la liste static
00200         static Control * Find(int _idControl);                  // recherche un control par son idControl dans la list des instances
00201         void operator= (Control &src);                                  // operateur de copie   
00202         virtual void Create() {};                                               // pour le prototipage des conteneurs
00203         void ToString(MyString &str);                                   // pour le debugage
00204         BOOL Move(double x,double y,double z,BOOL asAbsolute=FALSE);// deplace le control
00205         BOOL Rotate(double x,double y,double z,BOOL asAbsolute=FALSE);// fait une rotation du control
00206 
00207         void OnMouseWheel(StateMouse *mouse,int face);  // rotation de wheel de la souris
00208         void OnMouseMove(StateMouse *mouse,int face);   // la souris bouge      
00209         void OnLButtonDown(StateMouse *mouse,int face); // appuis
00210         void OnMButtonDown(StateMouse *mouse,int face); // appuis
00211         void OnRButtonDown(StateMouse *mouse,int face); // appuis
00212         void OnLButtonUp(StateMouse *mouse,int face);   // relachement
00213         void OnMButtonUp(StateMouse *mouse,int face);   // relachement
00214         void OnRButtonUp(StateMouse *mouse,int face);   // relachement 
00215         void OnLButtonDouble(StateMouse *mouse,int face);// double click
00216         void OnMButtonDouble(StateMouse *mouse,int face);// double click
00217         void OnRButtonDouble(StateMouse *mouse,int face);// double click
00218         void OnKeyUp(StateKey *key,int face);                   // appuis 
00219         void OnKeyDown(StateKey *key,int face);                 // relachement
00220         void OnKeyDouble(StateKey *key,int face);               // double click         
00221 };
00222 
00223 #endif

Généré le Thu Apr 8 18:52:12 2004 pour 3D Controls par doxygen 1.3.6