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

工具条

开发平台:

Visual C++

  1. #if !defined(AFX_NGENERICPOPUP_H__AD9E2C63_A3B6_11D1_B0D4_00A0C94457BF__INCLUDED_)
  2. #define AFX_NGENERICPOPUP_H__AD9E2C63_A3B6_11D1_B0D4_00A0C94457BF__INCLUDED_
  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. #if _MSC_VER >= 1000
  15. #pragma once
  16. #endif // _MSC_VER >= 1000
  17. // NGenericPopup.h : header file
  18. //
  19. /////////////////////////////////////////////////////////////////////////////
  20. // CNGenericPopup window
  21. class CNGenericToolBar;
  22. struct IconMap;
  23. class CNGenericPopup : public CWnd
  24. {
  25. DECLARE_DYNAMIC(CNGenericPopup);
  26. public:
  27. CNGenericPopup();
  28. virtual ~CNGenericPopup();
  29. BOOL ShowMenu(int nOrient, BOOL bFromKey, CNGenericToolBar* pToolbar, int x, int y, CWnd* pParent, HMENU hMenu);
  30. BOOL HideMenu();
  31. BOOL KeyboardFilter(UINT nChar, UINT nRepCnt, UINT nFlags);
  32. BOOL SetIconMap(int nIconMapSize, IconMap* pIconMap);
  33. protected:
  34. CWnd* m_pParent;
  35. CNGenericToolBar* m_pToolbar;
  36. CMenu* m_pMenu;
  37. CBitmap m_tick;
  38. CBitmap m_arrow1,m_arrow2;
  39. CSize m_sztick;
  40. CArray<CRect,CRect&> m_rectItem;
  41. int m_nSelectedItem;
  42. BOOL m_bMouseInMenu;
  43. BOOL m_nOrient;
  44. struct Accel { UINT nKey; UINT nId; };
  45. CArray<Accel,Accel&> m_accelList;
  46. CNGenericPopup* m_pSubMenu;
  47. IconMap* m_pIconMap;
  48. int m_nIconMapSize;
  49. CSize DrawMenuItem(int nItem, CDC& dc, const CRect& rect, BOOL bHighlight, BOOL bReallyDraw);
  50. void SelectItem(int nItem);
  51. BOOL TranslateMenuChar(UINT nChar);
  52. void DestroyRootMenu();
  53. protected:
  54. //{{AFX_VIRTUAL(CNGenericPopup)
  55. //}}AFX_VIRTUAL
  56. //{{AFX_MSG(CNGenericPopup)
  57. afx_msg void OnPaint();
  58. afx_msg void OnDestroy();
  59. afx_msg void OnMouseMove(UINT nFlags, CPoint point);
  60. afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  61. afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
  62. afx_msg void OnCaptureChanged(CWnd *pWnd);
  63. afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
  64. //}}AFX_MSG
  65. afx_msg LRESULT OnInitMenuPopup(WPARAM wParam, LPARAM lParam);
  66. afx_msg LRESULT OnMenuSelect(WPARAM wParam, LPARAM lParam);
  67. DECLARE_MESSAGE_MAP()
  68. };
  69. const int WM_MENU_DISMISS = RegisterWindowMessage("WM_MENU_DISMISS");
  70. enum
  71. {
  72. POP_MENU_LEFT,
  73. POP_MENU_RIGHT,
  74. POP_MENU_TOP,
  75. POP_MENU_BOTTOM
  76. };
  77. /////////////////////////////////////////////////////////////////////////////
  78. //{{AFX_INSERT_LOCATION}}
  79. // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
  80. #endif // !defined(AFX_NGENERICPOPUP_H__AD9E2C63_A3B6_11D1_B0D4_00A0C94457BF__INCLUDED_)