// This is a part of the Microsoft Foundation Classes C++ library. // Copyright (C) Microsoft Corporation // All rights reserved. // // This source code is only intended as a supplement to the // Microsoft Foundation Classes Reference and related // electronic documentation provided with the library. // See these sources for detailed information regarding the // Microsoft Foundation Classes product. #pragma once #include "afxcontrolbarutil.h" #include "afxtoolbarimages.h" #include "afxtoolbarbutton.h" #include "afxcmdusagecount.h" #include <__atlmfc_core.h> #pragma warning(push) #pragma warning(disable : _ATLMFC_DISABLED_WARNINGS) #ifdef _AFX_PACKING #pragma pack(push, _AFX_PACKING) #endif #ifdef _AFX_MINREBUILD #pragma component(minrebuild, off) #endif class CCommandManager; CCommandManager* AFX_CDECL GetCmdMgr(); #define afxCommandManager GetCmdMgr() class CCommandManager { friend class _STATIC_CREATOR_; protected: CCommandManager(); public: virtual ~CCommandManager(); void CleanUp(); // Final cleaning // Image functions void SetCmdImage(UINT uiCmd, int iImage, BOOL bUserImage); int GetCmdImage(UINT uiCmd, BOOL bUserImage = FALSE) const; void ClearCmdImage(UINT uiCmd); void ClearUserCmdImages(); void ClearAllCmdImages(); void EnableMenuItemImage(UINT uiCmd, BOOL bEnable = TRUE, int nUserImage = -1); BOOL IsMenuItemWithoutImage(UINT uiCmd) const { return m_lstCommandsWithoutImages.Find(uiCmd) != NULL; } int GetMenuUserImage(UINT uiMenuCmd) const { int iImage = -1; m_mapMenuUserImages.Lookup(uiMenuCmd, iImage); return iImage; } BOOL LoadState(LPCTSTR lpszProfileName); BOOL SaveState(LPCTSTR lpszProfileName); protected: CMap m_CommandIndex; CMap m_CommandIndexUser; CMap m_DefaultImages; // List of menu items where image appearance is disabled: CList m_lstCommandsWithoutImages; // List of menu items with user images: CMap m_mapMenuUserImages; }; #ifdef _AFX_MINREBUILD #pragma component(minrebuild, on) #endif #ifdef _AFX_PACKING #pragma pack(pop) #endif // _ATLMFC_DISABLED_WARNINGS #pragma warning(pop)