Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

ImMoveControl.h

Go to the documentation of this file.
00001 #ifndef OglGui_ImMoveControl_h
00002 #define OglGui_ImMoveControl_h
00003 
00004 #ifndef OglGui_CrossControl_h
00005 #include "OglGui/CrossControl.h"
00006 #endif
00007 
00008 namespace OglGui
00009 {
00010 class ImMoveControl : public  CrossControl
00011 {
00012 public:
00013 
00014     ImMoveControl(int x, int y, int w, int h, Window* target=0) :
00015         CrossControl(x, y, w, h, target, IMMOVE_FW,
00016                      "Move Im", true)
00017         {
00018                 Init(w, h, target);
00019         }
00020 
00021     ImMoveControl(Window *parent, int w, int h, Window* target=0) :
00022         CrossControl(parent, w, h, target, IMMOVE_FW,
00023                      "Move Im", true)
00024         {
00025                 Init(w, h, target);
00026         }
00027 
00028     ImMoveControl(Window *parent, int x, int y, int w, int h, Window* target=0) :
00029         CrossControl(parent, x, y, w, h, target, IMMOVE_FW,
00030                      "Move Im", true)
00031         {
00032                 Init(w, h, target);
00033         }
00034 
00035     enum {
00036         IMMOVE_FW,
00037         IMMOVE_BW,
00038         IMMOVE_LEFT,
00039         IMMOVE_RIGHT,
00040         IMMOVE_UP,
00041         IMMOVE_DOWN
00042     };
00043 
00044 // Listeners
00045 
00046     virtual void
00047     ButtonSelectionEvent(Button *src, void* userData)
00048     {
00049         if (!mTargetWnd ) return;
00050 
00051         OGLWND* oglWnd = mTargetWnd->GetOGLWND();
00052 
00053         if (userData == (void*)IMMOVE_FW)
00054             mKeyFunc(oglWnd, oglPAGEDOWN, oglControl);
00055         if (userData == (void*)IMMOVE_BW)
00056             mKeyFunc(oglWnd, oglPAGEUP, oglControl);
00057         if (userData == (void*)IMMOVE_LEFT)
00058             mKeyFunc(oglWnd, oglRIGHT, oglControl);
00059         if (userData == (void*)IMMOVE_RIGHT)
00060             mKeyFunc(oglWnd, oglLEFT, oglControl);
00061         if (userData == (void*)IMMOVE_UP)
00062             mKeyFunc(oglWnd, oglDOWN, oglControl);
00063         if (userData == (void*)IMMOVE_DOWN)
00064             mKeyFunc(oglWnd, oglUP, oglControl);
00065 
00066         if (src == mResetButton)
00067             mKeyFunc(oglWnd, oglHOME, oglControl);
00068 
00069     }
00070 
00071     virtual void SetTargetWindow(Window* targetWnd)
00072     {
00073         CrossControl::SetTargetWindow(targetWnd);
00074 
00075         if (!mTargetWnd )
00076         {
00077             mKeyFunc = 0;
00078             return;
00079         }
00080         bool is2D = mTargetWnd->Is2d();
00081         mKeyFunc = is2D ? viewSys.KeyFunc : view3DSys.KeyFunc;
00082     }
00083 
00084 private:
00085     void  (*mKeyFunc)(OGLWND *, int, int);
00086 
00087         void Init(int w, int h, Window* targetWnd)
00088         {
00089         SetTargetWindow(targetWnd);
00090         }
00091 };
00092 
00093 } // namespace OglGui
00094 
00095 #endif

Generated on Fri Mar 19 09:31:35 2010 for ImpalaSrc by  doxygen 1.5.1