Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cWndImageList.h
Go to the documentation of this file.
1 //
4 //
5 
6 #ifndef _INC_cWndImageList_H
7 #define _INC_cWndImageList_H
8 #ifndef NO_PRAGMA_ONCE
9 #pragma once
10 #endif
11 
12 #include "cWindow.h"
13 
14 #if ! defined(_MFC_VER) && defined(_WIN32) && ! defined(_WINDLL) && (_MSC_VER>=1300)
17 
18 #include <commctrl.h> // HIMAGELIST
19 
20 namespace Gray
21 {
22  template <> inline void cHandlePtr<HIMAGELIST>::CloseHandle(HIMAGELIST h) // static
23  {
24  ::ImageList_Destroy(h);
25  }
26 }
27 
28 namespace GrayLib
29 {
30  class CWndImageEntry : public cRefBase
31  {
34 
35  public:
36  int m_iImageIndex;
37  cString m_sName;
38  public:
39  CWndImageEntry(int iImageIndex, cString sName)
40  : m_iImageIndex(iImageIndex)
41  , m_sName(sName)
42  {
43  }
44  cString get_Name() const
45  {
46  return m_sName;
47  }
48  };
49 
50  class GRAYLIB_LINK cWndImageList : public CObject, public cHandlePtr<HIMAGELIST>
51  {
55 
56  public:
57  cThreadLockArrayName<CWndImageEntry> m_aIcons;
58  public:
59  cWndImageList();
60  ~cWndImageList();
61 
62  bool Create(int cx, int cy, UINT nFlags, int nInitial, int nGrow);
63  // bool DeleteImageList();
64 
65  int Add(HICON hIcon);
66 
68  int FindImageIndex(const GChar_t* pszName) const;
69  void AddImageIndex(cString sName, int iImageIndex);
70  int AddImage(cString sName, HICON hIcon);
71  };
72 };
73 
74 #endif
75 #endif
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
void CloseHandle()
Definition: cHandlePtr.h:79
Definition: cMesh.h:22
< The main namespace for all Core functions.
Definition: GrayCore.cpp:14
char GChar_t
My version of TCHAR, _TCHAR.
Definition: StrConst.h:26
cStringT< GChar_t > cString
Definition: cString.h:636