1: /*
2: ============================================================================
3: xoblite™ -> an advanced "extended shell" for Microsoft® Windows® 11
4: Copyright © 2002-2026 Karl Henrik Henriksson [qwilk/@xoblite]
5: Copyright © 2001-2004 The Blackbox for Windows Development Team
6: http://xoblite.net/ + https://github.com/xoblite/
7: ============================================================================
8:
9: Blackbox for Windows is free software, released under the
10: GNU General Public License (GPL version 2 or later), with an extension
11: that allows linking of proprietary modules under a controlled interface.
12: What this means is that plugins etc. are allowed to be released
13: under any license the author wishes. Please note, however, that the
14: original Blackbox gradient math code used in Blackbox for Windows
15: is available under the BSD license.
16:
17: http://www.fsf.org/licenses/gpl.html
18: http://www.fsf.org/licenses/gpl-faq.html#LinkingOverControlledInterface
19: http://www.xfree86.org/3.3.6/COPYRIGHT2.html#5
20:
21: This program is distributed in the hope that it will be useful,
22: but WITHOUT ANY WARRANTY; without even the implied warranty of
23: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24: GNU General Public License for more details.
25:
26: For additional license information, please read the included license.html.
27:
28: ============================================================================
29: */
30:
31: #ifndef __MENUCOMMON_H
32: #define __MENUCOMMON_H
33:
34: #include "..\API\BBApi.h"
35: #include "Menu.h"
36: #include "FolderItem.h"
37:
38: using namespace std;
39:
40: //===========================================================================
41:
42: class MenuCommon
43: {
44: public:
45:
46: MenuCommon();
47: ~MenuCommon();
48:
49: //====================
50:
51: void Initialize(HINSTANCE hInst);
52: void Configure();
53: void UpdateMainMenu(bool createAllMenus);
54:
55: void ParseFolder(FILE *file, Menu *pMenu);
56: bool ParseLine(FILE *file, Menu *pMenu, char *pszLine);
57:
58: void AddHeaderItem(Menu* pMenu, LPSTR pszTitle);
59: void AddFooterItem(Menu* pMenu, LPSTR pszTitle);
60:
61: void InsertFolder(Menu *pMenu, char* pszFolder, int menuType, bool includeSubFolders);
62:
63: // void Show(int index = 0);
64: bool Hide(int index = 0);
65:
66: //====================
67:
68: MenuItem* CreateMenuItem(Menu *pMenu, int itemType, char* pszCommand, char* pszArgument, char* pszTitle, bool isSelected);
69: MenuItem* CreateMenuItemUnicode(Menu* pMenu, int itemType, char* pszCommand, char* pszArgument, wchar_t* pszTitleUnicode, bool isSelected);
70:
71: //====================
72:
73: void Invoke(MenuItem* item, int button);
74: void HideAfterInvoke(MenuItem* item, int button);
75:
76: //====================
77:
78: void DrawMenuBullet(FolderItem* item, HDC hDC, int nTop, int type);
79: void DrawMenuIndicator(MenuItem* item, HDC hDC, int nTop);
80: int DrawMenuPinned(MenuItem* item, HDC hDC, RECT itemRect);
81:
82: //====================
83:
84: bool FindActiveAndDeactivate(Menu* m, bool repaint);
85: void FindAndSelect(MenuItem* item, LPSTR title, bool selected);
86: void ScrollToItem(Menu* m, MenuItem* item);
87:
88: //====================
89:
90: vector<Menu*> m_MenusVector;
91:
92: //====================
93:
94: HINSTANCE hInst;
95:
96: char m_szHotListName[256];
97:
98: DWORD m_nGradientTitle;
99: DWORD m_nGradientEntry;
100: DWORD m_nGradientSelEntry;
101:
102: int m_nTitleHeight;
103: bool m_nTitleDisabled;
104: int m_nSubmenuHeight;
105: int m_nMarginHeight;
106: int m_nSeparatorHeight;
107: int m_nGripHeight;
108: bool m_nGripDisabled;
109:
110: int m_nLeftIndent;
111: int m_nRightIndent;
112:
113: int m_nBulletSize;
114: int m_nBulletPosition;
115: int m_nBulletStyle;
116:
117: Menu* m_pMainMenu;
118: Menu* m_pStylesMenu;
119: Menu* m_pThemesMenu;
120: Menu* m_pWorkspacesMenu;
121: Menu* m_pConfigMenu;
122: Menu* m_pPluginMenu; // Note: Non-core menus created by plugins
123:
124: HFONT m_hTitleFont;
125: HFONT m_hFrameFont;
126: HFONT m_hGripFont;
127: HFONT m_hEditStringFont;
128:
129: MenuItem* currentStyleMenuItem;
130: int stylesMenusPinned;
131: };
132:
133: //===========================================================================
134:
135: #endif /* __MENUCOMMON_H */
136: