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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [host/] [tools/] [configtool/] [standalone/] [win32/] [BCMenu.h] - Blame information for rev 786

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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