00001
00024 #ifndef INC_MGUI_ICON_H
00025 #define INC_MGUI_ICON_H
00026
00027 #ifndef INC_MI32_COLOR_H
00028 #include <mi32/color.h>
00029 #endif
00030
00031 #ifndef INC_MI32_ICONID_H
00032 #include <mi32/iconid.h>
00033 #endif
00034
00035 #ifndef INC_MI32_SIMPLEAR_H
00036 #include <mi32/simplear.h>
00037 #endif
00038
00039 #ifndef _XLIB_H_
00040 #include <X11/Xlib.h>
00041 #endif
00042
00043 namespace MGD {
00044 class CONTEXT;
00045 }
00046
00047 namespace MGUI {
00048
00049
00050
00052 class ICON {
00053 public:
00054
00056 enum STYLE {
00057 STYLE_Normal = 0,
00058 STYLE_Armed,
00059 STYLE_Disabled,
00060 STYLE_DisabledArmed,
00061 STYLE_NoDrawBackground
00062 };
00063
00065 enum ORIENTATION {
00066 ORIENTATION_Upright = 0,
00067 ORIENTATION_RotateCW,
00068 ORIENTATION_RotateCCW,
00069 ORIENTATION_Rotate180,
00070 ORIENTATION_MirrorHorizontal,
00071 ORIENTATION_MirrorVertical,
00072 ORIENTATION_MirrorRotateCW,
00073 ORIENTATION_MirrorRotateCCW,
00074 };
00075
00077 ICON ();
00078
00081 ICON (const ICON& rhs);
00082
00084 ICON (
00085 ICONID iconid,
00086 UINT16 width = 0,
00087 UINT16 height = 0,
00088 INT16 MarginLeft = -1,
00089 INT16 MarginTop = -1,
00090 ORIENTATION orientation = ORIENTATION_Upright
00091 );
00092
00094 ICON (
00095 ICONID iconid,
00096 const COLOR& ColorBg,
00097 UINT16 width = 0,
00098 UINT16 height = 0,
00099 INT16 MarginLeft = -1,
00100 INT16 MarginTop = -1,
00101 ORIENTATION orientation = ORIENTATION_Upright
00102 );
00103
00104 ~ICON ();
00105
00108 ICON& operator= (const ICON& rhs);
00109
00110 #ifdef X_NATIVE
00113 Pixmap CreatePixmap (
00114 Widget widget,
00115 STYLE style
00116 ) const;
00117 #endif
00118
00120 void Draw (
00121 MGD::CONTEXT& gc,
00122 INT32 x,
00123 INT32 y,
00124 STYLE style = STYLE_Normal
00125 ) const;
00126
00128 UINT16 GetHeight () const
00129 { return (m_SetHeight); }
00130
00132 UINT16 GetWidth () const
00133 { return (m_SetWidth); }
00134
00136 bool IsEmpty () const;
00137
00139 void SetColorBackground (
00140 const COLOR& ColorBg
00141 );
00142
00144 void SetColorBackground (
00145 const COLOR& ColorBgNormal,
00146 const COLOR& ColorBgArmed
00147 );
00148
00152 void SetColorVar (
00153 const COLOR& color,
00154 UINT8 var = 0
00155 );
00156
00159 void SetOrientation (
00160 ORIENTATION orientation
00161 ) { m_Orientation = orientation; }
00162
00164 void SetSize (
00165 UINT16 width,
00166 UINT16 height,
00167 INT16 MarginLeft = -1,
00168 INT16 MarginTop = -1
00169 );
00170
00171 #ifdef X_NATIVE
00173 void UpdatePixmap (
00174 Widget widget,
00175 Pixmap pixmap,
00176 STYLE style
00177 ) const;
00178 #endif
00179
00180 private:
00181 #ifndef GENERATING_DOXYGEN_OUTPUT
00182 class PRIV;
00183 PRIV *m_pPriv;
00184 UINT16 m_SetWidth;
00185 UINT16 m_SetHeight;
00186 INT16 m_MarginLeft;
00187 INT16 m_MarginTop;
00188 ORIENTATION m_Orientation;
00189 COLOR m_ColorBgNormal;
00190 COLOR m_ColorBgArmed;
00191 SIMPLE_ARRAY<COLOR> m_ColorVar;
00192
00193 void GetCellBGRA (INT16 x, INT16 y, UINT8 *bgra) const;
00194 void SetupColorVar ();
00195 #endif
00196 };
00197
00198
00199
00200 }
00201
00202 #endif // INC_MGUI_ICON_H