00001
00033 #ifndef INC_MGUI_CTRL_MAGNIFIER_H
00034 #define INC_MGUI_CTRL_MAGNIFIER_H
00035
00036 #ifndef INC_MGUI_CANVAS_H
00037 #include <mgui/canvas.h>
00038 #endif
00039
00040 #ifndef INC_MI32_COLOR_H
00041 #include <mi32/color.h>
00042 #endif
00043
00044 #ifndef INC_SPATMOD_IMAGESTAGE_H
00045 #include <spatmod/imagestage.h>
00046 #endif
00047
00048 #ifndef INC_SPATMOD_IMAGESTAGEAUTOPTR_H
00049 #include <spatmod/imagestageautoptr.h>
00050 #endif
00051
00052 namespace MGUI {
00053
00054
00056 class CTRL_MAGNIFIER : public CANVAS {
00057 public:
00058
00059 enum STYLE {
00060 STYLE_Default = 0x00,
00061 STYLE_NoShowCenterCell = 0x01,
00062 STYLE_NoZoomControls = 0x02,
00063 STYLE_NoZoomFactor = 0x04
00064 };
00065
00066 typedef fastdelegate::FastDelegate<void(double)> DELEGATE_ONZOOM;
00067
00069 CTRL_MAGNIFIER (
00070 );
00071
00073 virtual ~CTRL_MAGNIFIER (
00074 );
00075
00077 void Create (
00078 LAYOUT_PANE_BASE& ParentPane,
00079 INT32 Width,
00080 INT32 Height,
00081 double MinimumZoomAllowed = 2,
00082 double MaximumZoomAllowed = 16,
00083 LAYOUT_SIZEALIGN sizealign = LAYOUT_SIZEALIGN_Expand,
00084 CTRL_MAGNIFIER::STYLE style = STYLE_Default
00085 );
00086
00088 ERRVALUE Draw (
00089 const MGUI::POINT& point,
00090 MGD::DEVICE *Device
00091 );
00092
00094 ERRVALUE Draw (
00095 const MGUI::POINT& point,
00096 SPATMOD::IMAGE::STAGE* PtrStage,
00097 bool TakeOwnership = true
00098 );
00099
00101 ERRVALUE Draw (
00102 SPATMOD::IMAGE::STAGE* PtrStage,
00103 bool TakeOwnership = true
00104 );
00105
00107 void Erase ();
00108
00110 double GetZoom () const {return (m_zoom); }
00111
00113 void Redraw ();
00114
00116 void SetBackgroundColor (
00117 const COLOR& color
00118 );
00119
00121 void SetDelegateOnZoom (
00122 DELEGATE_ONZOOM delegate
00123 ) { m_DelegateOnZoom = delegate; }
00124
00126 void SetZoom (
00127 double zoom
00128 );
00129
00131 void SetZoomLimits (
00132 double MinimumZoomAllowed,
00133 double MaximumZoomAllowed
00134 );
00135
00137 void SetShowCenter (
00138 bool bShowCenter
00139 );
00140
00141 private:
00142 #ifndef GENERATING_DOXYGEN_OUTPUT
00143
00144 double m_zoom;
00145 double m_MinimumZoomAllowed;
00146 double m_MaximumZoomAllowed;
00147 COLOR m_BGColor;
00148 COLOR m_BorderColor;
00149 INT32 m_style;
00150
00151 LRECT2D m_ZoomInRect;
00152 LRECT2D m_ZoomOutRect;
00153 LRECT2D m_ZoomTextRect;
00154
00155 SPATMOD::IMAGE::STAGE_AUTOPTR m_PrevStageAutoPtr;
00156
00157 void Erase(int width, int height);
00158 bool OnClick (MGUI::POINT point, MGUI::POINTERBUTTON button, MGUI::KEYSTATE state);
00159 void OnScrollWheel(INT32 WheelValue);
00160
00161 DELEGATE_ONZOOM m_DelegateOnZoom;
00162
00163 CTRL_MAGNIFIER (const CTRL_MAGNIFIER&);
00164 CTRL_MAGNIFIER& operator= (const CTRL_MAGNIFIER&);
00165
00166 #endif // GENERATING_DOXYGEN_OUTPUT
00167
00168 };
00169
00170 #ifndef GENERATING_DOXYGEN_OUTPUT
00171 DEFINE_ENUM_OP_BITWISE(MGUI::CTRL_MAGNIFIER::STYLE)
00172 #endif
00173
00174
00175
00176 }
00177
00178
00179 #endif // INC_MGUI_CTRL_MAGNIFIER_H