home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / winui / shell / fileview / cstathlp.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-06-12  |  2.9 KB  |  90 lines

  1. //THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF 
  2. //ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO 
  3. //THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A 
  4. // PARTICULAR PURPOSE.
  5. //
  6. // Copyright  1994-1996  Microsoft Corporation.  All Rights Reserved.
  7. //
  8. //    PROGRAM: CSTATHLP.H    
  9. //
  10. //    PURPOSE: Class and structure definitions for the CStatusHelper class
  11. //  that manages messages to display in the status bar.  
  12. //
  13. //    PLATFORMS:    Windows 95
  14. //
  15. //    SPECIAL INSTRUCTIONS: N/A
  16. //
  17. #ifndef _CSTATHLP_H_
  18. #define _CSTATHLP_H_
  19.  
  20.  
  21. //For loading the RCDATA mapping menu item IDs to string IDs
  22. typedef struct tagSTATMESSAGEMAP
  23.     {
  24.     USHORT      uID;
  25.     USHORT      idsMsg;
  26.     } STATMESSAGEMAP, *PSTATMESSAGEMAP;
  27.  
  28. //Array mapping menu handles to menu item IDs
  29. typedef struct tagPOPUPMENUMAP
  30.     {
  31.     HMENU       hMenu;
  32.     USHORT      uID;
  33.     } POPUPMENUMAP, *PPOPUPMENUMAP;
  34.  
  35.  
  36. /*
  37.  * The CStatusHelper class simplifies run-time management of
  38.  * status bar messages by setting up a mapping between popup
  39.  * menu handles and item IDs to resource string IDs.  The
  40.  * MenuSelect member processes any WM_MENUSELECT message
  41.  * automatically to display the appropriate message.
  42.  */
  43.  
  44. class CStatusHelper
  45.     {
  46.     protected:
  47.         HWND                m_hWnd;             //hWnd of control
  48.         HINSTANCE           m_hInst;            //Module instance
  49.         BOOL                m_fMapped;          //MessageMap called?
  50.         PCStringTable       m_pST;              //Message strings
  51.  
  52.         UINT                m_uIDCur;           //Current displayed ID.
  53.  
  54.         HWND                m_hWndOwner;        //Frame window
  55.         USHORT              m_cMessages;        //Number of messages
  56.         UINT                m_idsMin;           //Lowest string ID
  57.         UINT                m_idsMax;           //Maximum string ID
  58.  
  59.         USHORT              m_uIDStatic;        //Quiescent message ID
  60.         USHORT              m_uIDBlank;         //Blank message ID
  61.         USHORT              m_uIDSysMenu;       //System menu message ID
  62.  
  63.         USHORT              m_cPopups;          //Number of menus
  64.         USHORT              m_uIDPopupMin;      //Lowest menu ID
  65.         USHORT              m_uIDPopupMax;      //Highest menu ID
  66.  
  67.         HGLOBAL             m_hMemSMM;          //Mapping resource
  68.         PSTATMESSAGEMAP     m_pSMM;             //Item to ID mapping
  69.         PPOPUPMENUMAP       m_pPMM;             //Menu to ID mapping
  70.  
  71.     public:
  72.         CStatusHelper(HWND, HINSTANCE);
  73.         ~CStatusHelper(void);
  74.  
  75.         BOOL   MessageMap(HWND, UINT, UINT, UINT, UINT, UINT, UINT, UINT, UINT, UINT);
  76.         void   MessageDisplay(UINT);
  77.         void   MenuSelect(WORD, WORD, HMENU);
  78.  
  79.     private:
  80.         void   Sort(void);
  81.         USHORT IDFromHMenu(HMENU);
  82.         UINT   IStringFromID(USHORT);
  83.  
  84.     };
  85.  
  86. typedef CStatusHelper *PCStatusHelper;
  87.  
  88.  
  89. #endif //_CSTATHLP_H_
  90.