-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEZMenu.h
118 lines (60 loc) · 2.18 KB
/
EZMenu.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
//////
// EZMenu - Owner drawn menu with Icons & progressbars
// Copyright V.Lakshmi Narasimhan,[email protected].
// Feel free to use,modify,twist,turn or even
// digest the code for any non commercial purposes.
// I would appreciate constructive suggestions & bug reports.
// Please dont delete the above lines.
///////
#ifndef __EZMENU_H__
#define __EZMENU_H__
#if _MSC_VERSION>=1000
#pragma once
#endif// _MSC_VERSION>=1000
class CEZMenuItemData
{
public:
CEZMenuItemData();
HICON hItemIconLarge;//Large Icon Handle
HICON hItemIconSmall;//Small Icon Handle
CString strItemText;//Menu string
BOOL bChecked;//Is item checked?
BOOL bSeperator;
//Why do you need an Owner drawn menu to draw a **seperator**?
BOOL bProgress;//Progressbar needed?
int nProgress; //if bProgress what is the percentage?
};
//Useful typedef
typedef CEZMenuItemData* LPEZMENUITEMDATA;
typedef void (CALLBACK* LPDRAWITEMCALLBACKPROC)(LPDRAWITEMSTRUCT);
//Header file for EZMenu Self drawn menu
class CEZMenu :public CMenu
{
public:
CEZMenu();
void InsertOwnerDrawnMenuItem(UINT nID,LPEZMENUITEMDATA lpez,int nPos=0);
void AppendOwnerDrawnMenuItem(UINT nID,LPEZMENUITEMDATA lpez);
void ModifyOwnerDrawnMenuItem(int nPos,UINT nID,int nTotalCheck,LPEZMENUITEMDATA lpez);
void SetTotalItems(int nItems);//necessary.
void SetMenuBitmap(HBITMAP hBitmap);
void SetExtensionColor(COLORREF clrExtend);
//if bitmap is shorter than menu height
void SetBitmapDimension(CSize sz);
void SetLargeIcon(BOOL bLarge=FALSE);//Large or Small?
void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct);
BOOL SetDrawItemCallBack(LPDRAWITEMCALLBACKPROC lpfn);
~CEZMenu();
public:
CPtrArray m_pArrData;
private:
int m_nCount;//temp
int m_nAveHeight;//average height of each menu item
int m_nItems;//No of items
COLORREF m_clrExtend;//extension color
BOOL m_bLargeIcons;
CSize m_szBitmapSize;
CBitmap m_bitmap;
LPDRAWITEMCALLBACKPROC lpDrawItemCallBackProc;
};
#endif //__EZMENU_H__