OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [tools/] [src/] [tools/] [configtool/] [standalone/] [win32/] [BCMenu.h] - Blame information for rev 174

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 26 unneback
//####COPYRIGHTBEGIN####
2
//                                                                          
3
// ----------------------------------------------------------------------------
4
// Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
5
//
6
// This program is part of the eCos host tools.
7
//
8
// This program is free software; you can redistribute it and/or modify it 
9
// under the terms of the GNU General Public License as published by the Free 
10
// Software Foundation; either version 2 of the License, or (at your option) 
11
// any later version.
12
// 
13
// This program is distributed in the hope that it will be useful, but WITHOUT 
14
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
15
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for 
16
// more details.
17
// 
18
// You should have received a copy of the GNU General Public License along with
19
// this program; if not, write to the Free Software Foundation, Inc., 
20
// 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
21
//
22
// ----------------------------------------------------------------------------
23
//                                                                          
24
//####COPYRIGHTEND####
25
 
26
//#####DESCRIPTIONBEGIN####                                             
27
//*************************************************************************
28
// BCMenu.h : header file
29
// Version : 2.63
30
// Date : December 2, 1999
31
// Author : Brent Corkum
32
// Email :  corkum@rocscience.com
33
// Latest Version : http://www.rocscience.com/~corkum/BCMenu.html
34
// 
35
// Bug Fixes and portions of code supplied by:
36
//
37
// Ben Ashley,Girish Bharadwaj,Jean-Edouard Lachand-Robert,
38
// Robert Edward Caldecott,Kenny Goers,Leonardo Zide,
39
// Stefan Kuhr,Reiner Jung,Martin Vladic,Kim Yoo Chul,
40
// Oz Solomonovich
41
//
42
// You are free to use/modify this code but leave this header intact.
43
// This class is public domain so you are free to use it any of
44
// your applications (Freeware,Shareware,Commercial). All I ask is
45
// that you let me know so that if you have a real winner I can
46
// brag to my buddies that some of my code is in your app. I also
47
// wouldn't mind if you sent me a copy of your application since I
48
// like to play with new stuff.
49
//*************************************************************************
50
//####DESCRIPTIONEND####
51
 
52
#ifndef BCMenu_H
53
#define BCMenu_H
54
 
55
#include <afxtempl.h>
56
 
57
// BCMenuData class. Fill this class structure to define a single menu item:
58
 
59
class BCMenuData
60
{
61
wchar_t *m_szMenuText;
62
public:
63
BCMenuData () {menuIconNormal=-1;xoffset=-1;bitmap=NULL;pContext=NULL;
64
               nFlags=0;nID=0;syncflag=0;m_szMenuText=NULL;};
65
void SetAnsiString(LPCSTR szAnsiString);
66
void SetWideString(const wchar_t *szWideString);
67
const wchar_t *GetWideString(void) {return m_szMenuText;};
68
~BCMenuData ();
69
CString GetString(void);//returns the menu text in ANSI or UNICODE
70
int xoffset;
71
int menuIconNormal;
72
UINT nFlags,nID,syncflag;
73
CImageList *bitmap;
74
void *pContext; // used to attach user data
75
};
76
 
77
//struct CMenuItemInfo : public MENUITEMINFO {
78
struct CMenuItemInfo : public
79
//MENUITEMINFO 
80
#ifndef UNICODE   //SK: this fixes warning C4097: typedef-name 'MENUITEMINFO' used as synonym for class-name 'tagMENUITEMINFOA'
81
tagMENUITEMINFOA
82
#else
83
tagMENUITEMINFOW
84
#endif
85
    {
86
        CMenuItemInfo()
87
        { memset(this, 0, sizeof(MENUITEMINFO));
88
          cbSize = sizeof(MENUITEMINFO);
89
        }
90
};
91
 
92
 
93
 
94
 
95
typedef enum {Normal,TextOnly} HIGHLIGHTSTYLE;
96
 
97
#ifndef UNICODE
98
#define AppendMenu AppendMenuA
99
#define InsertMenu InsertMenuA
100
#define InsertODMenu InsertODMenuA
101
#define AppendODMenu AppendODMenuA
102
#define AppendODPopupMenu AppendODPopupMenuA
103
#define ModifyODMenu ModifyODMenuA
104
#else
105
#define AppendMenu AppendMenuW
106
#define InsertMenu InsertMenuW
107
#define InsertODMenu InsertODMenuW
108
#define AppendODMenu AppendODMenuW
109
#define ModifyODMenu ModifyODMenuW
110
#define AppendODPopupMenu AppendODPopupMenuW
111
#endif
112
 
113
 
114
class BCMenu : public CMenu  // Derived from CMenu
115
{
116
// Construction
117
public:
118
BCMenu();
119
 
120
// Attributes
121
protected:
122
CTypedPtrArray<CPtrArray, BCMenuData*> m_MenuList;  // Stores list of menu items 
123
 
124
// When loading an owner-drawn menu using a Resource, BCMenu must keep track of
125
// the popup menu's that it creates. Warning, this list *MUST* be destroyed
126
// last item first :)
127
CTypedPtrArray<CPtrArray, HMENU>  m_SubMenus;  // Stores list of sub-menus 
128
 
129
// Stores a list of all BCMenu's ever created 
130
static CTypedPtrArray<CPtrArray, HMENU>  m_AllSubMenus;
131
 
132
// Operations
133
public:
134
// Overrides
135
// ClassWizard generated virtual function overrides
136
//{{AFX_VIRTUAL(CCustomMenu)
137
//}}AFX_VIRTUAL 
138
// Implementation
139
public:
140
  static BOOL IsNewShell(void);
141
  void SetBitmapBackground(COLORREF color);
142
  void SetDisableOldStyle(void);
143
  void UnSetDisableOldStyle(void);
144
  BOOL GetDisableOldStyle(void);
145
  void UnSetBitmapBackground(void);
146
  BOOL AddBitmapToImageList(CImageList *list,UINT nResourceID);
147
  BOOL LoadFromToolBar(UINT nID,UINT nToolBar,int& xoffset);
148
  void InsertSpaces(void);
149
  static LRESULT FindKeyboardShortcut(UINT nChar,UINT nFlags,CMenu *pMenu);
150
  static void UpdateMenu(CMenu *pmenu);
151
  static BOOL IsMenu(CMenu *submenu);
152
  static BOOL IsMenu(HMENU submenu);
153
  void DrawCheckMark(CDC *pDC,int x,int y,COLORREF color);
154
  void DrawRadioDot(CDC *pDC,int x,int y,COLORREF color);
155
  BCMenuData *BCMenu::FindMenuItem(UINT nID);
156
  BCMenu *FindMenuOption(int nId,int& nLoc);
157
  BCMenuData *FindMenuOption(wchar_t *lpstrText);
158
  BOOL GetMenuText(UINT id,CString &string,UINT nFlags = MF_BYPOSITION );
159
  CImageList *checkmaps;
160
  BOOL checkmapsshare;
161
  int m_selectcheck;
162
  int m_unselectcheck;
163
  BOOL m_bDynIcons;
164
 
165
  void LoadCheckmarkBitmap(int unselect,int select);
166
  void DitherBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth,
167
                 int nHeight, HBITMAP hbm, int nXSrc, int nYSrc);
168
  void DitherBlt2(CDC *drawdc, int nXDest, int nYDest, int nWidth,
169
                  int nHeight, CBitmap &bmp, int nXSrc, int nYSrc);
170
  static HBITMAP LoadSysColorBitmap(int nResourceId);
171
  BOOL GetBitmapFromImageList(CDC* pDC,CImageList *imglist,int nIndex,CBitmap &bmp);
172
  BOOL ImageListDuplicate(CImageList *il,int xoffset,CImageList *newlist);
173
 
174
virtual ~BCMenu();  // Virtual Destructor 
175
// Drawing: 
176
virtual void DrawItem( LPDRAWITEMSTRUCT);  // Draw an item
177
virtual void MeasureItem( LPMEASUREITEMSTRUCT );  // Measure an item
178
 
179
// Customizing:
180
 
181
void SetIconSize (int, int);  // Set icon size
182
 
183
BOOL AppendODMenuA(LPCSTR lpstrText,
184
UINT nFlags = MF_OWNERDRAW,
185
UINT nID = 0,
186
int nIconNormal = -1);
187
 
188
BOOL AppendODMenuW(wchar_t *lpstrText,
189
UINT nFlags = MF_OWNERDRAW,
190
UINT nID = 0,
191
int nIconNormal = -1);
192
 
193
BOOL AppendODMenuA(LPCSTR lpstrText,
194
UINT nFlags,
195
UINT nID,
196
CImageList *il,
197
int xoffset);
198
 
199
BOOL AppendODMenuW(wchar_t *lpstrText,
200
UINT nFlags,
201
UINT nID,
202
CImageList *il,
203
int xoffset);
204
 
205
BOOL InsertODMenuA(UINT nPosition,
206
LPCSTR lpstrText,
207
UINT nFlags = MF_OWNERDRAW,
208
UINT nID = 0,
209
int nIconNormal = -1);
210
 
211
BOOL InsertODMenuW(UINT nPosition,
212
wchar_t *lpstrText,
213
UINT nFlags = MF_OWNERDRAW,
214
UINT nID = 0,
215
int nIconNormal = -1);
216
 
217
BOOL InsertODMenuA(UINT nPosition,
218
LPCSTR lpstrText,
219
UINT nFlags,
220
UINT nID,
221
CImageList *il,
222
int xoffset);
223
 
224
BOOL InsertODMenuW(UINT nPosition,
225
wchar_t *lpstrText,
226
UINT nFlags,
227
UINT nID,
228
CImageList *il,
229
int xoffset);
230
 
231
 
232
BOOL ModifyODMenuA(const char *lpstrText,UINT nID=0,int nIconNormal=-1);
233
BOOL ModifyODMenuA(const char *lpstrText,UINT nID,CImageList *il,int xoffset);
234
BOOL ModifyODMenuA(const char *lpstrText,UINT nID,CBitmap *bmp);
235
BOOL ModifyODMenuA(const char *lpstrText,const char *OptionText,int nIconNormal);
236
BOOL ModifyODMenuW(wchar_t *lpstrText,UINT nID=0,int nIconNormal=-1);
237
BOOL ModifyODMenuW(wchar_t *lpstrText,UINT nID,CImageList *il,int xoffset);
238
BOOL ModifyODMenuW(wchar_t *lpstrText,UINT nID,CBitmap *bmp);
239
BOOL ModifyODMenuW(wchar_t *lpstrText,wchar_t *OptionText,int nIconNormal);
240
BCMenuData *NewODMenu(UINT pos,UINT nFlags,UINT nID,CString string);
241
void SynchronizeMenu(void);
242
void BCMenu::InitializeMenuList(int value);
243
void BCMenu::DeleteMenuList(void);
244
BCMenuData *BCMenu::FindMenuList(UINT nID);
245
virtual BOOL LoadMenu(LPCTSTR lpszResourceName);  // Load a menu
246
virtual BOOL LoadMenu(int nResource);  // ... 
247
void AddFromToolBar(CToolBar* pToolBar, int nResourceID);
248
BOOL Draw3DCheckmark(CDC *dc, const CRect& rc,BOOL bSelected,
249
                     HBITMAP hbmCheck);
250
BOOL LoadToolbar(UINT nToolBar);
251
BOOL LoadToolbars(const UINT *arID,int n);
252
 
253
// new overrides for dynamic menu's
254
BOOL    RemoveMenu(UINT uiId,UINT nFlags);
255
BOOL    DeleteMenu(UINT uiId,UINT nFlags);
256
BOOL  AppendMenuA(UINT nFlags,UINT nIDNewItem=0,const char *lpszNewItem=NULL,int nIconNormal=-1);
257
BOOL  AppendMenuA(UINT nFlags,UINT nIDNewItem,const char *lpszNewItem,CImageList *il,int xoffset);
258
BOOL  AppendMenuA(UINT nFlags,UINT nIDNewItem,const char *lpszNewItem,CBitmap *bmp);
259
BOOL  AppendMenuW(UINT nFlags,UINT nIDNewItem=0,wchar_t *lpszNewItem=NULL,int nIconNormal=-1);
260
BOOL  AppendMenuW(UINT nFlags,UINT nIDNewItem,wchar_t *lpszNewItem,CImageList *il,int xoffset);
261
BOOL  AppendMenuW(UINT nFlags,UINT nIDNewItem,wchar_t *lpszNewItem,CBitmap *bmp);
262
BOOL  InsertMenuA(UINT nPosition,UINT nFlags,UINT nIDNewItem=0,const char *lpszNewItem=NULL,int nIconNormal=-1);
263
BOOL  InsertMenuA(UINT nPosition,UINT nFlags,UINT nIDNewItem,const char *lpszNewItem,CImageList *il,int xoffset);
264
BOOL  InsertMenuA(UINT nPosition,UINT nFlags,UINT nIDNewItem,const char *lpszNewItem,CBitmap *bmp);
265
BOOL  InsertMenuW(UINT nPosition,UINT nFlags,UINT nIDNewItem=0,wchar_t *lpszNewItem=NULL,int nIconNormal=-1);
266
BOOL  InsertMenuW(UINT nPosition,UINT nFlags,UINT nIDNewItem,wchar_t *lpszNewItem,CImageList *il,int xoffset);
267
BOOL  InsertMenuW(UINT nPosition,UINT nFlags,UINT nIDNewItem,wchar_t *lpszNewItem,CBitmap *bmp);
268
BCMenu* AppendODPopupMenuA(LPCSTR lpstrText);
269
BCMenu* AppendODPopupMenuW(wchar_t *lpstrText);
270
 
271
// Destoying:
272
 
273
virtual BOOL DestroyMenu();
274
 
275
// Generated message map functions
276
protected:
277
int m_iconX,m_iconY;
278
COLORREF m_bitmapBackground;
279
BOOL m_bitmapBackgroundFlag;
280
BOOL disable_old_style;
281
};
282
 
283
#endif
284
 
285
//*************************************************************************

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.