home *** CD-ROM | disk | FTP | other *** search
/ Windows Graphics Programming / Feng_Yuan_Win32_GDI_DirectX.iso / Samples / include / BitmapMenu.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-25  |  1.6 KB  |  48 lines

  1. #pragma once
  2.  
  3. //-----------------------------------------------------------------------------------//
  4. //              Windows Graphics Programming: Win32 GDI and DirectDraw               //
  5. //                             ISBN  0-13-086985-6                                   //
  6. //                                                                                   //
  7. //  Written            by  Yuan, Feng                             www.fengyuan.com   //
  8. //  Copyright (c) 2000 by  Hewlett-Packard Company                www.hp.com         //
  9. //  Published          by  Prentice Hall PTR, Prentice-Hall, Inc. www.phptr.com      //
  10. //                                                                                   //
  11. //  FileName   : bitmapmenu.h                                                         //
  12. //  Description: Use bitmap on the menu                                              //
  13. //  Version    : 1.00.000, May 31, 2000                                              //
  14. //-----------------------------------------------------------------------------------//
  15.  
  16. class KBitmapMenu
  17. {
  18.     typedef enum { MAX_BITMAP = 16 };
  19.  
  20.     HBITMAP m_hBitmap[MAX_BITMAP];
  21.     int     m_nBitmap;
  22.     HMENU   m_hMenu;
  23.     int        m_nChecked;
  24.     int        m_nFirstCommand;
  25.  
  26. public:
  27.     KBitmapMenu()
  28.     {
  29.         m_nBitmap = 0;
  30.     }
  31.  
  32.     ~KBitmapMenu()
  33.     {
  34.         for (int i=0; i<m_nBitmap; i++)
  35.             DeleteObject(m_hBitmap[i]);
  36.     }
  37.  
  38.     void AddToMenu(HMENU hMenu, int nCount, HMODULE hModule, const int hID[], int nFirstCommand);
  39.  
  40.     int OnCommand(int nCmdId);
  41.  
  42.     HBITMAP GetChecked(int & nChecked)
  43.     {
  44.         nChecked = m_nChecked;
  45.         return m_hBitmap[nChecked];
  46.     }
  47. };
  48.