NGenericMenu.h
上传用户:libwxy
上传日期:2007-01-02
资源大小:200k
文件大小:3k
源码类别:

工具条

开发平台:

Visual C++

  1. // NGenericMenu.h: interface for the CNGenericMenu class.
  2. //
  3. /*
  4. Copyright (C) 1998 Tony Hoyle (tmh@netfusion.co.uk)
  5. This program is free software; you can redistribute it and/or modify it under the terms
  6. of the GNU General Public License as published by the Free Software Foundation; either
  7. version 2 of the License, or (at your option) any later version.
  8. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
  9. without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. See the GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License along with this program;
  12. if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  13. */
  14. //////////////////////////////////////////////////////////////////////
  15. #if !defined(AFX_NGENERICMENU_H__F5167101_A3AF_11D1_B0D4_00A0C94457BF__INCLUDED_)
  16. #define AFX_NGENERICMENU_H__F5167101_A3AF_11D1_B0D4_00A0C94457BF__INCLUDED_
  17. #if _MSC_VER >= 1000
  18. #pragma once
  19. #endif // _MSC_VER >= 1000
  20. #include "NGenericToolBar.h"
  21. #include "NGenericPopup.h"
  22. #pragma message ("Include "__FILE__)
  23. #ifndef NGTB_PROJECT
  24. #define NGTB_EXPORT __declspec(dllimport)
  25. #else
  26. #define NGTB_EXPORT __declspec(dllexport)
  27. #endif
  28. #undef AFX_DATA
  29. #define AFX_DATA NGTB_EXPORT
  30. ///////////////////////////////////////////////////////////////////////////
  31. // Class styles to be used by client applications
  32. ///////////////////////////////////////////////////////////////////////////
  33. class CNGenericMenu : public CNGenericToolBar  
  34. {
  35. DECLARE_DYNAMIC(CNGenericMenu)
  36. public:
  37. NGTB_EXPORT CNGenericMenu();
  38. NGTB_EXPORT virtual ~CNGenericMenu();
  39. NGTB_EXPORT BOOL Create(CFrameWnd* pParent);
  40. NGTB_EXPORT BOOL SetMenu(HMENU hMenu);
  41. NGTB_EXPORT BOOL SetMenu(UINT idMenu) { CMenu m; m.LoadMenu(idMenu); return SetMenu(m.Detach()); }
  42. NGTB_EXPORT BOOL DrawMenuBar();
  43. protected:
  44. CFrameWnd* m_pParent;
  45. HMENU m_hMenu;
  46. CNGenericPopup m_popup;
  47. BOOL m_bItemDropped;
  48. int m_iItem;
  49. void ShowDropDown(BOOL bFromKey, int iItem);
  50. virtual BOOL TranslateMenuChar(UINT nChar);
  51. virtual BOOL KeyboardFilter(UINT nChar, UINT nRepCnt, UINT nFlags);
  52. virtual CSize CalcFixedLayout(BOOL bStretch, BOOL bHorz);
  53. virtual void OnOverSysMenu();
  54. protected:
  55. //{{AFX_MSG(CNGenericMenu)
  56. afx_msg void OnNcPaint();
  57. afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
  58. //}}AFX_MSG
  59. afx_msg void OnDropDown(NMHDR * pNotifyStruct, LRESULT* result);
  60. afx_msg void OnHotChange(NMHDR * pNotifyStruct, LRESULT* result);
  61. afx_msg void OnMenuUpdate(CCmdUI* pCmd);
  62. afx_msg LRESULT OnDismiss(WPARAM wParam, LPARAM lParam);
  63. afx_msg void OnIdleUpdateCmdUI();
  64. DECLARE_MESSAGE_MAP()
  65. };
  66. class CNMDIGenericMenu : public CNGenericMenu  
  67. {
  68. DECLARE_DYNAMIC(CNMDIGenericMenu)
  69. public:
  70. NGTB_EXPORT void SubclassMDIClient(HWND hWndClient);
  71. };
  72. #undef AFX_DATA
  73. #define AFX_DATA
  74. #endif // !defined(AFX_NGENERICMENU_H__F5167101_A3AF_11D1_B0D4_00A0C94457BF__INCLUDED_)