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

ViewMoveControl.h

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

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