00001
00024 #ifndef INC_MGUI_CUSTOMDRAW_H
00025 #define INC_MGUI_CUSTOMDRAW_H
00026
00027 #ifndef INC_MI32_RECT_H
00028 #include <mi32/rect.h>
00029 #endif
00030
00031
00032 #ifndef GENERATING_DOXYGEN_OUTPUT
00033 namespace MGD {
00034 class CONTEXT;
00035 }
00036 #endif
00037
00038
00039 namespace MGUI {
00040
00062 class CUSTOMDRAW {
00063 public:
00064
00066
00067 enum DRAWSTAGE {
00068 DRAWSTAGE_PrePaint = 0x00000001,
00069 DRAWSTAGE_PostPaint = 0x00000002,
00070 DRAWSTAGE_PreErase = 0x00000003,
00071 DRAWSTAGE_PostErase = 0x00000004,
00072 DRAWSTAGE_CtrlPrePaint = DRAWSTAGE_PrePaint,
00073 DRAWSTAGE_CtrlPostPaint = DRAWSTAGE_PostPaint,
00074 DRAWSTAGE_CtrlPreErase = DRAWSTAGE_PreErase,
00075 DRAWSTAGE_CtrlPostErase = DRAWSTAGE_PostErase,
00076 DRAWSTAGE_Item = 0x00010000,
00077 DRAWSTAGE_ItemPrePaint = DRAWSTAGE_Item | DRAWSTAGE_PrePaint,
00078 DRAWSTAGE_ItemPostPaint = DRAWSTAGE_Item | DRAWSTAGE_PostPaint,
00079 DRAWSTAGE_ItemPreErase = DRAWSTAGE_Item | DRAWSTAGE_PreErase,
00080 DRAWSTAGE_ItemPostErase = DRAWSTAGE_Item | DRAWSTAGE_PostErase,
00081 DRAWSTAGE_SubItem = 0x00020000,
00082 DRAWSTAGE_SubItemPrePaint = DRAWSTAGE_SubItem | DRAWSTAGE_ItemPrePaint,
00083 DRAWSTAGE_SubItemPostPaint = DRAWSTAGE_SubItem | DRAWSTAGE_ItemPostPaint,
00084 };
00085
00087
00088 enum ITEMSTATE {
00089 ITEMSTATE_Normal = 0x0000,
00090 ITEMSTATE_Selected = 0x0001,
00091 ITEMSTATE_Grayed = 0x0002,
00092 ITEMSTATE_Disabled = 0x0004,
00093 ITEMSTATE_Checked = 0x0008,
00094 ITEMSTATE_Focus = 0x0010,
00095 ITEMSTATE_Default = 0x0020,
00096 ITEMSTATE_Hot = 0x0040,
00097 ITEMSTATE_Marked = 0x0080,
00098 ITEMSTATE_Indeterminant = 0x0100,
00099 };
00100
00103 enum RETVALUE {
00104 RETVALUE_DoDefault = 0x00,
00105 RETVALUE_SkipDefault = 0x04,
00106 RETVALUE_NotifyPostPaint = 0x10,
00107 RETVALUE_NotifyItemDraw = 0x20,
00108 RETVALUE_NotifySubItemDraw = 0x20,
00109 RETVALUE_NotifyPostErase = 0x40,
00110 };
00111
00112 MGD::CONTEXT* GetDrawingContext (
00113 ) const { return (m_pDC); }
00114
00115 DRAWSTAGE GetDrawStage (
00116 ) const { return (m_drawstage); }
00117
00118 ID GetID (
00119 ) const { return (m_id); }
00120
00121 ITEMSTATE GetItemState (
00122 ) const { return (m_itemstate); }
00123
00124 const LRECT2D& GetRect (
00125 ) const { return (m_rect); }
00126
00127 void SetDrawStage (
00128 DRAWSTAGE drawstage
00129 ) { m_drawstage = drawstage; }
00130
00131 protected:
00132
00133 CUSTOMDRAW (
00134 );
00135
00136 CUSTOMDRAW (
00137 DRAWSTAGE drawstage,
00138 ITEMSTATE itemstate,
00139 INT32 ItemNumber,
00140 ID id,
00141 const LRECT2D& rect
00142 );
00143
00144 ~CUSTOMDRAW ()
00145 { }
00146
00147 INT32 GetItemNumber (
00148 ) const { return (m_ItemNumber); }
00149
00150 void SetBase (
00151 ITEMSTATE itemstate,
00152 INT32 ItemNumber,
00153 ID id,
00154 const LRECT2D& rect
00155 );
00156
00157 void SetDrawingContext (
00158 MGD::CONTEXT *pDC
00159 ) { m_pDC = pDC; }
00160
00161 void SetRect (
00162 INT32 xinit,
00163 INT32 yinit,
00164 INT32 xlast,
00165 INT32 ylast
00166 ) { m_rect.Set(xinit,yinit,xlast,ylast); }
00167
00168 private:
00169 #ifndef GENERATING_DOXYGEN_OUTPUT
00170 DRAWSTAGE m_drawstage;
00171 ITEMSTATE m_itemstate;
00172 INT32 m_ItemNumber;
00173 ID m_id;
00174 LRECT2D m_rect;
00175 MGD::CONTEXT *m_pDC;
00176 #endif // GENERATING_DOXYGEN_OUTPUT
00177
00178 };
00179
00180 #ifndef GENERATING_DOXYGEN_OUTPUT
00181 DEFINE_ENUM_OP_BITWISE(CUSTOMDRAW::ITEMSTATE)
00182 DEFINE_ENUM_OP_BITWISE(CUSTOMDRAW::RETVALUE)
00183 #endif
00184
00185 }
00186
00187 #endif // INC_MGUI_CUSTOMDRAW_H