XDesignPopupMenu.cpp
上传用户:yangzi5763
上传日期:2007-01-02
资源大小:239k
文件大小:2k
源码类别:

ActiveX/DCOM/ATL

开发平台:

Visual C++

  1. /************************************
  2.   REVISION LOG ENTRY
  3.   Revision By: Mihai Filimon
  4.   Revised on 10/14/98 12:17:45 PM
  5.   Comments: XDesignPopupMenu.cpp: implementation of the CXDesignPopupMenu class.
  6.  ************************************/
  7. #include "stdafx.h"
  8. #include "xpropertieswnd.h"
  9. #include "XDesignPopupMenu.h"
  10. #ifdef _DEBUG
  11. #undef THIS_FILE
  12. static char THIS_FILE[]=__FILE__;
  13. #define new DEBUG_NEW
  14. #endif
  15. //////////////////////////////////////////////////////////////////////
  16. // Construction/Destruction
  17. //////////////////////////////////////////////////////////////////////
  18. // Function name : CXDesignPopupMenu::CXDesignPopupMenu
  19. // Description     : default Contructor
  20. // Return type : 
  21. CXDesignPopupMenu::CXDesignPopupMenu(UINT nIDMenu, LPCTSTR lpszPopupName, CPoint p, CWnd* pParentWnd )
  22. {
  23. m_pPopupMenu = NULL;
  24. m_point = p;
  25. m_pParentWnd = pParentWnd;
  26. VERIFY(LoadMenu(nIDMenu));
  27. int i = 0;
  28. CString popupName;
  29. while (GetMenuString(i, popupName, MF_BYPOSITION)>0)
  30. {
  31. if (popupName.CompareNoCase(lpszPopupName) == 0)
  32. {
  33. m_pPopupMenu = GetSubMenu(i);
  34. break;
  35. }
  36. i++;
  37. }
  38. }
  39. // Function name : CXDesignPopupMenu::~CXDesignPopupMenu
  40. // Description     : virtual destructor
  41. // Return type : 
  42. CXDesignPopupMenu::~CXDesignPopupMenu()
  43. {
  44. }
  45. // Function name : CXDesignPopupMenu::GetPopupMenu
  46. // Description     : 
  47. // Return type : CMenu* 
  48. CMenu* CXDesignPopupMenu::GetPopupMenu()
  49. {
  50. return m_pPopupMenu;
  51. }
  52. // Function name : CXDesignPopupMenu::Show
  53. // Description     : Show the popup menu
  54. // Return type : void 
  55. BOOL CXDesignPopupMenu::Show()
  56. {
  57. if (CMenu* pMenu = GetPopupMenu())
  58. {
  59. pMenu->TrackPopupMenu(TPM_CENTERALIGN, m_point.x ,m_point.y, m_pParentWnd, NULL);
  60. return TRUE;
  61. }
  62. return FALSE;
  63. }