GroupsMenu.cpp
资源名称:propgrid.zip [点击查看]
上传用户:yangzi5763
上传日期:2007-01-02
资源大小:239k
文件大小:2k
源码类别:
ActiveX/DCOM/ATL
开发平台:
Visual C++
- /************************************
- REVISION LOG ENTRY
- Revision By: Mihai Filimon
- Revised on 12/4/98 1:51:42 PM
- Comments: GroupsMenu.cpp: implementation of the CGroupsMenu class.
- ************************************/
- #include "stdafx.h"
- #include "xpropertieswnd.h"
- #include "GroupsMenu.h"
- #include "PageListCtrlDesign.h"
- #ifdef _DEBUG
- #undef THIS_FILE
- static char THIS_FILE[]=__FILE__;
- #define new DEBUG_NEW
- #endif
- //////////////////////////////////////////////////////////////////////
- // Construction/Destruction
- //////////////////////////////////////////////////////////////////////
- // Function name : CGroupsMenu::CGroupsMenu
- // Description :
- // Return type :
- CGroupsMenu::CGroupsMenu(CPageListCtrlDesign* pSourceList)
- {
- SetParent(pSourceList);
- }
- // Function name : CGroupsMenu::~CGroupsMenu
- // Description :
- // Return type :
- CGroupsMenu::~CGroupsMenu()
- {
- }
- // Function name : CGroupsMenu::SetParent
- // Description : Set a responsabile!
- // Return type : void
- // Argument : CPageListCtrlDesign* pSourceList
- void CGroupsMenu::SetParent(CPageListCtrlDesign* pSourceList)
- {
- m_pSourceList = pSourceList;
- }
- // Function name : CGroupsMenu::Add2Menu
- // Description : Append all item
- // Return type : void
- // Argument : CMenu *pMenu
- void CGroupsMenu::Add2Menu(CMenu *pMenu)
- {
- ASSERT (m_pSourceList && ::IsWindow(m_pSourceList->m_hWnd));
- int iItem = NULL;
- if (LPCTSTR lpszGroup = m_pSourceList->GetFirstGroupName(iItem))
- {
- DestroyMenu();
- m_mapIDs.RemoveAll();
- if (CreateMenu())
- {
- UINT idCommand = m_pSourceList->GetFirstIDFree();
- AppendMenu(MF_STRING, idCommand++ , _T(""));
- while (lpszGroup)
- {
- m_mapIDs[idCommand] = iItem;
- AppendMenu(MF_STRING, idCommand++ , lpszGroup);
- lpszGroup = m_pSourceList->GetNextGroupName(iItem);
- }
- pMenu->AppendMenu(MF_POPUP, (UINT)m_hMenu, _T("Groups"));
- }
- }
- }
- // Function name : CGroupsMenu::Get
- // Description : get the name of idCommand
- // Return type : CString
- // Argument : UINT idCommand
- int CGroupsMenu::Get(UINT idCommand)
- {
- int vValue = NULL;
- if (idCommand == m_pSourceList->GetFirstIDFree())
- return -1;
- if (m_mapIDs.Lookup(idCommand, vValue))
- return vValue;
- return -2;
- }