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

LenseControl.h

Go to the documentation of this file.
00001 #ifndef OglGui_LenseControl_h
00002 #define OglGui_LenseControl_h
00003 
00004 #ifndef OglGui_GroupBox_h
00005 #include "OglGui/GroupBox.h"
00006 #endif
00007 
00008 #ifndef OglGui_Slider_h
00009 #include "OglGui/Slider.h"
00010 #endif
00011 
00012 #ifndef LENSE_H
00013 #include "Link/OGL/Lense.h"
00014 #endif
00015 
00016 namespace OglGui
00017 {
00018 
00019 class LenseControl : public GroupBox, SliderListener
00020 {
00021 public:
00022 
00023     LenseControl(int x, int y, int w, int h, int maxZoom) :
00024         GroupBox(x, y, w, h, "Lense")
00025     {
00026         Init(w, h, maxZoom);
00027     }
00028 
00029     LenseControl(Window* parent, int x, int y, int w, int h, int maxZoom) :
00030         GroupBox(parent, x, y, w, h, "Lense")
00031     {
00032         Init(w, h, maxZoom);
00033     }
00034 
00035     LenseControl(Window* parent, int w, int h, int maxZoom) :
00036         GroupBox(parent, w, h, "Lense")
00037     {
00038         Init(w, h, maxZoom);
00039     }
00040 
00041     void SetLenseTarget(LENSE *lense)
00042     {
00043         mLense = lense;
00044     }
00045 
00046     Slider* SizeSlider()
00047     {
00048         return mSizeSlider;
00049     }
00050 
00051     Slider* ZoomSlider()
00052     {
00053         return mZoomSlider;
00054     }
00055 
00056     virtual void SliderChangedEvent(Slider *src, void* userData)
00057     {
00058         if (userData == 0 && mLense != 0)
00059             mLense->zoomX = mLense->zoomY = mZoomSlider->Value() / 100.0f;
00060 
00061         if (userData == (void*)1 && mLense != 0){
00062             OGLVIEW *view = mLense->view;
00063             int     val = mSizeSlider->Value();
00064             if (val % 2)
00065                 val--;
00066             int dif = mLense->view->w - val;    
00067             viewSys.SetDimensions(view, view->x + dif/2, view->y + dif/2,
00068                                   val, val);
00069         }
00070     }
00071 
00072     virtual void DisplayFunc()
00073     {
00074         int     x, y, w, h;
00075 
00076         GroupBox::DisplayFunc();
00077 
00078         if (mLense){
00079             mZoomSlider->SetValue((int) (100 * mLense->zoomX));
00080             mSizeSlider->SetValue(mLense->view->w);
00081         }
00082 
00083         mZoomSlider->GetDimensions(x, y, w, h);
00084         oglSys.ShadowPrintf(mOglWnd, x - 38, y + h/2 - 8,
00085                             oglWHITE, oglBLACK, "Zoom");
00086         mSizeSlider->GetDimensions(x, y, w, h);
00087         oglSys.ShadowPrintf(mOglWnd, x - 38, y + h/2 - 8,
00088                             oglWHITE, oglBLACK, "Size");
00089     }
00090 
00091 
00092 private:
00093 
00094     void Init(int w, int h, int maxZoom)
00095     {
00096         h -= 16;
00097 
00098         SetBorderFillShaded(2);
00099         SetBorderType(BEV_RAISED);
00100         SetRoundness(16, 16, 16, 16);
00101         mZoomSlider = new Slider(this, 46, h/2, w-50, h/2-4, 0, maxZoom*100,
00102                                  100, BEV_RAISED, 16);
00103         mZoomSlider->SetIncrement(2);
00104         mZoomSlider->SetThumbSizes(40, RETAIN);
00105         mZoomSlider->SetShowValPerc(true);
00106         mZoomSlider->SetSliderListener(this, (void*)0);
00107 
00108         mSizeSlider = new Slider(this, 46, 2, w-50, h/2-4, 0, 1000, 128,
00109                                  BEV_RAISED, 16);
00110         mSizeSlider->SetIncrement(2);
00111         mSizeSlider->SetThumbSizes(40, RETAIN);
00112         mSizeSlider->SetSliderListener(this, (void*)1);
00113 
00114         mZoomSlider->ConnectTo(this);
00115         mSizeSlider->ConnectTo(this);
00116 
00117         mLense = 0;
00118 
00119         //ScaleChildren();
00120         SetAllowChildScaling(false);
00121 
00122         SetDisableOGLViewKeys(true);
00123         SetDisableOGLViewMouse(true);
00124     }
00125 
00126     LENSE*    mLense;
00127     Slider*   mZoomSlider;
00128     Slider*   mSizeSlider;
00129 };
00130 
00131 } // namespace OglGui
00132 
00133 #endif

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