source: dev/trunk/abdev/ProjectEditor/menu.h@ 295

Last change on this file since 295 was 3, checked in by dai_9181, 18 years ago
File size: 2.5 KB
Line 
1
2
3#define LIGHT_RGB(rgb,ratio) RGB(\
4 LOBYTE(LOWORD(rgb))+(BYTE)((double)(255-LOBYTE(LOWORD(rgb)))*ratio),\
5 HIBYTE(LOWORD(rgb))+(BYTE)((double)(255-HIBYTE(LOWORD(rgb)))*ratio),\
6 LOBYTE(HIWORD(rgb))+(BYTE)((double)(255-LOBYTE(HIWORD(rgb)))*ratio))
7
8
9#define MENUCOLOR_TEXT GetSysColor(COLOR_WINDOWTEXT) //テキストの色
10#define MENUCOLOR_GRAY_TEXT GetSysColor(COLOR_GRAYTEXT) //淡色テキストの色
11#define MENUCOLOR_DEFAULT_LINE GetSysColor(COLOR_3DDKSHADOW) //通常時の線の色
12#define MENUCOLOR_DEFAULT_BACK GetSysColor(COLOR_3DFACE) //通常時の背景色
13#define MENUCOLOR_HOT_LINE GetSysColor(COLOR_ACTIVECAPTION) //ホット状態の線の色
14#define MENUCOLOR_HOT_BACK LIGHT_RGB(MENUCOLOR_HOT_LINE,0.7) //ホット状態の背景色
15#define MENUCOLOR_SELECT_LINE MENUCOLOR_DEFAULT_LINE //選択状態の線の色
16#define MENUCOLOR_SELECT_BACK GetSysColor(COLOR_MENU) //選択状態の背景色
17
18
19extern HFONT hMenuFont;
20
21
22class CSubMenuEx;
23class CMenuEx;
24
25class CMenuItemData{
26public:
27 int item_index;
28 int itemID;
29 LPSTR str;
30
31 CMenuEx *pobj_ThisMenu;
32 CSubMenuEx *pobj_SubMenu;
33
34 HICON hIcon;
35 HICON hGrayIcon;
36
37 CMenuItemData(int item_index,int itemID,char *str,CMenuEx *pobj_ThisMenu,CSubMenuEx *pobj_SubMenu);
38 ~CMenuItemData();
39};
40
41class CMenuEx{
42public:
43 HMENU hMenu;
44
45 CMenuEx(HMENU hmenu);
46 ~CMenuEx();
47
48
49 //拡張メニューデータ
50 CMenuItemData **ppobj_MenuItemData;
51 int iMenuItemNum;
52 CMenuItemData *AddMenuExItemData(int item_index,int itemID,char *str,CMenuEx *pobj_ThisMenu,CSubMenuEx *pobj_SubMenu);
53
54
55
56 void EnableItem(UINT uIDEnableItem,UINT uEnable);
57
58 void CheckMenu(UINT idItem,BOOL bChecked);
59 BOOL IsCheck(UINT idItem);
60
61 void RenameMenuItem(int item_index,char *str);
62 void RenameMenuItemByID(int itemID,char *str);
63
64 void RemoveItem(int item_index);
65 void InsertItem(int item_index,int itemID,char *str);
66
67
68 //アイコン表示拡張
69 BOOL SetIcon(int itemID,HICON hIcon);
70
71
72private:
73 CSubMenuEx *AddSubMenu(HMENU hSubMenu);
74public:
75 // オーナー描画関連
76 void InitOwnerDraw(BOOL bParent);
77 virtual void GetItemSize(int item_index,SIZE *pSize);
78 BOOL OwnerDrawSubMenu(HMENU hSubMenu,HDC hdc,RECT *pRect,BOOL bSelect,int item_index);
79 virtual void OwnerDrawMenu(HDC hdc,RECT *pRect,BOOL bSelect,int item_index);
80};
81
82class CSubMenuEx:public CMenuEx{
83public:
84 CSubMenuEx(HMENU hMenu);
85 virtual void GetItemSize(int item_index,SIZE *pSize);
86 virtual void OwnerDrawMenu(HDC hdc,RECT *pRect,BOOL bSelect,int item_index);
87};
88
89extern CMenuEx *pobj_MainMenu;
Note: See TracBrowser for help on using the repository browser.