-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMWMenu.h
83 lines (64 loc) · 3.36 KB
/
MWMenu.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#pragma once
#define ID_MNU_MASK 0xff
#define ID_SYS_MENU 0xff
#define ID_POP_MENU 0xfe
//
////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////
class CMWMenu : public CMenu
{
DECLARE_DYNAMIC(CMWMenu)
public:
CMWMenu(void);
virtual ~CMWMenu(void);
//
public:
static int SetOwnDraw ( HMENU hMenu, bool bOwnDrawn = true, int level = 0 );
int m_iBitmapWidth;
int m_iBitmapHeight;
//
virtual BOOL CreateMenu();
virtual BOOL CreatePopupMenu();
BOOL Attach(HMENU hMenu);
HMENU Detach();
// Entry Point for Popup Menu
virtual BOOL LoadMenu(LPCTSTR lpszResourceName);
// Entry Point for Popup Menu
virtual BOOL LoadMenu(UINT nIDResource);
// Entry Point for System Menu
CMWMenu *SetSystemMenu(CWnd* pWnd, CMenu* pSysMenu);
CMWMenu *SetApplicationMenu(CWnd* pWnd, CMenu* pMenu);
void UnSetSystemMenu(CMenu* pSysMenu);
CMWMenu *GetSubMenu ( int nPos );
virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct );
virtual void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct );
virtual BOOL TrackPopupMenu(UINT nFlags, int x, int y, CWnd* pWnd, LPCRECT lpRect = NULL);
virtual UINT GetMenuItemCount ( );
virtual BOOL GetMenuItemInfo ( UINT uItem, LPMENUITEMINFO lpMenuItemInfo, BOOL fByPos = FALSE );
virtual BOOL SetMenuItemInfo ( UINT uItem, LPMENUITEMINFO lpMenuItemInfo, BOOL fByPos = FALSE );
BOOL AppendMenu(UINT nFlags, UINT_PTR nIDNewItem = 0, LPCTSTR lpszNewItem = NULL);
BOOL AppendMenu(UINT nFlags, UINT_PTR nIDNewItem, const CBitmap* pBmp);
BOOL InsertMenu(UINT nPosition, UINT nFlags, UINT_PTR nIDNewItem = 0, LPCTSTR lpszNewItem = NULL);
BOOL InsertMenu(UINT nPosition, UINT nFlags, UINT_PTR nIDNewItem, const CBitmap* pBmp);
BOOL InsertMenuItem(UINT uItem, LPMENUITEMINFO lpMenuItemInfo, BOOL fByPos = FALSE);
BOOL ModifyMenu(UINT nPosition, UINT nFlags, UINT_PTR nIDNewItem = 0, LPCTSTR lpszNewItem = NULL);
BOOL ModifyMenu(UINT nPosition, UINT nFlags, UINT_PTR nIDNewItem, const CBitmap* pBmp);
virtual BOOL SetMenuInfo(LPCMENUINFO lpcmi);
virtual BOOL GetMenuInfo(LPMENUINFO lpcmi) const;
virtual UINT EnableMenuItem ( UINT nIDEnableItem, UINT nEnable );
void MeasureMenuItem ( CDC *pDC, const char *pText, CSize *pSize, MENUITEMINFO *menuInfo );
void MeasureMenuItem ( LPMEASUREITEMSTRUCT lpMeasureItemStruct );
void DrawMenuItem ( LPDRAWITEMSTRUCT lpDrawItemStruct, CDC *pDC, CRect *pRect, const char *pText, MENUITEMINFO *menuInfo );
void DrawMenuItem ( LPDRAWITEMSTRUCT lpDrawItemStruct );
void ComputeBitmapMaxSize ( );
void ComputeBitmapMaxSize ( HBITMAP hBitmap );
void DrawBitmap ( CDC *pDC, CBitmap *pBitmap, CRect *pRect );
int DrawBitmap(LPDRAWITEMSTRUCT lpDrawItemStruct );
BOOL SetMenuItemBitmaps ( UINT nPosition, UINT nFlags, const CBitmap *pBmpUnchecked, const CBitmap *pBmpChecked );
CMenu *GetSubMenu ();
protected :
CWnd *m_pWnd;
CMenu *m_pSubMenu;
HICON m_hCheckWhiteIcon;
};