Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

85 lines
1.5 KiB

  1. //
  2. // cuiicon.h
  3. //
  4. #ifndef CUIICON_H
  5. #define CUIICON_H
  6. #include "cuiutil.h"
  7. #include "delay.h"
  8. #include "osver.h"
  9. //////////////////////////////////////////////////////////////////////////////
  10. //
  11. // CUIFIcon
  12. //
  13. // Substitue hIcon to support single imagelist.
  14. //
  15. // todo:
  16. // We want to share the imagelist in future.
  17. //
  18. //////////////////////////////////////////////////////////////////////////////
  19. class CUIFIcon
  20. {
  21. public:
  22. CUIFIcon()
  23. {
  24. m_hIcon = NULL;
  25. m_himl = NULL;
  26. m_nimlId = 0;
  27. }
  28. ~CUIFIcon()
  29. {
  30. if (m_himl)
  31. ImageList_Destroy( m_himl );
  32. }
  33. const CUIFIcon& operator=(HICON hIcon)
  34. {
  35. m_hIcon = hIcon;
  36. if (m_himl)
  37. {
  38. ImageList_Destroy( m_himl );
  39. m_himl = NULL;
  40. }
  41. return *this;
  42. }
  43. operator HICON() {return m_hIcon;}
  44. HIMAGELIST GetImageList(BOOL fMirror)
  45. {
  46. SIZE size;
  47. if (m_himl)
  48. return m_himl;
  49. if (!m_hIcon)
  50. return NULL;
  51. CUIGetIconSize( m_hIcon, &size );
  52. DWORD dwFlags = ILC_COLOR32 | ILC_MASK;
  53. if (fMirror && IsOnNT51())
  54. dwFlags |= ILC_MIRROR;
  55. m_himl = ImageList_Create(size.cx, size.cy, dwFlags, 1, 0);
  56. if (m_himl)
  57. ImageList_AddIcon( m_himl, m_hIcon );
  58. return m_himl;
  59. }
  60. int GetImageListId() {return m_nimlId;}
  61. private:
  62. HICON m_hIcon;
  63. HIMAGELIST m_himl;
  64. int m_nimlId;
  65. };
  66. #endif CUIICON_H