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 __BBTOOLBAR_H
32: #define __BBTOOLBAR_H
33:
34: #include "..\API\BBApi.h"
35: #include "..\Graphics\BImage.h"
36: #include "..\Settings\Settings.h"
37: #include "..\Menu\MenuCommon.h"
38: #include "..\Desktop\Desktop.h"
39: #include "Tooltips.h"
40:
41: #include <windows.h>
42: #include <string>
43: #include <shlwapi.h>
44: #include <time.h>
45: #include <shlobj.h>
46: #include <dwmapi.h>
47: #include <winuser.h>
48: #include <commctrl.h>
49: //#include <locale.h>
50:
51: using namespace std;
52:
53: #define TOOLBAR_UPDATE_TIMER 1
54: #define TOOLBAR_THROTTLE_UPDATES_TIMER 2
55: #define TOOLBAR_SAVE_WIDTH_TIMER 3
56:
57: #define TOOLBAR_BUTTON_GLYPH_DOWN 1
58: #define TOOLBAR_BUTTON_GLYPH_UP 2
59: #define TOOLBAR_BUTTON_GLYPH_LEFT 3
60: #define TOOLBAR_BUTTON_GLYPH_RIGHT 4
61:
62: //===========================================================================
63:
64: class Toolbar
65: {
66: public:
67: Toolbar(HINSTANCE hInstance);
68: ~Toolbar();
69:
70: friend LRESULT CALLBACK ToolbarWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
71:
72: void UpdateToolbarWindow();
73: void DrawWindowLabel(HDC hdc, RECT r, bool backgroundOnly);
74: void DrawButtonGlyph(HDC hdc, int glyph, int xcenter, int ycenter);
75:
76: bool GetClockText(bool forceUpdate);
77: void GetDimensions();
78: void GetPlacement();
79: void UpdateWidth();
80: void UpdatePosition();
81: // void UpdateDesktopArea();
82:
83: void MoveToMouse();
84: void ToggleOrientation();
85: void ToggleAlwaysOnTop();
86: void ToolbarModeButtonPressed(bool nextMode);
87: bool CheckIfMouseHover();
88:
89: void FullscreenDetected(bool fullscreen);
90:
91: void ToggleCalendar();
92: friend BOOL CALLBACK ToolbarCalendarWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
93:
94: //====================
95:
96: HINSTANCE hToolbarInstance;
97: HWND hBlackboxWnd; // Blackbox window handle
98: HWND hToolbarWnd; // Toolbar window handle
99:
100: HBITMAP tbBitmap;
101:
102: int ScreenWidth, ScreenHeight;
103: int ToolbarX, ToolbarY, ToolbarWidth, ToolbarHeight;
104: bool ButtonPressed1, ButtonPressed2, ButtonPressed3, ButtonPressed4;
105:
106: //====================
107:
108: int tbLabelX, tbLabelY, tbLabelW, tbLabelH;
109: int tbWinLabelX, tbWinLabelY, tbWinLabelW, tbWinLabelH;
110: int tbClockX, tbClockY, tbClockW, tbClockH;
111: RECT labelRect, winlabelRect, clockRect;
112:
113: int tbButtonX1, tbButtonX2, tbButtonX3, tbButtonX4, tbButtonY, tbButtonWH;
114: RECT button1Rect, button2Rect, button3Rect, button4Rect;
115:
116: //====================
117:
118: bool ToolbarPosInProgress;
119:
120: char ToolbarWorkspaceName[MAX_LINE_LENGTH];
121: wchar_t CurrentWindow[MAX_LINE_LENGTH];
122: wchar_t CurrentTime[MAX_LINE_LENGTH];
123: time_t systemTime;
124: struct tm localTime;
125: int currentMinute, displayedMinute;
126: int clockTimerCounter;
127:
128: char temp[MAX_LINE_LENGTH];
129:
130: bool saveWidthAfterDelay;
131: bool throttlingAddRemoveUpdates;
132: bool throttlingActivityUpdates;
133: bool updatesThrottled;
134: bool toolbarVerticalPeeking;
135:
136: RECT origDesktopArea;
137:
138: HDC cachedBackground;
139: HDC cachedToolbarButton;
140: HDC cachedToolbarButtonPressed;
141: bool cachedBitmapsExist;
142:
143: bool fullscreenDetected;
144:
145: HDC cachedToolbarWindowLabel;
146: RECT currentWindowLabelRect;
147: int currentWindowLabelWidth, currentWindowLabelHeight;
148:
149: HTHUMBNAIL thumbnail;
150:
151: HWND hToolbarCalendarWnd, hToolbarCalendarChildWnd;
152: };
153:
154: //===========================================================================
155:
156: #endif /* __BBTOOLBAR_H */
157: