00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef INC_MGUI_CUSTOMDRAW_H
00020 #define INC_MGUI_CUSTOMDRAW_H
00021
00022 #if !defined(INC_MI32_STDAFX_H) && defined(WIN32_MFC)
00023 #include <mi32/stdafx.h>
00024 #endif
00025
00026 #ifndef INC_MI32_RECT_H
00027 #include <mi32/rect.h>
00028 #endif
00029
00030
00031 #ifndef GENERATING_DOXYGEN_OUTPUT
00032 namespace MGD {
00033 class CONTEXT;
00034 }
00035 #endif
00036
00037
00038 namespace MGUI {
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061 class CUSTOMDRAW {
00062 public:
00063
00064
00065
00066 enum DRAWSTAGE {
00067 DRAWSTAGE_PrePaint = 0x00000001,
00068 DRAWSTAGE_PostPaint = 0x00000002,
00069 DRAWSTAGE_PreErase = 0x00000003,
00070 DRAWSTAGE_PostErase = 0x00000004,
00071 DRAWSTAGE_CtrlPrePaint = DRAWSTAGE_PrePaint,
00072 DRAWSTAGE_CtrlPostPaint = DRAWSTAGE_PostPaint,
00073 DRAWSTAGE_CtrlPreErase = DRAWSTAGE_PreErase,
00074 DRAWSTAGE_CtrlPostErase = DRAWSTAGE_PostErase,
00075 DRAWSTAGE_Item = 0x00010000,
00076 DRAWSTAGE_ItemPrePaint = DRAWSTAGE_Item | DRAWSTAGE_PrePaint,
00077 DRAWSTAGE_ItemPostPaint = DRAWSTAGE_Item | DRAWSTAGE_PostPaint,
00078 DRAWSTAGE_ItemPreErase = DRAWSTAGE_Item | DRAWSTAGE_PreErase,
00079 DRAWSTAGE_ItemPostErase = DRAWSTAGE_Item | DRAWSTAGE_PostErase,
00080 DRAWSTAGE_SubItem = 0x00020000,
00081 DRAWSTAGE_SubItemPrePaint = DRAWSTAGE_SubItem | DRAWSTAGE_ItemPrePaint,
00082 DRAWSTAGE_SubItemPostPaint = DRAWSTAGE_SubItem | DRAWSTAGE_ItemPostPaint,
00083 };
00084
00085
00086
00087 enum ITEMSTATE {
00088 ITEMSTATE_Normal = 0x0000,
00089 ITEMSTATE_Selected = 0x0001,
00090 ITEMSTATE_Grayed = 0x0002,
00091 ITEMSTATE_Disabled = 0x0004,
00092 ITEMSTATE_Checked = 0x0008,
00093 ITEMSTATE_Focus = 0x0010,
00094 ITEMSTATE_Default = 0x0020,
00095 ITEMSTATE_Hot = 0x0040,
00096 ITEMSTATE_Marked = 0x0080,
00097 ITEMSTATE_Indeterminant = 0x0100,
00098 };
00099
00100
00101
00102 enum RETVALUE {
00103 RETVALUE_DoDefault = 0x00,
00104 RETVALUE_SkipDefault = 0x04,
00105 RETVALUE_NotifyPostPaint = 0x10,
00106 RETVALUE_NotifyItemDraw = 0x20,
00107 RETVALUE_NotifySubItemDraw = 0x20,
00108 RETVALUE_NotifyPostErase = 0x40,
00109 };
00110
00111 MGD::CONTEXT* GetDrawingContext (
00112 ) const { return (m_pDC); }
00113
00114 DRAWSTAGE GetDrawStage (
00115 ) const { return (m_drawstage); }
00116
00117 ID GetID (
00118 ) const { return (m_id); }
00119
00120 ITEMSTATE GetItemState (
00121 ) const { return (m_itemstate); }
00122
00123 const LRECT2D& GetRect (
00124 ) const { return (m_rect); }
00125
00126 void SetDrawStage (
00127 DRAWSTAGE drawstage
00128 ) { m_drawstage = drawstage; }
00129
00130 protected:
00131
00132 CUSTOMDRAW (
00133 );
00134
00135 CUSTOMDRAW (
00136 DRAWSTAGE drawstage,
00137 ITEMSTATE itemstate,
00138 INT32 ItemNumber,
00139 ID id,
00140 const LRECT2D& rect
00141 );
00142
00143 ~CUSTOMDRAW ()
00144 { }
00145
00146 INT32 GetItemNumber (
00147 ) const { return (m_ItemNumber); }
00148
00149 void SetBase (
00150 ITEMSTATE itemstate,
00151 INT32 ItemNumber,
00152 ID id,
00153 const LRECT2D& rect
00154 );
00155
00156 #ifdef WIN32_MFC
00157 void SetBase (
00158 const NMCUSTOMDRAW *pNM
00159 );
00160 #endif
00161
00162 void SetDrawingContext (
00163 MGD::CONTEXT *pDC
00164 ) { m_pDC = pDC; }
00165
00166 private:
00167 #ifndef GENERATING_DOXYGEN_OUTPUT
00168 DRAWSTAGE m_drawstage;
00169 ITEMSTATE m_itemstate;
00170 INT32 m_ItemNumber;
00171 ID m_id;
00172 LRECT2D m_rect;
00173 MGD::CONTEXT *m_pDC;
00174 #endif // GENERATING_DOXYGEN_OUTPUT
00175
00176 };
00177
00178 DEFINE_ENUM_OP_BITWISE(CUSTOMDRAW::ITEMSTATE)
00179 DEFINE_ENUM_OP_BITWISE(CUSTOMDRAW::RETVALUE)
00180
00181 }
00182
00183 #endif
00184