00001 #ifndef OglGui_ZoomPanControl_h
00002 #define OglGui_ZoomPanControl_h
00003
00004 #include "OglGui/ZoomControl.h"
00005
00006 extern "C" {
00007 void ZoomPanFuncs(OGLWND *oglWnd, OGLWND *target, int allowSize,
00008 int allowZoom, char *title);
00009 }
00010
00011
00012 namespace OglGui
00013 {
00014
00015 class ZoomPanControl : public Window
00016 {
00017 public:
00018
00019 ZoomPanControl(Window* parent, int x, int y, int w, int h, OGLWND *target,
00020 int maxZoom, float aspectRatio=1) :
00021 Window(parent, x, y, w, h)
00022 {
00023 Init(w, h, target, maxZoom, aspectRatio);
00024 }
00025
00026 ZoomPanControl(Window* parent, int x, int y, int w, int h, Window *target,
00027 int maxZoom, float aspectRatio=1) :
00028 Window(parent, x, y, w, h)
00029 {
00030 Init(w, h, target->GetOGLWND(), maxZoom, aspectRatio);
00031 }
00032
00033 ZoomPanControl(Window* parent, int w, int h, OGLWND *target, int maxZoom,
00034 float aspectRatio=1) :
00035 Window(parent, w, h)
00036 {
00037 Init(w, h, target, maxZoom, aspectRatio);
00038 }
00039
00040 ZoomPanControl(Window* parent, int w, int h, Window *target, int maxZoom,
00041 float aspectRatio=0) :
00042 Window(parent, w, h)
00043 {
00044 Init(w, h, target->GetOGLWND(), maxZoom, aspectRatio);
00045 }
00046
00047 void SetZoomPanTarget(OGLWND* target, bool is2d)
00048 {
00049 mZoomControl->SetZoomTarget(target, is2d);
00050 }
00051
00052 void SetZoomPanTarget(Window* target)
00053 {
00054 mZoomControl->SetZoomTarget(target->GetOGLWND(), target->Is2d());
00055 }
00056
00057 ZoomControl* ZoomController()
00058 {
00059 return mZoomControl;
00060 }
00061
00062 Window* PanWindow()
00063 {
00064 return mPanWindow;
00065 }
00066
00067 private:
00068
00069 void
00070 Init(int w, int h, OGLWND *target, int maxZoom, float ratio)
00071 {
00072 OGLWND *oW = GetOGLWND();
00073
00074 int panW = (h-4) * ratio;
00075 mPanWindow = new Window(this, 2, 2, panW, h-4);
00076 ZoomPanFuncs(mPanWindow->GetOGLWND(), target, 1, 1, "Pan");
00077 mPanWindow->SetBorderType(BEV_RAISED);
00078 mPanWindow->SetRoundness(8, 8, 8, 8);
00079 mPanWindow->SetBackground(0);
00080 mPanWindow->SetBorderFillShaded(2);
00081 mPanWindow->SetBorderFillOpacity(0.5);
00082 mPanWindow->ConnectTo(this, L2L | R2L | B2B | T2T | TPARENT);
00083
00084 mZoomControl =
00085 new OglGui::ZoomControl(this,panW+4,2,w-(panW+4), h-4, maxZoom);
00086
00087 mZoomControl->SetBorderType(BEV_RAISED);
00088 mZoomControl->SetZoomTarget(target, true);
00089 mZoomControl->SetRoundness(16, 16, 16, 16);
00090 mZoomControl->SetBorderFillShaded(2);
00091 mZoomControl->ConnectTo(this);
00092
00093 SetAllowChildScaling(false);
00094
00095 SetDisableOGLViewKeys(true);
00096 SetDisableOGLViewMouse(true);
00097 }
00098
00099 OglGui::ZoomControl* mZoomControl;
00100 Window* mPanWindow;
00101 };
00102
00103 }
00104
00105 #endif