00001 #if !defined(AFX_MYIMAGELIST_H__713315A7_7538_4002_984C_B3B4E98A53CD__INCLUDED_)
00002 #define AFX_MYIMAGELIST_H__713315A7_7538_4002_984C_B3B4E98A53CD__INCLUDED_
00003
00004 #if _MSC_VER > 1000
00005 #pragma once
00006 #endif // _MSC_VER > 1000
00007
00008 #include <windowsx.h>
00009 #include <commctrl.h>
00010 class CMyImageList
00011 {
00012 private:
00013 HIMAGELIST himl;
00014 int m_dx;
00015 int m_dy;
00016 HINSTANCE m_hInstance;
00017
00018 public:
00019 CMyImageList()
00020 {
00021 m_dx = 0;
00022 m_dy = 0;
00023 m_hInstance = NULL;
00024 himl = NULL;
00025 }
00026
00027 CMyImageList(int dx, int dy,HINSTANCE hInstance)
00028 {
00029 Init(dx, dy,hInstance);
00030 }
00031
00032 void Init(int dx, int dy,HINSTANCE hInstance)
00033 {
00034 m_hInstance = hInstance;
00035 m_dx = dx;
00036 m_dy = dy;
00037 himl = Create(dx,dy,FALSE,2,0);
00038 }
00039
00040 virtual ~CMyImageList()
00041 {
00042 Destroy();
00043 }
00044
00045 char operator [] (int num)
00046 {
00047 }
00048
00049 operator HIMAGELIST() const
00050 {
00051 return himl;
00052 }
00053
00054 HIMAGELIST Create(int cx, int cy, UINT flags, int cInitial, int cGrow)
00055 {
00056 return ImageList_Create(cx, cy, flags, cInitial, cGrow);
00057 }
00058
00059 BOOL Destroy()
00060 {
00061 return ImageList_Destroy(himl);
00062 }
00063
00064 int GetImageCount()
00065 {
00066 return ImageList_GetImageCount(himl);
00067 }
00068
00069 BOOL SetImageCount(UINT uNewCount)
00070 {
00071 return ImageList_SetImageCount(himl,uNewCount);
00072 }
00073
00074 int Add(HBITMAP hbmImage, HBITMAP hbmMask)
00075 {
00076 return ImageList_Add(himl, hbmImage, hbmMask);
00077 }
00078
00079 int AddImage (int idImage)
00080 {
00081 HBITMAP hBit = ::LoadBitmap(m_hInstance, MAKEINTRESOURCE(idImage));
00082 if (!hBit) return FALSE;
00083 return Add(hBit,NULL);
00084 }
00085
00086 int AddIcon (int idIcon)
00087 {
00088 HICON hbmp = (HICON) ::LoadImage(m_hInstance,MAKEINTRESOURCE(idIcon),IMAGE_ICON,m_dx,m_dy,0);
00089 if (!hbmp) return FALSE;
00090 return Add((HBITMAP)hbmp,NULL);
00091 }
00092
00093 int ReplaceIcon(int i, HICON hicon)
00094 {
00095 return ImageList_ReplaceIcon(himl, i, hicon);
00096 }
00097
00098 COLORREF SetBkColor(COLORREF clrBk)
00099 {
00100 return ImageList_SetBkColor(himl, clrBk);
00101 }
00102
00103 COLORREF GetBkColor()
00104 {
00105 return ImageList_GetBkColor(himl);
00106 }
00107
00108 BOOL SetOverlayImage(int iImage, int iOverlay)
00109 {
00110 return ImageList_SetOverlayImage(himl, iImage, iOverlay);
00111 }
00112
00113 BOOL Draw(int i, HDC hdcDst, int x, int y, UINT fStyle)
00114 {
00115 return ImageList_Draw(himl, i, hdcDst, x, y, fStyle);
00116 }
00117
00118 BOOL Replace(int i, HBITMAP hbmImage, HBITMAP hbmMask)
00119 {
00120 return ImageList_Replace(himl, i, hbmImage, hbmMask);
00121 }
00122
00123 int AddMasked(HBITMAP hbmImage, COLORREF crMask)
00124 {
00125 return ImageList_AddMasked(himl, hbmImage, crMask);
00126 }
00127
00128 BOOL DrawEx(int i, HDC hdcDst, int x, int y, int dx, int dy, COLORREF rgbBk, COLORREF rgbFg, UINT fStyle)
00129 {
00130 return ImageList_DrawEx(himl, i, hdcDst, x, y, dx, dy, rgbBk, rgbFg, fStyle);
00131 }
00132
00133 BOOL DrawIndirect(IMAGELISTDRAWPARAMS* pimldp)
00134 {
00135 return ImageList_DrawIndirect(pimldp);
00136 }
00137
00138 BOOL Remove(int i)
00139 {
00140 return ImageList_Remove(himl, i);
00141 }
00142
00143 HICON GetIcon(int i, UINT flags)
00144 {
00145 return ImageList_GetIcon(himl, i, flags);
00146 }
00147
00148 HIMAGELIST LoadImage(HINSTANCE hi, LPCSTR lpbmp, int cx, int cGrow, COLORREF crMask, UINT uType, UINT uFlags)
00149 {
00150 return ImageList_LoadImage(hi, lpbmp, cx, cGrow, crMask, uType, uFlags);
00151 }
00152
00153 BOOL Copy(int iDst, HIMAGELIST himlSrc, int iSrc, UINT uFlags)
00154 {
00155 return ImageList_Copy(himl, iDst, himlSrc, iSrc, uFlags);
00156 }
00157
00158 BOOL BeginDrag(int iTrack, int dxHotspot, int dyHotspot)
00159 {
00160 return ImageList_BeginDrag(himl, iTrack, dxHotspot, dyHotspot);
00161 }
00162
00163 void EndDrag()
00164 {
00165 ImageList_EndDrag();
00166 }
00167
00168 BOOL DragEnter(HWND hwndLock, int x, int y)
00169 {
00170 return ImageList_DragEnter(hwndLock, x, y);
00171 }
00172
00173 BOOL DragLeave(HWND hwndLock)
00174 {
00175 return ImageList_DragLeave(hwndLock);
00176 }
00177
00178 BOOL DragMove(int x, int y)
00179 {
00180 return ImageList_DragMove(x, y);
00181 }
00182
00183 BOOL SetDragCursorImage(int iDrag, int dxHotspot, int dyHotspot)
00184 {
00185 return ImageList_SetDragCursorImage(himl, iDrag, dxHotspot, dyHotspot);
00186 }
00187
00188 BOOL DragShowNolock(BOOL fShow)
00189 {
00190 return ImageList_DragShowNolock(fShow);
00191 }
00192
00193 HIMAGELIST GetDragImage(POINT FAR* ppt,POINT FAR* pptHotspot)
00194 {
00195 return ImageList_GetDragImage(ppt, pptHotspot);
00196 }
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208 BOOL SetIconSize(int cx, int cy)
00209 {
00210 return ImageList_SetIconSize(himl, cx, cy);
00211 }
00212
00213 BOOL GetImageInfo(int i, IMAGEINFO FAR* pImageInfo)
00214 {
00215 return ImageList_GetImageInfo(himl, i, pImageInfo);
00216 }
00217
00218 HIMAGELIST Merge(int i1, HIMAGELIST himl2, int i2, int dx, int dy)
00219 {
00220 return ImageList_Merge(himl, i1, himl2, i2, dx, dy);
00221 }
00222
00223
00224
00225
00226
00227
00228 HIMAGELIST Duplicate()
00229 {
00230 return ImageList_Duplicate(himl);
00231 }
00232
00233 BOOL RemoveAll()
00234 {
00235 return ImageList_RemoveAll(himl);
00236 }
00237
00238 HICON ExtractIcon(HINSTANCE hi, int i)
00239 {
00240 return ImageList_ExtractIcon(hi, himl, i) ;
00241 }
00242
00243 HIMAGELIST LoadBitmap(HINSTANCE hi, LPCSTR lpbmp, int cx, int cGrow, COLORREF crMask)
00244 {
00245 return ImageList_LoadBitmap(hi, lpbmp, cx, cGrow, crMask);
00246 }
00247 };
00248
00249 #endif // !defined(AFX_MYIMAGELIST_H__713315A7_7538_4002_984C_B3B4E98A53CD__INCLUDED_)