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: #include "StylesMenu.h"
32: #include "..\Menu\MenuCommon.h"
33: #include "Settings.h"
34:
35: extern MenuCommon *pMenuCommon;
36: extern Settings *pSettings;
37:
38: //===========================================================================
39:
40: StylesMenu::StylesMenu(const char *pszTitle) : Menu(pMenuCommon->hInst)
41: {
42: m_pszTitle = pszTitle ? _strdup(pszTitle) : _strdup("");
43: pMenuCommon->stylesMenusPinned = 0; // No styles menus are pinned at startup...
44: SetMenuFolderPath(pSettings->stylesFolder);
45: }
46:
47: StylesMenu::~StylesMenu()
48: {
49: if (m_pszTitle) free(m_pszTitle);
50: m_pszTitle = NULL;
51: }
52:
53: //===========================================================================
54:
55: void StylesMenu::OnShow(bool fShow)
56: {
57: // To avoid hiding pinned menus due to auto-updating the styles menu,
58: // we only auto-update the styles menu tree if no styles menus are pinned...
59: // (which there will not be the first time the styles menu is opened)
60: if (fShow && (pMenuCommon->stylesMenusPinned == 0)) UpdateFolder();
61: }
62:
63: //===========================================================================
64:
65: void StylesMenu::UpdateFolder()
66: {
67: pMenuCommon->currentStyleMenuItem = NULL;
68:
69: DeleteMenuItems();
70:
71: pMenuCommon->AddHeaderItem(this, m_pszTitle);
72: pMenuCommon->InsertFolder(this, pSettings->stylesFolder, FOLDER_STYLES, true);
73: pMenuCommon->AddFooterItem(this, "");
74:
75: Invalidate();
76: Validate();
77: }
78:
79: //===========================================================================
80: