xoblite™ / Blackbox for Windows bb5 | RC6 preview | 0.25.2.14
http://xoblite.net/
Toolbar Class Reference

#include <Toolbar.h>

Public Member Functions

 Toolbar (HINSTANCE hInstance)
 
 ~Toolbar ()
 
void UpdateToolbarWindow ()
 
void DrawWindowLabel (HDC hdc, RECT r, bool backgroundOnly)
 
void DrawButtonGlyph (HDC hdc, int glyph, int xcenter, int ycenter)
 
bool GetClockText (bool forceUpdate)
 
void GetDimensions ()
 
void GetPlacement ()
 
void UpdatePosition ()
 
void MoveToMouse ()
 
void ToggleAlwaysOnTop ()
 
void ToolbarModeButtonPressed (bool nextMode)
 
bool CheckIfMouseHover ()
 

Public Attributes

HINSTANCE hToolbarInstance
 
HWND hBlackboxWnd
 
HWND hToolbarWnd
 
HBITMAP tbBitmap
 
int ScreenWidth
 
int ScreenHeight
 
int ToolbarX
 
int ToolbarY
 
int ToolbarWidth
 
int ToolbarHeight
 
bool ButtonPressed1
 
bool ButtonPressed2
 
bool ButtonPressed3
 
bool ButtonPressed4
 
int tbLabelX
 
int tbLabelY
 
int tbLabelW
 
int tbLabelH
 
int tbWinLabelX
 
int tbWinLabelY
 
int tbWinLabelW
 
int tbWinLabelH
 
int tbClockX
 
int tbClockY
 
int tbClockW
 
int tbClockH
 
RECT labelRect
 
RECT winlabelRect
 
RECT clockRect
 
int tbButtonX1
 
int tbButtonX2
 
int tbButtonX3
 
int tbButtonX4
 
int tbButtonY
 
int tbButtonWH
 
RECT button1Rect
 
RECT button2Rect
 
RECT button3Rect
 
RECT button4Rect
 
bool ToolbarPosInProgress
 
char ToolbarWorkspaceName [MAX_LINE_LENGTH]
 
wchar_t CurrentWindow [MAX_LINE_LENGTH]
 
wchar_t CurrentTime [MAX_LINE_LENGTH]
 
time_t systemTime
 
struct tm localTime
 
int currentMinute
 
int displayedMinute
 
int clockTimerCounter
 
char temp [MAX_LINE_LENGTH]
 
bool saveWidthAfterDelay
 
bool throttlingAddRemoveUpdates
 
bool throttlingActivityUpdates
 
bool updatesThrottled
 
bool toolbarVerticalPeeking
 
RECT origDesktopArea
 
HDC cachedBackground
 
HDC cachedToolbarButton
 
HDC cachedToolbarButtonPressed
 
bool cachedBitmapsExist
 
HDC cachedToolbarWindowLabel
 
RECT currentWindowLabelRect
 
int currentWindowLabelWidth
 
int currentWindowLabelHeight
 
HTHUMBNAIL thumbnail
 

Friends

LRESULT CALLBACK ToolbarWndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 

Constructor & Destructor Documentation

◆ Toolbar()

Toolbar::Toolbar ( HINSTANCE hInstance)
49{
50 WNDCLASS wc;
51 hToolbarInstance = hInstance;
53
54 cachedBackground = CreateCompatibleDC(NULL);
55 cachedToolbarButton = CreateCompatibleDC(NULL);
56 cachedToolbarButtonPressed = CreateCompatibleDC(NULL);
57 cachedBitmapsExist = false;
58
59 cachedToolbarWindowLabel = CreateCompatibleDC(NULL);
60 SetRectEmpty(&currentWindowLabelRect);
61
65 thumbnail = NULL;
66
67 CurrentWindow[0] = '\0';
69
70 // Save original DesktopArea...
71// SystemParametersInfo(SPI_GETWORKAREA, 0, (PVOID)&origDesktopArea, SPIF_SENDCHANGE);
72
73 //====================
74
75 GetClockText(true); // Note: Get the toolbar clock string first since it is used when calculating the initial window dimensions...
78
79 //====================
80
81 // Register our window class...
82 ZeroMemory(&wc,sizeof(wc));
83 wc.hInstance = hToolbarInstance;
84 wc.lpfnWndProc = ToolbarWndProc; // window procedure
85 wc.lpszClassName = szToolbarName; // window class name
86 wc.hbrBackground = NULL; // no class background brush
87 wc.style = CS_DBLCLKS; // class styles (e.g. to accept doubleclicks)
88 wc.hCursor = LoadCursor(NULL, IDC_ARROW); // always display the regular arrow cursor
89
90 if (!RegisterClass(&wc))
91 {
92 MessageBox(0, "Error registering toolbar window class!", szToolbarName, MB_OK | MB_ICONERROR | MB_TOPMOST);
93 Log("Toolbar: Error registering window class!", NULL);
94 return;
95 }
96
97 hToolbarWnd = CreateWindowEx(
98 WS_EX_TOOLWINDOW | WS_EX_ACCEPTFILES | WS_EX_LAYERED, // window style
99 szToolbarName, // window class
100 NULL, // window name
101 WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, // window parameters
102 ToolbarX, // x position
103 ToolbarY, // y position
104 ToolbarWidth, // window width
105 ToolbarHeight, // window height
106 NULL, // hBlackboxWnd, // owner window
107 NULL, // no menu
108 hToolbarInstance, // hInstance
109 NULL // no window creation data
110 );
111
112 if (!hToolbarWnd)
113 {
114 UnregisterClass(szToolbarName, hToolbarInstance);
115 MessageBox(0, "Error creating toolbar window!", szToolbarName, MB_OK | MB_ICONERROR | MB_TOPMOST);
116 Log("Toolbar: Error creating window!", NULL);
117 return;
118 }
119
120 //====================
121
122 // Subscribe to Blackbox messages applicable to the toolbar...
124
125 // Make the toolbar window sticky...
127 // Set toolbar window z-order position... (regular or always on top)
128// if (pSettings->toolbarOnTop) SetWindowPos(hToolbarWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE);
129 // Update the toolbar window...
130 ShowWindow(hToolbarWnd, pSettings->toolbarHidden ? SW_HIDE : SW_SHOWNOACTIVATE);
131 UpdatePosition(); // Note: This in turn also calls UpdateToolbarWindow() and sets the basic toolbar window z-order position... (regular or always on top)
132
133 // Finally, if not set to be always on top, we move the toolbar window to be placed just above the *box desktop in the z-order...
134 if (!pSettings->toolbarOnTop) SetWindowPos(hToolbarWnd, FindWindow("BBDesktop", NULL), 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOSENDCHANGING | SWP_NOOWNERZORDER);
135 else SetForegroundWindow(hToolbarWnd);
136
137 //====================
138
139 // Update DesktopArea (depending on blackbox.rc fullMaximization setting)...
140// UpdateDesktopArea();
141
142 // Set timer for the toolbar clock+windowLabel update checks... (every 250 msecs, but only updating the toolbar if any there have been any changes since the last check etc)
143 if (!SetTimer(hToolbarWnd, TOOLBAR_UPDATE_TIMER, 250, (TIMERPROC)NULL))
144 {
145 MessageBox(0, "Error setting toolbar update timer!", szToolbarName, MB_OK | MB_ICONERROR | MB_TOPMOST);
146 Log("Toolbar: Could not set update timer!", NULL);
147 return;
148 }
149
150 //====================
151
152 INITCOMMONCONTROLSEX ic;
153 ZeroMemory(&ic, sizeof(ic));
154 ic.dwSize = sizeof(INITCOMMONCONTROLSEX);
155 ic.dwICC = ICC_BAR_CLASSES;
156 InitCommonControlsEx(&ic);
157
158 //====================
159
160 // Initialize the tooltips subsystem for possible later use by the taskbar...
162}
void MakeSticky(HWND window)
Definition BBApi.cpp:2965
#define WS_EX_LAYERED
Definition BBApi.cpp:61
void Log(LPCSTR des, LPCSTR line)
Definition BBApi.cpp:638
Settings * pSettings
Definition Blackbox.cpp:46
HWND GetBBWnd()
Definition BBApi.cpp:128
#define BB_REGISTERMESSAGE
Definition BBApi.h:142
Tooltips * pTooltips
Definition Blackbox.cpp:49
int toolbarMessageSubscription[]
Definition Toolbar.cpp:44
const char szToolbarName[]
Definition Toolbar.cpp:33
#define TOOLBAR_UPDATE_TIMER
Definition Toolbar.h:51
bool toolbarHidden
Definition Settings.h:188
bool toolbarOnTop
Definition Settings.h:201
HDC cachedToolbarButtonPressed
Definition Toolbar.h:131
friend LRESULT CALLBACK ToolbarWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition Toolbar.cpp:197
bool ToolbarPosInProgress
Definition Toolbar.h:109
int clockTimerCounter
Definition Toolbar.h:117
void GetPlacement()
Definition Toolbar.cpp:1918
bool cachedBitmapsExist
Definition Toolbar.h:132
RECT currentWindowLabelRect
Definition Toolbar.h:135
bool throttlingActivityUpdates
Definition Toolbar.h:123
int ToolbarY
Definition Toolbar.h:94
HDC cachedToolbarWindowLabel
Definition Toolbar.h:134
int ToolbarWidth
Definition Toolbar.h:94
bool saveWidthAfterDelay
Definition Toolbar.h:121
bool updatesThrottled
Definition Toolbar.h:124
HTHUMBNAIL thumbnail
Definition Toolbar.h:138
HWND hToolbarWnd
Definition Toolbar.h:89
int ToolbarX
Definition Toolbar.h:94
bool GetClockText(bool forceUpdate)
Definition Toolbar.cpp:1526
bool ButtonPressed1
Definition Toolbar.h:95
HDC cachedBackground
Definition Toolbar.h:129
HDC cachedToolbarButton
Definition Toolbar.h:130
void GetDimensions()
Definition Toolbar.cpp:1550
bool toolbarVerticalPeeking
Definition Toolbar.h:125
bool ButtonPressed4
Definition Toolbar.h:95
wchar_t CurrentWindow[MAX_LINE_LENGTH]
Definition Toolbar.h:112
bool ButtonPressed2
Definition Toolbar.h:95
HINSTANCE hToolbarInstance
Definition Toolbar.h:87
HWND hBlackboxWnd
Definition Toolbar.h:88
bool throttlingAddRemoveUpdates
Definition Toolbar.h:122
int ToolbarHeight
Definition Toolbar.h:94
void UpdatePosition()
Definition Toolbar.cpp:1941
bool ButtonPressed3
Definition Toolbar.h:95
void Initialize(HINSTANCE hInstance, HWND hWnd)
Definition Tooltips.cpp:53

◆ ~Toolbar()

Toolbar::~Toolbar ( )
167{
168 // Kill timers...
171 {
173 WriteInt(pSettings->xobrcFile, "xoblite.toolbar.horizontal.width:", pSettings->toolbarHorizontalWidth);
174 }
175
176 // Restore original DesktopArea...
177// SystemParametersInfo(SPI_SETWORKAREA, 0, (PVOID)&origDesktopArea, SPIF_SENDCHANGE);
178
179 // Unsubscribe to previously subscribed Blackbox messages...
181
182 // Delete taskbar live preview thumbnail...
183 if (thumbnail != NULL) DwmUnregisterThumbnail(thumbnail);
184
185 DestroyWindow(hToolbarWnd); // Destroy toolbar window...
186 UnregisterClass(szToolbarName, hToolbarInstance); // Unregister toolbar window class...
187
188 // Delete cached bitmaps...
192 if (cachedBackground) DeleteDC(cachedBackground);
193}
void WriteInt(LPCSTR fp, LPCSTR keyword, int value)
Definition BBApi.cpp:3144
#define BB_UNREGISTERMESSAGE
Definition BBApi.h:143
#define TOOLBAR_SAVE_WIDTH_TIMER
Definition Toolbar.h:53
int toolbarHorizontalWidth
Definition Settings.h:192
bool toolbarVertical
Definition Settings.h:191
char xobrcFile[MAX_LINE_LENGTH]
Definition Settings.h:405

Member Function Documentation

◆ UpdateToolbarWindow()

void Toolbar::UpdateToolbarWindow ( )
884{
885 // Fetch the new size and position parameters for the toolbar window...
886// GetDimensions();
887
888// if (pSettings->debugLogging) SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INFORMATION_MESSAGE, (LPARAM)"Toolbar -> UpdateToolbarWindow()");
889
890 RECT r;
891 SetRect(&r, 0, 0, ToolbarWidth, ToolbarHeight);
892
893 HDC hdc = GetWindowDC(hToolbarWnd);
894 HBITMAP bufbmp = CreateCompatibleBitmap(hdc, r.right - r.left, r.bottom - r.top);
895 DeleteObject(SelectObject(cachedBackground, bufbmp));
896 ReleaseDC(hToolbarWnd, hdc);
897
898 //====================
899
900 // Draw toolbar background...
901 SetRect(&r, 0, 0, ToolbarWidth, ToolbarHeight);
904
906 {
908 }
909
910 //====================
911
912 // Should any toolbar corners be rounded off? If so, we need to perform some pixel re-shuffling
913 // *before* any subsequent per pixel alpha operations... (because these in turn affect pixel data)
914 int corners = 0;
916 {
918 {
919 case PLACEMENT_TOP_LEFT: { corners = CORNER_BOTTOMRIGHT; break; }
920 case PLACEMENT_CENTER_LEFT: { corners = CORNER_TOPRIGHT | CORNER_BOTTOMRIGHT; break; }
921 case PLACEMENT_BOTTOM_LEFT: { corners = CORNER_TOPRIGHT; break; }
922 case PLACEMENT_TOP_CENTER: { corners = CORNER_BOTTOMLEFT | CORNER_BOTTOMRIGHT; break; }
923 case PLACEMENT_BOTTOM_CENTER: { corners = CORNER_TOPLEFT | CORNER_TOPRIGHT; break; }
924 case PLACEMENT_TOP_RIGHT: { corners = CORNER_BOTTOMLEFT; break; }
925 case PLACEMENT_CENTER_RIGHT: { corners = CORNER_TOPLEFT | CORNER_BOTTOMLEFT; break; }
926 case PLACEMENT_BOTTOM_RIGHT: { corners = CORNER_TOPLEFT; break; }
927 default: { corners = CORNER_TOPLEFT | CORNER_TOPRIGHT | CORNER_BOTTOMLEFT | CORNER_BOTTOMRIGHT; break; }
928 }
929
931 }
932
933 //====================
934
936 {
937 // Paint workspace label background...
940 }
941
943 {
944 // Paint clock background...
947 }
948
949 //====================
950
951// HBITMAP tempBitmap, oldBitmap;
952
953/*
954 // If we have not yet created cached bitmaps, let's do that...
955 if (!cachedBitmapsExist)
956 {
957 HBITMAP tempBitmap, oldBitmap;
958
959 // Create a temporary bitmap...
960 tempBitmap = CreateCompatibleBitmap(hdc, ToolbarWidth, ToolbarHeight);
961 // Delete the previously cached gradient...
962 oldBitmap = (HBITMAP)SelectObject(cachedBackground, tempBitmap);
963 DeleteObject(oldBitmap);
964 // Paint background + border... (now using MakeGradient instead of CreateBorder + DrawGradient)
965 GetClientRect(hToolbarWnd, &r);
966 // MakeGradient(cachedBackground, r, pSettings->Toolbar->type, pSettings->Toolbar->Color, pSettings->Toolbar->ColorTo, pSettings->Toolbar->interlaced, pSettings->Toolbar->bevelstyle, pSettings->Toolbar->bevelposition, pSettings->bevelWidth, pSettings->Toolbar->borderColor, pSettings->Toolbar->borderWidth);
967 MakeGradientEx(cachedBackground, r, pSettings->Toolbar->type, pSettings->Toolbar->Color, pSettings->Toolbar->ColorTo, pSettings->Toolbar->Color3, pSettings->Toolbar->Color4, pSettings->Toolbar->interlaced, pSettings->Toolbar->bevelstyle, pSettings->Toolbar->bevelposition, pSettings->bevelWidth, pSettings->Toolbar->borderColor, pSettings->Toolbar->borderWidth);
968
969 //====================
970
971 if (!pSettings->ToolbarLabel->parentRelative && pSettings->numberOfWorkspaces > 1)
972 {
973 // Paint workspaces background...
974// MakeGradient(cachedBackground, labelRect, pSettings->ToolbarLabel->type, pSettings->ToolbarLabel->Color, pSettings->ToolbarLabel->ColorTo, pSettings->ToolbarLabel->interlaced, pSettings->ToolbarLabel->bevelstyle, pSettings->ToolbarLabel->bevelposition, pSettings->bevelWidth, pSettings->ToolbarLabel->borderColor, pSettings->ToolbarLabel->borderWidth);
975 MakeGradientEx(cachedBackground, labelRect, pSettings->ToolbarLabel->type, pSettings->ToolbarLabel->Color, pSettings->ToolbarLabel->ColorTo, pSettings->ToolbarLabel->Color3, pSettings->ToolbarLabel->Color4, pSettings->ToolbarLabel->interlaced, pSettings->ToolbarLabel->bevelstyle, pSettings->ToolbarLabel->bevelposition, pSettings->bevelWidth, pSettings->ToolbarLabel->borderColor, pSettings->ToolbarLabel->borderWidth);
976 }
977
978 //====================
979
980 if (!pSettings->ToolbarClock->parentRelative)
981 {
982 // Paint clock background...
983// MakeGradient(cachedBackground, clockRect, pSettings->ToolbarClock->type, pSettings->ToolbarClock->Color, pSettings->ToolbarClock->ColorTo, pSettings->ToolbarClock->interlaced, pSettings->ToolbarClock->bevelstyle, pSettings->ToolbarClock->bevelposition, pSettings->bevelWidth, pSettings->ToolbarClock->borderColor, pSettings->ToolbarClock->borderWidth);
984 MakeGradientEx(cachedBackground, clockRect, pSettings->ToolbarClock->type, pSettings->ToolbarClock->Color, pSettings->ToolbarClock->ColorTo, pSettings->ToolbarClock->Color3, pSettings->ToolbarClock->Color4, pSettings->ToolbarClock->interlaced, pSettings->ToolbarClock->bevelstyle, pSettings->ToolbarClock->bevelposition, pSettings->bevelWidth, pSettings->ToolbarClock->borderColor, pSettings->ToolbarClock->borderWidth);
985 }
986
987 //====================
988
989 // Clean up - delete the temporary bitmap...
990 DeleteObject(tempBitmap);
991*/
992 //====================
993/*
994 if (!pSettings->ToolbarButton->parentRelative)
995 {
996 // Create a temporary bitmap...
997 tempBitmap = CreateCompatibleBitmap(hdc, tbButtonWH, tbButtonWH);
998 // Delete the previously cached gradient...
999 oldBitmap = (HBITMAP)SelectObject(cachedToolbarButton, tempBitmap);
1000 DeleteObject(oldBitmap);
1001 // Paint button background...
1002 r.left = 0; r.top = 0; r.right = tbButtonWH; r.bottom = tbButtonWH;
1003 // MakeGradient(cachedToolbarButton, r, pSettings->ToolbarButton->type, pSettings->ToolbarButton->Color, pSettings->ToolbarButton->ColorTo, pSettings->ToolbarButton->interlaced, pSettings->ToolbarButton->bevelstyle, pSettings->ToolbarButton->bevelposition, pSettings->bevelWidth, pSettings->ToolbarButton->borderColor, pSettings->ToolbarButton->borderWidth);
1004 MakeGradientEx(cachedToolbarButton, r, pSettings->ToolbarButton->type, pSettings->ToolbarButton->Color, pSettings->ToolbarButton->ColorTo, pSettings->ToolbarButton->Color3, pSettings->ToolbarButton->Color4, pSettings->ToolbarButton->interlaced, pSettings->ToolbarButton->bevelstyle, pSettings->ToolbarButton->bevelposition, pSettings->bevelWidth, pSettings->ToolbarButton->borderColor, pSettings->ToolbarButton->borderWidth);
1005 // Clean up - delete the temporary bitmap...
1006 DeleteObject(tempBitmap);
1007 }
1008*/
1009 //====================
1010
1012 {
1013 // Paint unpressed workspace/task buttons...
1015 {
1016//// BitBlt(cachedBackground, button1Rect.left, button1Rect.top, tbButtonWH, tbButtonWH, cachedToolbarButton, 0, 0, SRCCOPY);
1017//// BitBlt(cachedBackground, button2Rect.left, button2Rect.top, tbButtonWH, tbButtonWH, cachedToolbarButton, 0, 0, SRCCOPY);
1018 if (!ButtonPressed1)
1019 {
1022 }
1023 if (!ButtonPressed2)
1024 {
1027 }
1028 }
1029
1031 {
1032//// BitBlt(cachedBackground, button3Rect.left, button3Rect.top, tbButtonWH, tbButtonWH, cachedToolbarButton, 0, 0, SRCCOPY);
1033//// BitBlt(cachedBackground, button4Rect.left, button4Rect.top, tbButtonWH, tbButtonWH, cachedToolbarButton, 0, 0, SRCCOPY);
1034 if (!ButtonPressed3)
1035 {
1038 }
1039 if (!ButtonPressed4)
1040 {
1043 }
1044 }
1045 }
1046
1047 //====================
1048/*
1049 // Set the "cached bitmaps created" indicator...
1050 cachedBitmapsExist = true;
1051 }
1052*/
1053 //====================
1054
1055 // Copy the cached bitmap into the temporary buffer...
1056// BitBlt(buf, ps.rcPaint.left, ps.rcPaint.top, updateRectWidth, updateRectHeight, cachedBackground, ps.rcPaint.left, ps.rcPaint.top, SRCCOPY);
1057
1058 //====================
1059
1060 // Paint windowlabel background+text or taskbar buttons?
1062 else DrawWindowLabel(cachedBackground, winlabelRect, false); // TOOLBAR_MODE_WINDOWLABEL
1063
1064 //====================
1065/*
1066 if (!pSettings->ToolbarButtonPressed->parentRelative && (ButtonPressed1 || ButtonPressed2 || ButtonPressed3 || ButtonPressed4))
1067 {
1068 // Paint pressed workspace/task buttons...
1069 // (not cached since they are not normally visible)
1070 HDC src = CreateCompatibleDC(NULL);
1071 HBITMAP srcbmp = CreateCompatibleBitmap(hdc, tbButtonWH, tbButtonWH);
1072 HBITMAP oldsrc = (HBITMAP)SelectObject(src, srcbmp);
1073
1074 r.left = 0; r.top = 0; r.right = tbButtonWH; r.bottom = tbButtonWH;
1075 // MakeGradient(src, r, pSettings->ToolbarButtonPressed->type, pSettings->ToolbarButtonPressed->Color, pSettings->ToolbarButtonPressed->ColorTo, pSettings->ToolbarButtonPressed->interlaced, pSettings->ToolbarButtonPressed->bevelstyle, pSettings->ToolbarButtonPressed->bevelposition, pSettings->bevelWidth, pSettings->ToolbarButtonPressed->borderColor, pSettings->ToolbarButtonPressed->borderWidth);
1076 MakeGradientEx(src, r, pSettings->ToolbarButtonPressed->type, pSettings->ToolbarButtonPressed->Color, pSettings->ToolbarButtonPressed->ColorTo, pSettings->ToolbarButtonPressed->Color3, pSettings->ToolbarButtonPressed->Color4, pSettings->ToolbarButtonPressed->interlaced, pSettings->ToolbarButtonPressed->bevelstyle, pSettings->ToolbarButtonPressed->bevelposition, pSettings->bevelWidth, pSettings->ToolbarButtonPressed->borderColor, pSettings->ToolbarButtonPressed->borderWidth);
1077
1078 if (!pSettings->toolbarDownUpButtonsHidden && (pSettings->numberOfWorkspaces > 1))
1079 {
1080 if (ButtonPressed1) BitBlt(cachedBackground, button1Rect.left, button1Rect.top, tbButtonWH, tbButtonWH, src, 0, 0, SRCCOPY);
1081 if (ButtonPressed2) BitBlt(cachedBackground, button2Rect.left, button2Rect.top, tbButtonWH, tbButtonWH, src, 0, 0, SRCCOPY);
1082 }
1083
1084 if (!pSettings->toolbarLeftRightButtonsHidden)
1085 {
1086 if (ButtonPressed3) BitBlt(cachedBackground, button3Rect.left, button3Rect.top, tbButtonWH, tbButtonWH, src, 0, 0, SRCCOPY);
1087 if (ButtonPressed4) BitBlt(cachedBackground, button4Rect.left, button4Rect.top, tbButtonWH, tbButtonWH, src, 0, 0, SRCCOPY);
1088 }
1089
1090 SelectObject(src, oldsrc);
1091 DeleteDC(src);
1092 DeleteObject(srcbmp);
1093 DeleteObject(oldsrc);
1094 }
1095*/
1097 {
1099 {
1100 if (ButtonPressed1)
1101 {
1104 }
1105 if (ButtonPressed2)
1106 {
1109 }
1110 }
1111
1113 {
1114 if (ButtonPressed3)
1115 {
1118 }
1119 if (ButtonPressed4)
1120 {
1123 }
1124 }
1125 }
1126
1127 //====================
1128
1129 unsigned int format;
1130 HFONT font;
1131 HGDIOBJ oldfont;
1132
1134 {
1135 // Draw workspace label...
1137 font = CreateFont(pSettings->ToolbarLabel->FontHeight, 0, 0, 0, pSettings->ToolbarLabel->FontWeight, false, false, false, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, pSettings->ToolbarLabel->Font);
1138 oldfont = SelectObject(cachedBackground, font);
1139 SetBkMode(cachedBackground, TRANSPARENT);
1140 format = pSettings->ToolbarLabel->Justify | DT_VCENTER | DT_NOPREFIX | DT_SINGLELINE | DT_WORD_ELLIPSIS;
1141 CopyRect(&r, &labelRect);
1142 r.left = r.left + pSettings->ToolbarLabel->marginWidth + 2;
1143 r.right = r.right - pSettings->ToolbarLabel->marginWidth - 2;
1144
1145 char ToolbarWorkspaceNameANSI[MAX_LINE_LENGTH];
1146 strcpy(ToolbarWorkspaceNameANSI, ToolbarWorkspaceName);
1147 strcat(ToolbarWorkspaceNameANSI, "\0"); // Just in case...
1148 wchar_t ToolbarWorkspaceNameUnicode[MAX_LINE_LENGTH];
1149 MultiByteToWideChar(CP_UTF8, 0, ToolbarWorkspaceNameANSI, strlen(ToolbarWorkspaceNameANSI)+1, ToolbarWorkspaceNameUnicode, MAX_LINE_LENGTH);
1150
1152
1153 DeleteObject(SelectObject(cachedBackground, oldfont));
1154 }
1155
1157 {
1158 // Draw clock...
1159 font = CreateFont(pSettings->ToolbarClock->FontHeight, 0, 0, 0, pSettings->ToolbarClock->FontWeight, false, false, false, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, pSettings->ToolbarClock->Font);
1160 oldfont = SelectObject(cachedBackground, font);
1161 SetBkMode(cachedBackground, TRANSPARENT);
1162 format = pSettings->ToolbarClock->Justify | DT_VCENTER | DT_NOPREFIX | DT_SINGLELINE | DT_WORD_ELLIPSIS;
1164 CopyRect(&r, &clockRect);
1165 r.left = r.left + pSettings->ToolbarClock->marginWidth + 2;
1166 r.right = r.right - pSettings->ToolbarClock->marginWidth - 2;
1167
1169
1170 DeleteObject(SelectObject(cachedBackground, oldfont));
1171 }
1172
1173 //====================
1174
1176 {
1177 // Draw arrows on workspace/task buttons (nb. there is limited gain from
1178 // caching these since the button itself can be parentrelative)...
1179 HPEN activePen, inactivePen, oldPen;
1180
1181 activePen = CreatePen(PS_SOLID, 1, pSettings->ToolbarButtonPressed->PicColor);
1182 inactivePen = CreatePen(PS_SOLID, 1, pSettings->ToolbarButton->PicColor);
1183
1184 oldPen = (HPEN)SelectObject(cachedBackground, inactivePen);
1185
1186 int xcenter;
1187 int xoffset = tbButtonWH / 2;
1188 int ycenter = button1Rect.top + tbButtonWH / 2;
1189
1191 {
1192 xcenter = button1Rect.left + xoffset;
1193 if (ButtonPressed1) SelectObject(cachedBackground, activePen);
1195 if (ButtonPressed1) SelectObject(cachedBackground, inactivePen);
1196
1197 xcenter = button2Rect.left + xoffset;
1198 if (ButtonPressed2) SelectObject(cachedBackground, activePen);
1200 if (ButtonPressed2) SelectObject(cachedBackground, inactivePen);
1201 }
1202
1204 {
1205 xcenter = button3Rect.left + xoffset;
1206 if (ButtonPressed3) SelectObject(cachedBackground, activePen);
1208 if (ButtonPressed3) SelectObject(cachedBackground, inactivePen);
1209
1210 xcenter = button4Rect.left + xoffset;
1211 if (ButtonPressed4) SelectObject(cachedBackground, activePen);
1213 if (ButtonPressed4) SelectObject(cachedBackground, inactivePen);
1214 }
1215
1216 SelectObject(cachedBackground, oldPen);
1217 DeleteObject(inactivePen);
1218 DeleteObject(activePen);
1219 }
1220
1221 //====================
1222
1223 // Apply per pixel alpha, selectively per toolbar element... 8)
1224 SetRect(&r, 0, 0, ToolbarWidth, ToolbarHeight);
1226
1228 {
1230
1232 {
1235 }
1236 }
1237
1238 if (pSettings->taskbarMode == TASKBAR_MODE_HIDDEN) // -> Taskbar hidden, showing WindowLabel
1239 {
1241 }
1242
1244
1246 {
1249 }
1250
1252
1254 {
1255 int corners = 0;
1257 {
1258 case PLACEMENT_TOP_LEFT: { corners = CORNER_BOTTOMRIGHT; break; }
1259 case PLACEMENT_CENTER_LEFT: { corners = CORNER_TOPRIGHT | CORNER_BOTTOMRIGHT; break; }
1260 case PLACEMENT_BOTTOM_LEFT: { corners = CORNER_TOPRIGHT; break; }
1261 case PLACEMENT_TOP_CENTER: { corners = CORNER_BOTTOMLEFT | CORNER_BOTTOMRIGHT; break; }
1262 case PLACEMENT_BOTTOM_CENTER: { corners = CORNER_TOPLEFT | CORNER_TOPRIGHT; break; }
1263 case PLACEMENT_TOP_RIGHT: { corners = CORNER_BOTTOMLEFT; break; }
1264 case PLACEMENT_CENTER_RIGHT: { corners = CORNER_TOPLEFT | CORNER_BOTTOMLEFT; break; }
1265 case PLACEMENT_BOTTOM_RIGHT: { corners = CORNER_TOPLEFT; break; }
1266 default: { corners = CORNER_TOPLEFT | CORNER_TOPRIGHT | CORNER_BOTTOMLEFT | CORNER_BOTTOMRIGHT; break; }
1267 }
1268
1269 // Apply rounded corners to the toolbar itself...
1271
1272 // Apply rounded "outer" corners (i.e. left/right corners respectively if horizontally oriented,
1273 // top/bottom corners respectively if vertically oriented) also to the toolbar label+clock if they are parentRelative...
1275 {
1278 }
1279 else
1280 {
1283 }
1284 }
1285
1287
1288 //====================
1289
1290 if (bufbmp) DeleteObject(bufbmp);
1291
1292 POINT pt;
1293 pt.x = ToolbarX, pt.y = ToolbarY;
1294 POINT ptSrc;
1295 ptSrc.x = 0, ptSrc.y = 0;
1296
1297 BLENDFUNCTION bf;
1298 bf.BlendOp = AC_SRC_OVER;
1299 bf.BlendFlags = 0;
1300 bf.AlphaFormat = AC_SRC_ALPHA;
1301 bf.SourceConstantAlpha = (unsigned char)255;
1302
1303 SIZE windowSize = { ToolbarWidth, ToolbarHeight };
1304 BOOL result = UpdateLayeredWindow(hToolbarWnd, NULL, &pt, &windowSize, cachedBackground, &ptSrc, 0, &bf, ULW_ALPHA);
1305/*
1306 if (!cachedBackground) SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INFORMATION_MESSAGE, (LPARAM)"xoblite -> Toolbar -> Invalid cachedBackground!");
1307
1308 if (result == 0)
1309 {
1310 int error = GetLastError();
1311 char msg[255];
1312 sprintf(msg, "xoblite -> Toolbar -> UpdateLayeredWindow failed! [error code %d]", error);
1313 SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_ERROR_MESSAGE, (LPARAM)msg);
1314 }
1315*/
1316}
void DrawImageIntoRect(HDC hdc, RECT r, StyleItem *styleItem, bool useAlpha, bool drawBorder)
Definition BBApi.cpp:2333
void AlphaApply(HDC hdc, RECT rect)
Definition BBApi.cpp:2449
void AlphaCorner(HDC hdc, RECT rect, int corner, int bevelStyle, int bevelPosition, int bevelWidth, int borderWidth, unsigned char minAlpha, unsigned char maxAlpha)
Definition BBApi.cpp:2431
void MakeGradientSuper(HDC hdc, RECT rect, int type, COLORREF color1, COLORREF color2, COLORREF color3, COLORREF color4, COLORREF color5, COLORREF color6, COLORREF color7, COLORREF color8, bool bInterlaced, int bevelStyle, int bevelPosition, int bevelWidth, COLORREF borderColour, int borderWidth)
Definition BBApi.cpp:2127
Workspaces * pWorkspaces
Definition Blackbox.cpp:51
Taskbar * pTaskbar
Definition Blackbox.cpp:47
void DrawTextWithEffectsUnicode(HDC hdc, RECT r, LPWSTR text, unsigned int format, COLORREF textColor, bool outline, COLORREF outlineColor, bool shadow, COLORREF shadowColor, int shadowX, int shadowY)
Definition BBApi.cpp:3528
void PrepareCorner(HDC hdc, RECT rect, int corner, int bevelStyle, int bevelPosition, int bevelWidth, int borderWidth)
Definition BBApi.cpp:2462
void AlphaRect(HDC hdc, RECT rect, unsigned char alpha)
Definition BBApi.cpp:2419
void CreateBorderSuper(HDC hdc, RECT rect, int type, COLORREF color1, COLORREF color2, COLORREF color3, COLORREF color4, COLORREF color5, COLORREF color6, COLORREF color7, COLORREF color8, int borderWidth)
Definition BBApi.cpp:2250
#define CORNER_BOTTOMRIGHT
Definition BBApi.h:128
#define CORNER_BOTTOMLEFT
Definition BBApi.h:127
#define CORNER_TOPLEFT
Definition BBApi.h:125
#define B_IMAGEFROMFILE
Definition BBApi.h:83
#define CORNER_TOPRIGHT
Definition BBApi.h:126
#define MAX_LINE_LENGTH
Definition BBApi.h:64
#define PLACEMENT_CENTER_LEFT
Definition Settings.h:71
#define PLACEMENT_TOP_CENTER
Definition Settings.h:69
#define PLACEMENT_BOTTOM_CENTER
Definition Settings.h:75
#define PLACEMENT_BOTTOM_LEFT
Definition Settings.h:74
#define TASKBAR_MODE_HIDDEN
Definition Settings.h:42
#define PLACEMENT_TOP_LEFT
Definition Settings.h:68
#define PLACEMENT_TOP_RIGHT
Definition Settings.h:70
#define PLACEMENT_BOTTOM_RIGHT
Definition Settings.h:76
#define PLACEMENT_CENTER_RIGHT
Definition Settings.h:73
#define TOOLBAR_BUTTON_GLYPH_DOWN
Definition Toolbar.h:55
#define TOOLBAR_BUTTON_GLYPH_LEFT
Definition Toolbar.h:57
#define TOOLBAR_BUTTON_GLYPH_RIGHT
Definition Toolbar.h:58
#define TOOLBAR_BUTTON_GLYPH_UP
Definition Toolbar.h:56
BYTE toolbarWindowLabelTransparencyAlpha
Definition Settings.h:197
int currentWorkspace
Definition Settings.h:372
BYTE taskbarActiveTransparencyAlpha
Definition Settings.h:224
BYTE toolbarButtonTransparencyAlpha
Definition Settings.h:199
bool toolbarLabelHidden
Definition Settings.h:204
StyleItem * ToolbarBorder
Definition Settings.h:430
BYTE toolbarLabelTransparencyAlpha
Definition Settings.h:196
StyleItem * ToolbarButtonPressed
Definition Settings.h:429
BYTE toolbarTransparencyAlpha
Definition Settings.h:195
StyleItem * ToolbarClock
Definition Settings.h:427
StyleItem * ToolbarButton
Definition Settings.h:428
bool toolbarDownUpButtonsHidden
Definition Settings.h:205
Placement ToolbarPlacement
Definition Settings.h:189
bool toolbarLeftRightButtonsHidden
Definition Settings.h:206
int bevelWidth
Definition Settings.h:564
StyleItem * ToolbarLabel
Definition Settings.h:425
bool toolbarClockHidden
Definition Settings.h:207
int numberOfWorkspaces
Definition Settings.h:306
int taskbarMode
Definition Settings.h:215
StyleItem * Toolbar
Definition Settings.h:424
BYTE toolbarClockTransparencyAlpha
Definition Settings.h:198
bool toolbarRoundedCorners
Definition Settings.h:200
void DrawTaskbar(HDC hdc, int iconPos, RECT taskbarRect)
Definition Taskbar.cpp:1009
RECT ActiveTaskRect
Definition Taskbar.h:129
bool activeTaskAvailable
Definition Taskbar.h:128
RECT labelRect
Definition Toolbar.h:102
int tbButtonWH
Definition Toolbar.h:104
RECT clockRect
Definition Toolbar.h:102
RECT button2Rect
Definition Toolbar.h:105
void DrawWindowLabel(HDC hdc, RECT r, bool backgroundOnly)
Definition Toolbar.cpp:1320
wchar_t CurrentTime[MAX_LINE_LENGTH]
Definition Toolbar.h:113
void DrawButtonGlyph(HDC hdc, int glyph, int xcenter, int ycenter)
Definition Toolbar.cpp:1400
char ToolbarWorkspaceName[MAX_LINE_LENGTH]
Definition Toolbar.h:111
RECT button3Rect
Definition Toolbar.h:105
RECT button1Rect
Definition Toolbar.h:105
RECT winlabelRect
Definition Toolbar.h:102
RECT button4Rect
Definition Toolbar.h:105
WorkspaceNamesVector workspaceNames
Definition Workspaces.h:77
int placement
Definition Settings.h:89
int borderWidth
Definition BBApi.h:417
COLORREF Color5
Definition BBApi.h:436
int bevelstyle
Definition BBApi.h:400
COLORREF Color4
Definition BBApi.h:434
bool parentRelative
Definition BBApi.h:403
COLORREF TextColor
Definition BBApi.h:408
bool FontOutline
Definition BBApi.h:430
COLORREF Color6
Definition BBApi.h:437
int type
Definition BBApi.h:402
char ShadowX
Definition BBApi.h:426
int bevelposition
Definition BBApi.h:401
COLORREF Color7
Definition BBApi.h:438
char ShadowY
Definition BBApi.h:426
COLORREF Color8
Definition BBApi.h:439
int Justify
Definition BBApi.h:411
COLORREF OutlineColor
Definition BBApi.h:431
bool FontShadow
Definition BBApi.h:423
bool interlaced
Definition BBApi.h:404
COLORREF ShadowColor
Definition BBApi.h:429
int FontWeight
Definition BBApi.h:410
COLORREF Color3
Definition BBApi.h:433
COLORREF borderColor
Definition BBApi.h:418
int marginWidth
Definition BBApi.h:416
int FontHeight
Definition BBApi.h:409
char Font[128]
Definition BBApi.h:413

◆ DrawWindowLabel()

void Toolbar::DrawWindowLabel ( HDC hdc,
RECT r,
bool backgroundOnly )
1321{
1322 // Delete any existing taskbar tooltips... (just in case)
1324
1325 //====================
1326
1327 RECT wlRect, wlTextRect;
1328 CopyRect(&wlRect, &r);
1329// if (pSettings->toolbarVertical && (pSettings->taskbarMode == TASKBAR_MODE_HIDDEN)) wlRect.bottom -= pSettings->Toolbar->marginWidth;
1330 CopyRect(&wlTextRect, &wlRect);
1331
1332 //====================
1333
1334 // Has the windowLabel bounding rect changed since we last
1335 // cached it? If so, let's create a new cached bitmap...
1336 if (!EqualRect(&currentWindowLabelRect, &wlRect))
1337 {
1338 CopyRect(&currentWindowLabelRect, &wlRect);
1339 currentWindowLabelWidth = wlRect.right - wlRect.left;
1340 currentWindowLabelHeight = wlRect.bottom - wlRect.top;
1341
1343 {
1344 // Create a temporary bitmap...
1345 HBITMAP tempBitmap = CreateCompatibleBitmap(hdc, currentWindowLabelWidth, currentWindowLabelHeight);
1346 // Delete the previously cached gradient...
1347 HBITMAP oldBitmap = (HBITMAP)SelectObject(cachedToolbarWindowLabel, tempBitmap);
1348 DeleteObject(oldBitmap);
1349 // Paint the windowLabel background...
1350 r.left = 0; r.top = 0; r.right = currentWindowLabelWidth; r.bottom = currentWindowLabelHeight;
1353 // Clean up - delete the temporary bitmap...
1354 DeleteObject(tempBitmap);
1355 }
1356 }
1357
1358 //====================
1359
1361 {
1362 // Copy the cached bitmap into the temporary buffer...
1363 BitBlt(hdc, wlRect.left, wlRect.top, currentWindowLabelWidth, currentWindowLabelHeight, cachedToolbarWindowLabel, 0, 0, SRCCOPY);
1364
1365 // Below: Simple placeholder hack to allow image alpha for the otherwise pre-cached ToolbarWindowLabel too...
1366// if (pSettings->ToolbarWindowLabel->type == B_IMAGEFROMFILE) DrawImageIntoRect(hdc, wlRect, pSettings->ToolbarWindowLabel, false, true);
1367// else BitBlt(hdc, wlRect.left, wlRect.top, currentWindowLabelWidth, currentWindowLabelHeight, cachedToolbarWindowLabel, 0, 0, SRCCOPY);
1368 }
1369
1370 //====================
1371
1372 if (!backgroundOnly)
1373 {
1374 // Draw window label...
1375
1376 HFONT font = CreateFont(pSettings->ToolbarWindowLabel->FontHeight, 0, 0, 0, pSettings->ToolbarWindowLabel->FontWeight, false, false, false, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH|FF_DONTCARE, pSettings->ToolbarWindowLabel->Font);
1377 HGDIOBJ oldfont = SelectObject(hdc, font);
1378 SetBkMode(hdc, TRANSPARENT);
1379
1380// wlTextRect.left = wlTextRect.left + 3;
1381// wlTextRect.right = wlTextRect.right - 3;
1382 // Using the same padding as for the taskbar... (-> looks better, unified look =] )
1383 int windowLabelHeight = wlTextRect.bottom - wlTextRect.top;
1384 int iconSize = 11;
1385 if (windowLabelHeight > 20) iconSize = 16;
1386 int padding = ((windowLabelHeight - iconSize) / 2);
1387 InflateRect(&wlTextRect, -padding, 0);
1388
1389 unsigned int format = pSettings->ToolbarWindowLabel->Justify | DT_VCENTER | DT_NOPREFIX | DT_SINGLELINE | DT_WORD_ELLIPSIS;
1390
1393
1394 DeleteObject(SelectObject(hdc, oldfont));
1395 }
1396}
void DrawTextWithEffects(HDC hdc, RECT r, LPSTR text, unsigned int format, COLORREF textColor, bool outline, COLORREF outlineColor, bool shadow, COLORREF shadowColor, int shadowX, int shadowY)
Definition BBApi.cpp:3519
StyleItem * ToolbarWindowLabel
Definition Settings.h:426
bool taskbarTooltips
Definition Settings.h:227
int currentWindowLabelHeight
Definition Toolbar.h:136
int currentWindowLabelWidth
Definition Toolbar.h:136
void DeleteAllTooltips()
Definition Tooltips.cpp:190

◆ DrawButtonGlyph()

void Toolbar::DrawButtonGlyph ( HDC hdc,
int glyph,
int xcenter,
int ycenter )
1401{
1402 switch (glyph)
1403 {
1405 {
1407 {
1408 MoveToEx(hdc, xcenter, ycenter+2, NULL);
1409 LineTo(hdc, xcenter+1, ycenter+2);
1410 MoveToEx(hdc, xcenter-1, ycenter+1, NULL);
1411 LineTo(hdc, xcenter+2, ycenter+1);
1412 MoveToEx(hdc, xcenter-2, ycenter, NULL);
1413 LineTo(hdc, xcenter+3, ycenter);
1414 MoveToEx(hdc, xcenter-3, ycenter-1, NULL);
1415 LineTo(hdc, xcenter+4, ycenter-1);
1416 MoveToEx(hdc, xcenter-4, ycenter-2, NULL);
1417 LineTo(hdc, xcenter+5, ycenter-2);
1418 }
1419 else
1420 {
1421 MoveToEx(hdc, xcenter, ycenter+1, NULL);
1422 LineTo(hdc, xcenter+1, ycenter+1);
1423 MoveToEx(hdc, xcenter-1, ycenter, NULL);
1424 LineTo(hdc, xcenter+2, ycenter);
1425 MoveToEx(hdc, xcenter-2, ycenter-1, NULL);
1426 LineTo(hdc, xcenter+3, ycenter-1);
1427 }
1428
1429 return;
1430 }
1431
1432 //====================
1433
1435 {
1437 {
1438 MoveToEx(hdc, xcenter, ycenter-2, NULL);
1439 LineTo(hdc, xcenter+1, ycenter-2);
1440 MoveToEx(hdc, xcenter-1, ycenter-1, NULL);
1441 LineTo(hdc, xcenter+2, ycenter-1);
1442 MoveToEx(hdc, xcenter-2, ycenter, NULL);
1443 LineTo(hdc, xcenter+3, ycenter);
1444 MoveToEx(hdc, xcenter-3, ycenter+1, NULL);
1445 LineTo(hdc, xcenter+4, ycenter+1);
1446 MoveToEx(hdc, xcenter-4, ycenter+2, NULL);
1447 LineTo(hdc, xcenter+5, ycenter+2);
1448 }
1449 else
1450 {
1451 MoveToEx(hdc, xcenter, ycenter-1, NULL);
1452 LineTo(hdc, xcenter+1, ycenter-1);
1453 MoveToEx(hdc, xcenter-1, ycenter, NULL);
1454 LineTo(hdc, xcenter+2, ycenter);
1455 MoveToEx(hdc, xcenter-2, ycenter+1, NULL);
1456 LineTo(hdc, xcenter+3, ycenter+1);
1457 }
1458
1459 return;
1460 }
1461
1462 //====================
1463
1465 {
1467 {
1468 MoveToEx(hdc, xcenter-2, ycenter, NULL);
1469 LineTo(hdc, xcenter-2, ycenter+1);
1470 MoveToEx(hdc, xcenter-1, ycenter-1, NULL);
1471 LineTo(hdc, xcenter-1, ycenter+2);
1472 MoveToEx(hdc, xcenter, ycenter-2, NULL);
1473 LineTo(hdc, xcenter, ycenter+3);
1474 MoveToEx(hdc, xcenter+1, ycenter-3, NULL);
1475 LineTo(hdc, xcenter+1, ycenter+4);
1476 MoveToEx(hdc, xcenter+2, ycenter-4, NULL);
1477 LineTo(hdc, xcenter+2, ycenter+5);
1478 }
1479 else
1480 {
1481 MoveToEx(hdc, xcenter-1, ycenter, NULL);
1482 LineTo(hdc, xcenter-1, ycenter+1);
1483 MoveToEx(hdc, xcenter, ycenter-1, NULL);
1484 LineTo(hdc, xcenter, ycenter+2);
1485 MoveToEx(hdc, xcenter+1, ycenter-2, NULL);
1486 LineTo(hdc, xcenter+1, ycenter+3);
1487 }
1488
1489 return;
1490 }
1491
1492 //====================
1493
1495 {
1497 {
1498 MoveToEx(hdc, xcenter-2, ycenter-4, NULL);
1499 LineTo(hdc, xcenter-2, ycenter+5);
1500 MoveToEx(hdc, xcenter-1, ycenter-3, NULL);
1501 LineTo(hdc, xcenter-1, ycenter+4);
1502 MoveToEx(hdc, xcenter, ycenter-2, NULL);
1503 LineTo(hdc, xcenter, ycenter+3);
1504 MoveToEx(hdc, xcenter+1, ycenter-1, NULL);
1505 LineTo(hdc, xcenter+1, ycenter+2);
1506 MoveToEx(hdc, xcenter+2, ycenter, NULL);
1507 LineTo(hdc, xcenter+2, ycenter+1);
1508 }
1509 else
1510 {
1511 MoveToEx(hdc, xcenter-1, ycenter-2, NULL);
1512 LineTo(hdc, xcenter-1, ycenter+3);
1513 MoveToEx(hdc, xcenter, ycenter-1, NULL);
1514 LineTo(hdc, xcenter, ycenter+2);
1515 MoveToEx(hdc, xcenter+1, ycenter, NULL);
1516 LineTo(hdc, xcenter+1, ycenter+1);
1517 }
1518
1519 return;
1520 }
1521 }
1522}
bool doubleScaleHiDPI
Definition Settings.h:326

◆ GetClockText()

bool Toolbar::GetClockText ( bool forceUpdate)
1527{
1528 time(&systemTime);
1529 localtime_s(&localTime, &systemTime);
1530 currentMinute = localTime.tm_min;
1531
1532 // Only update the toolbar clock if the current minute has changed...
1533 if ((currentMinute != displayedMinute) || forceUpdate)
1534 {
1535 // Format the toolbar clock string based on the related xoblite.rc setting... (nb. we need to convert the format string from ANSI to Unicode first)
1536 wchar_t toolbarClockFormatInUnicode[MAX_LINE_LENGTH];
1537 MultiByteToWideChar(CP_UTF8, 0, pSettings->toolbarClockFormat, strlen(pSettings->toolbarClockFormat)+1, toolbarClockFormatInUnicode, MAX_LINE_LENGTH);
1538 wcsftime(CurrentTime, sizeof(CurrentTime), toolbarClockFormatInUnicode, &localTime);
1539
1540 // Remember minute shown in display, now wait until minute changes before updating again...
1542
1543 return true;
1544 }
1545 else return false;
1546}
char toolbarClockFormat[MAX_LINE_LENGTH]
Definition Settings.h:202
struct tm localTime
Definition Toolbar.h:115
int displayedMinute
Definition Toolbar.h:116
int currentMinute
Definition Toolbar.h:116
time_t systemTime
Definition Toolbar.h:114

◆ GetDimensions()

void Toolbar::GetDimensions ( )
1551{
1552// ScreenWidth = GetSystemMetrics(SM_CXSCREEN);
1553// ScreenHeight = GetSystemMetrics(SM_CYSCREEN);
1554
1555 int ScreenLeft, ScreenTop;
1556
1558 {
1559 RECT workArea;
1560 SystemParametersInfo(SPI_GETWORKAREA, 0, (PVOID)&workArea, SPIF_SENDCHANGE);
1561 ScreenLeft = workArea.left;
1562 ScreenTop = workArea.top;
1563 ScreenWidth = workArea.right - workArea.left;
1564 ScreenHeight = workArea.bottom - workArea.top;
1565 }
1566 else
1567 {
1568 ScreenLeft = GetSystemMetrics(SM_XVIRTUALSCREEN);
1569 ScreenTop = GetSystemMetrics(SM_YVIRTUALSCREEN);
1570 ScreenWidth = GetSystemMetrics(SM_CXVIRTUALSCREEN);
1571 ScreenHeight = GetSystemMetrics(SM_CYVIRTUALSCREEN);
1572 }
1573
1574 //====================
1575
1576 // Calculate element heights...
1577
1578 int toolbarMarginPlusBorder = pSettings->Toolbar->marginWidth + pSettings->Toolbar->borderWidth;
1579
1583
1584 int glyphSize = 7;
1585 if (pSettings->doubleScaleHiDPI) glyphSize += 4;
1587 tbButtonWH = tbButtonWH | 1; // Force odd sized buttons for glyphs to be centered...
1588
1589 int maxHeight = 15; // Minimum height 15 pixels
1590 if (tbLabelH > maxHeight) maxHeight = tbLabelH;
1591 if (tbWinLabelH > maxHeight) maxHeight = tbWinLabelH;
1592 if (tbClockH > maxHeight) maxHeight = tbClockH;
1593 if (tbButtonWH > maxHeight) maxHeight = tbButtonWH;
1594 maxHeight = maxHeight | 1; // Force odd size for buttons/glyphs to be centered...
1595
1596 tbLabelH = tbWinLabelH = tbClockH = maxHeight;
1597
1598 int extraButtonPadding = (maxHeight - tbButtonWH) / 2;
1599
1600 //====================
1601
1602 // Calculate the toolbar workspace label and clock widths...
1603
1604 SIZE size;
1605 HDC fonthdc = CreateDC("DISPLAY", NULL, NULL, NULL);
1606
1607 // Get the width of the toolbar workspace label...
1608 HFONT tempfont = CreateFont(pSettings->ToolbarLabel->FontHeight, 0, 0, 0, pSettings->ToolbarLabel->FontWeight, false, false, false, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH|FF_DONTCARE, pSettings->ToolbarLabel->Font);
1609 HGDIOBJ oldtempfont = SelectObject(fonthdc, tempfont);
1611 GetTextExtentPoint32(fonthdc, ToolbarWorkspaceName, strlen(ToolbarWorkspaceName), &size);
1612// tbLabelW = size.cx + 6 + (2 * pSettings->ToolbarLabel->marginWidth) + (2 * pSettings->ToolbarLabel->borderWidth);
1614
1615 // Get the width of the toolbar clock...
1616 DeleteObject(SelectObject(fonthdc, oldtempfont));
1617 tempfont = CreateFont(pSettings->ToolbarClock->FontHeight, 0, 0, 0, pSettings->ToolbarClock->FontWeight, false, false, false, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH|FF_DONTCARE, pSettings->ToolbarClock->Font);
1618 oldtempfont = SelectObject(fonthdc, tempfont);
1619 GetTextExtentPoint32W(fonthdc, CurrentTime, wcslen(CurrentTime), &size);
1620// tbClockW = size.cx + 6 + (2 * pSettings->ToolbarClock->marginWidth) + (2 * pSettings->ToolbarClock->borderWidth);
1622
1624 {
1625 // Both the workspace label and the clock are hidden...
1627 }
1629 {
1630 // Only the workspace label is hidden...
1631 tbLabelW = tbLabelH = 0;
1632 }
1633 else if (pSettings->toolbarClockHidden)
1634 {
1635 // Only the toolbar clock is hidden...
1636 tbClockW = tbClockH = 0;
1637 }
1639 {
1640 // Both the workspace label and the clock are visible, so unless we're using horizontal orientation
1641 // *and* asymmetry between the two is configured allowed, the widest of the two sets the width...
1643 else tbClockW = tbLabelW;
1644 }
1645
1646 DeleteObject(SelectObject(fonthdc, oldtempfont));
1647 DeleteDC(fonthdc);
1648
1649 //====================
1650
1651 // Get number of taskbar buttons to draw... (nb. this also honours any configured maximum number of taskbar items)
1653
1654 //====================
1655
1656 // ##### Horizontal toolbar orientation (default) #####
1657
1659 {
1660 // If the toolbar width is configured as <= 100 this defines its width as a percentage of the screen width,
1661 // and if configured as > 100 this defines its width in number of pixels...
1663 {
1665 }
1667
1668 //====================
1669
1670 // The toolbar height must be a minimum 17 pixels for the taskbar buttons to
1671 // look decent, so if it is not we need to adjust the element heights accordingly...
1672
1673 ToolbarHeight = maxHeight + (2 * toolbarMarginPlusBorder);
1674
1675 if (ToolbarHeight < 17)
1676 {
1677 int diffHeight = 17 - ToolbarHeight;
1678 ToolbarHeight = 17;
1679 maxHeight += diffHeight;
1680 extraButtonPadding = (maxHeight - tbButtonWH) / 2;
1681 tbLabelH = tbWinLabelH = tbClockH = maxHeight;
1682 tbLabelW = tbClockW += (2*diffHeight);
1683
1685 }
1686
1687 //====================
1688
1689 // Adaptively calculate each toolbar element's position depending on the visibility of the other toolbar elements...
1690
1691 int offsetLeftX = toolbarMarginPlusBorder;
1692 int offsetRightX = ToolbarWidth - toolbarMarginPlusBorder;
1693 int offsetY = toolbarMarginPlusBorder;
1694
1696 {
1697 tbLabelX = offsetLeftX;
1698 tbLabelY = offsetY;
1699 offsetLeftX += (tbLabelW + pSettings->Toolbar->marginWidth);
1700 }
1701
1703 {
1704 tbButtonX1 = offsetLeftX + extraButtonPadding;
1705 tbButtonX2 = tbButtonX1 + tbButtonWH + extraButtonPadding + pSettings->Toolbar->marginWidth;
1706 offsetLeftX += ((2*tbButtonWH) + (3*extraButtonPadding) + (2*pSettings->Toolbar->marginWidth));
1707 }
1708
1710 {
1711 tbClockX = offsetRightX - tbClockW;
1712 tbClockY = offsetY;
1713 offsetRightX -= (tbClockW + pSettings->Toolbar->marginWidth);
1714 }
1715
1717 {
1718 tbButtonX4 = offsetRightX - extraButtonPadding - tbButtonWH;
1719 tbButtonX3 = tbButtonX4 - extraButtonPadding - pSettings->Toolbar->marginWidth - tbButtonWH;
1720 offsetRightX -= ((2*tbButtonWH) + (3*extraButtonPadding) + (2*pSettings->Toolbar->marginWidth));
1721 }
1722
1724
1725 tbWinLabelX = offsetLeftX;
1726 tbWinLabelY = offsetY;
1727 tbWinLabelW = offsetRightX - offsetLeftX;
1728 if (tbWinLabelW < 0) tbWinLabelW = 0; // Make sure windowlabel width is acceptable; could be < 0 if toolbar width (percentage) is too small!
1729
1730/*
1731 tbLabelX = toolbarMarginPlusBorder;
1732 tbLabelY = tbLabelX;
1733
1734 tbClockX = ToolbarWidth - tbClockW - toolbarMarginPlusBorder;
1735 tbClockY = tbLabelY;
1736
1737 if (pSettings->numberOfWorkspaces > 1)
1738 {
1739 tbWinLabelX = tbLabelX + tbLabelW + (2*tbButtonWH) + (3*pSettings->Toolbar->marginWidth) + (3*extraButtonPadding);
1740 tbWinLabelY = tbLabelY;
1741 tbWinLabelW = ToolbarWidth - (2*tbWinLabelX);
1742 }
1743 else
1744 {
1745 tbWinLabelX = tbLabelX;
1746 tbWinLabelY = tbLabelY;
1747 tbWinLabelW = ToolbarWidth - (2*tbLabelX) - tbClockW - (2*tbButtonWH) - (3*pSettings->Toolbar->marginWidth) - (3*extraButtonPadding);
1748 }
1749
1750 // Make sure windowlabel width is acceptable, could be < 0 if toolbar width (percentage) is too small!
1751 if (tbWinLabelW < 0) tbWinLabelW = 0;
1752
1753 tbButtonX1 = tbLabelX + tbLabelW + pSettings->Toolbar->marginWidth + extraButtonPadding;
1754 tbButtonX2 = tbButtonX1 + tbButtonWH + pSettings->Toolbar->marginWidth + extraButtonPadding;
1755 tbButtonX3 = tbWinLabelX + tbWinLabelW + pSettings->Toolbar->marginWidth + extraButtonPadding;
1756 tbButtonX4 = tbButtonX3 + tbButtonWH + pSettings->Toolbar->marginWidth + extraButtonPadding;
1757
1758// tbButtonWH = maxHeight;
1759// tbButtonY = toolbarMarginPlusBorder;
1760 tbButtonY = (ToolbarHeight - tbButtonWH) / 2;
1761*/
1762 }
1763
1764 //====================
1765
1766 // ##### Vertical toolbar orientation #####
1767
1768 else
1769 {
1770 // In vertical mode the windowlabel width == the clock width, or the minimum width defined in xoblite.rc...
1771
1772 if (toolbarVerticalPeeking) tbWinLabelW = (ScreenWidth / 2) - (2 * toolbarMarginPlusBorder);
1773 else if (pSettings->toolbarVerticalWidth >= 70) // Minimum safeguard width is 70 pixels, otherwise fallback to automatic width
1774 {
1775 tbWinLabelW = pSettings->toolbarVerticalWidth - (2 * toolbarMarginPlusBorder);
1777 }
1778 else if (tbClockW > 0) tbWinLabelW = tbClockW;
1779 else if (tbLabelW > 0) tbWinLabelW = tbLabelW;
1780 else tbWinLabelW = (ScreenWidth / 10); // Failsafe
1781
1783
1784 //====================
1785
1786 ToolbarWidth = tbWinLabelW + (toolbarMarginPlusBorder * 2);
1787
1788 // Simple failsafe: Perform an additional width check in case the toolbar buttons are *unusually* large...
1789 // (i.e. using very large toolbar.button.marginwidth's *cough* Pitkon *cough* ;) )
1791 {
1792 int buttonsCheckWidth;
1793 if (pSettings->numberOfWorkspaces > 1) buttonsCheckWidth = (tbButtonWH * 4) + (pSettings->Toolbar->marginWidth * 10) + (toolbarMarginPlusBorder * 2);
1794 else buttonsCheckWidth = (tbButtonWH * 2) + (pSettings->Toolbar->marginWidth * 4) + (toolbarMarginPlusBorder * 2);
1795 if (ToolbarWidth < buttonsCheckWidth)
1796 {
1797 ToolbarWidth = buttonsCheckWidth;
1798 tbWinLabelW = tbClockW = ToolbarWidth - (toolbarMarginPlusBorder * 2);
1799 if (tbLabelW > 0) tbLabelW = tbWinLabelW;
1800 }
1801 }
1802
1803 //====================
1804
1805 // Adaptively calculate each toolbar element's position depending on the visibility of the other toolbar elements...
1806
1807 int offsetX = toolbarMarginPlusBorder;
1808 int offsetY = toolbarMarginPlusBorder;
1809
1811 {
1812 tbLabelX = offsetX;
1813 tbLabelY = offsetY;
1814 offsetY += (tbLabelH + pSettings->Toolbar->marginWidth);
1815 }
1816
1817 tbWinLabelX = offsetX;
1818 tbWinLabelY = offsetY;
1820 {
1822// tbWinLabelH -= pSettings->Toolbar->marginWidth; // ...because we only add extra padding in between the task buttons... (i.e. remove last added padding)
1823
1824 // If applicable, add some room vertically for taskbar scrolling indicators at *both* ends of the taskbar...
1825 // (nb. we need to do this because we do *not* recalculate the toolbar height upon taskbar scrolling only, i.e. no or either or both indicator(s) may be visible)
1826 int leftTopPadding = 0, rightBottomPadding = 0;
1827 int taskbarScrollIndicatorSize = pTaskbar->GetTaskbarScrollIndicatorSizes(&leftTopPadding, &rightBottomPadding);
1828 if ((leftTopPadding > 0) || (rightBottomPadding > 0)) tbWinLabelH += (taskbarScrollIndicatorSize * 2);
1829 }
1830 offsetY += tbWinLabelH;
1831
1833 {
1835 {
1836 tbButtonX1 = offsetX + (extraButtonPadding*2);
1837 tbButtonX2 = tbButtonX1 + tbButtonWH + pSettings->Toolbar->marginWidth + extraButtonPadding;
1840 }
1842 {
1843 tbButtonX1 = (ToolbarWidth/2) - (pSettings->Toolbar->marginWidth/2) - (extraButtonPadding/2) - tbButtonWH;
1844 tbButtonX2 = tbButtonX1 + tbButtonWH + pSettings->Toolbar->marginWidth + extraButtonPadding;
1845 }
1847 {
1848 tbButtonX3 = (ToolbarWidth/2) - (pSettings->Toolbar->marginWidth/2) - (extraButtonPadding/2) - tbButtonWH;
1849 tbButtonX4 = tbButtonX3 + tbButtonWH + pSettings->Toolbar->marginWidth + extraButtonPadding;
1850 }
1851
1852 tbButtonY = offsetY + pSettings->Toolbar->marginWidth + extraButtonPadding;
1853 offsetY += (pSettings->Toolbar->marginWidth + tbButtonWH + (extraButtonPadding * 2));
1854 }
1855
1857 {
1858 tbClockX = offsetX;
1859 tbClockY = offsetY + pSettings->Toolbar->marginWidth;
1860 offsetY += (pSettings->Toolbar->marginWidth + tbClockH);
1861 }
1862
1863 ToolbarHeight = offsetY + toolbarMarginPlusBorder;
1864
1865
1866
1867
1868
1869
1870
1871/*
1872 if (pSettings->numberOfWorkspaces > 1)
1873 {
1874 tbWinLabelY = tbLabelY + tbLabelH + pSettings->Toolbar->marginWidth;
1875 }
1876 else tbWinLabelY = toolbarMarginPlusBorder;
1877
1878 tbButtonX1 = tbWinLabelX + (extraButtonPadding*2);
1879 tbButtonX2 = tbButtonX1 + tbButtonWH + pSettings->Toolbar->marginWidth + extraButtonPadding;
1880 if (pSettings->numberOfWorkspaces > 1)
1881 {
1882 tbButtonX3 = ToolbarWidth - tbButtonX2 - tbButtonWH;
1883 tbButtonX4 = ToolbarWidth - tbButtonX1 - tbButtonWH;
1884 }
1885 else
1886 {
1887 int twoButtonsWidth = tbButtonX2 + tbButtonWH - tbButtonX1;
1888 tbButtonX3 = (ToolbarWidth/2) - (twoButtonsWidth/2);
1889 tbButtonX4 = tbButtonX3 + tbButtonWH + pSettings->Toolbar->marginWidth + extraButtonPadding;
1890 }
1891 tbButtonY = tbWinLabelY + tbWinLabelH + extraButtonPadding;
1892
1893 tbClockY = tbButtonY + tbButtonWH + extraButtonPadding + pSettings->Toolbar->marginWidth;
1894
1895// tbButtonY = tbLabelY + tbLabelH + pSettings->Toolbar->marginWidth + extraButtonPadding;
1896// tbWinLabelY = tbButtonY + tbButtonWH + extraButtonPadding + pSettings->Toolbar->marginWidth;
1897// tbClockY = tbWinLabelY + tbWinLabelH;
1898
1899 ToolbarHeight = tbClockY + tbClockH + toolbarMarginPlusBorder;
1900*/
1901 }
1902
1903 //====================
1904
1905 // Save the element rect's so we can later on e.g. check if a specific element has been clicked...
1909
1914}
bool toolbarAllowAsymmetry
Definition Settings.h:208
bool explorerHidden
Definition Settings.h:337
int toolbarVerticalWidth
Definition Settings.h:193
int taskButtonsToDraw
Definition Taskbar.h:141
int GetTaskButtonsToDraw()
Definition Taskbar.cpp:1782
int GetTaskbarScrollIndicatorSizes(int *leftTopPadding, int *rightBottomPadding)
Definition Taskbar.cpp:1802
int tbLabelY
Definition Toolbar.h:99
int tbWinLabelX
Definition Toolbar.h:100
int tbLabelX
Definition Toolbar.h:99
int tbButtonX2
Definition Toolbar.h:104
int tbButtonX1
Definition Toolbar.h:104
int tbClockW
Definition Toolbar.h:101
int tbClockX
Definition Toolbar.h:101
int tbWinLabelW
Definition Toolbar.h:100
int ScreenWidth
Definition Toolbar.h:93
int tbLabelH
Definition Toolbar.h:99
int tbWinLabelY
Definition Toolbar.h:100
int tbButtonX4
Definition Toolbar.h:104
int tbWinLabelH
Definition Toolbar.h:100
int tbClockY
Definition Toolbar.h:101
int tbButtonX3
Definition Toolbar.h:104
int tbButtonY
Definition Toolbar.h:104
int tbClockH
Definition Toolbar.h:101
int ScreenHeight
Definition Toolbar.h:93
int tbLabelW
Definition Toolbar.h:99

◆ GetPlacement()

void Toolbar::GetPlacement ( )
1919{
1922
1923 // If toolbar width is defined in pixels (i.e. > 100) or if the toolbar
1924 // is vertically oriented we treat the position as relative to the entire
1925 // virtual screen, i.e. with multi monitor support...
1926// if (pSettings->toolbarVertical || (pSettings->toolbarHorizontalWidth > 100)) pSettings->PositionFromPlacement(&pSettings->ToolbarPlacement, true);
1927 // ...and if toolbar is defined as a percentage of the screen width
1928 // (i.e. <= 100) we treat the position as relative to the main screen/monitor...
1929// else pSettings->PositionFromPlacement(&pSettings->ToolbarPlacement, false);
1930
1931// if (pSettings->ToolbarPlacement.placement == PLACEMENT_MANUAL) pSettings->PositionFromPlacement(&pSettings->ToolbarPlacement, true);
1932// else pSettings->PositionFromPlacement(&pSettings->ToolbarPlacement, false);
1934
1937}
void PositionFromPlacement(Placement *inputPlacement)
Definition Settings.cpp:3236
int height
Definition Settings.h:97
int width
Definition Settings.h:96
int x
Definition Settings.h:94
int y
Definition Settings.h:95

◆ UpdatePosition()

void Toolbar::UpdatePosition ( )
1942{
1943// if (pSettings->debugLogging) SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INFORMATION_MESSAGE, (LPARAM)"Toolbar -> UpdatePosition()");
1944
1945 // Fetch the new size and position parameters for our window...
1946 GetDimensions();
1947 GetPlacement();
1948
1949 // Force re-rendering of the background, windowLabel and task button bitmaps...
1950 cachedBitmapsExist = false;
1952 else SetRectEmpty(&currentWindowLabelRect);
1953
1954 // Update the toolbar window...
1956
1957 // Update the always on top setting for the toolbar window...
1958 if (pSettings->toolbarOnTop) SetWindowPos(hToolbarWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE);
1959 else SetWindowPos(hToolbarWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE);
1960
1961 // Update the desktop area...
1962// UpdateDesktopArea();
1963
1964 // Save placement to xoblite.rc...
1965// pSettings->WritePlacement(&pSettings->ToolbarPlacement);
1966}
bool cachedTaskButtonsExist
Definition Taskbar.h:122
void UpdateToolbarWindow()
Definition Toolbar.cpp:883

◆ MoveToMouse()

void Toolbar::MoveToMouse ( )
2011{
2012 POINT pos;
2013 GetCursorPos(&pos);
2014 ToolbarX = pos.x - (ToolbarWidth / 2);
2015 ToolbarY = pos.y - (ToolbarHeight / 2);
2016
2017 SetWindowPos(hToolbarWnd, HWND_TOP, ToolbarX, ToolbarY, 0, 0, SWP_NOSIZE | SWP_NOREDRAW);
2018 SetForegroundWindow(hToolbarWnd);
2019}

◆ ToggleAlwaysOnTop()

void Toolbar::ToggleAlwaysOnTop ( )
2024{
2025 if (!pSettings->toolbarOnTop)
2026 {
2027 pSettings->toolbarOnTop = true;
2028 SetWindowPos(hToolbarWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE);
2029 }
2030 else
2031 {
2032 pSettings->toolbarOnTop = false;
2033 SetWindowPos(hToolbarWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE);
2034 }
2035
2036 WriteBool(pSettings->xobrcFile, "xoblite.toolbar.onTop:", pSettings->toolbarOnTop);
2037}
void WriteBool(LPCSTR fp, LPCSTR keyword, bool value)
Definition BBApi.cpp:3131

◆ ToolbarModeButtonPressed()

void Toolbar::ToolbarModeButtonPressed ( bool nextMode)
2042{
2043 if (nextMode) // -> Next toolbar mode
2044 {
2048 {
2051 }
2053 }
2054 else // -> Previous toolbar mode
2055 {
2059 else // if (pSettings->taskbarMode == TASKBAR_MODE_HIDDEN)
2060 {
2063 }
2064 }
2065
2067
2068 UpdatePosition(); // -> Refreshes the toolbar including the change of modes
2070
2071 // Save the taskbar mode change to xoblite.rc... (or legacy supported extensions.rc)
2072 if (pSettings->taskbarMode == TASKBAR_MODE_BARS) WriteString(pSettings->xobrcFile, "xoblite.taskbar.mode:", "Bars");
2073 else if (pSettings->taskbarMode == TASKBAR_MODE_BARSICONS) WriteString(pSettings->xobrcFile, "xoblite.taskbar.mode:", "Bars+Icons");
2074 else if (pSettings->taskbarMode == TASKBAR_MODE_ICONS) WriteString(pSettings->xobrcFile, "xoblite.taskbar.mode:", "Icons");
2075 else WriteString(pSettings->xobrcFile, "xoblite.taskbar.mode:", "Hidden");
2076}
void WriteString(LPCSTR fp, LPCSTR keyword, LPSTR value)
Definition BBApi.cpp:3156
#define TASKBAR_MODE_BARS
Definition Settings.h:43
#define TASKBAR_MODE_BARSICONS
Definition Settings.h:44
#define TASKBAR_MODE_ICONS
Definition Settings.h:45
void PlaySoundFX(int sound)
Definition Sounds.cpp:40
@ SFX_TOGGLE_ELEMENT
Definition Sounds.h:48

◆ CheckIfMouseHover()

bool Toolbar::CheckIfMouseHover ( )
2081{
2082 POINT mousepos;
2083 GetCursorPos(&mousepos);
2084 if (mousepos.x >= ToolbarX && mousepos.x <= (ToolbarX + ToolbarWidth))
2085 {
2086 if (mousepos.y >= ToolbarY && mousepos.y <= (ToolbarY + ToolbarHeight)) return true;
2087 }
2088
2089 return false;
2090}

Friends And Related Symbol Documentation

◆ ToolbarWndProc

LRESULT CALLBACK ToolbarWndProc ( HWND hwnd,
UINT message,
WPARAM wParam,
LPARAM lParam )
friend
198{
199 switch (message)
200 {
201 //====================
202
203 case BB_TASKSUPDATE:
204 {
206 {
207// if (pSettings->debugLogging) SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INFORMATION_MESSAGE, (LPARAM)"Toolbar -> BB_TASKSUPDATE (taskbar visible)");
208
209 if (lParam == TASKITEM_ADDED || lParam == TASKITEM_REMOVED || lParam == TASKITEM_REFRESH)
210 {
212 {
213 // Wait at least 200 msec between add/remove related UI updates to avoid
214 // excessive toolbar updating when e.g. launching many-multi-window apps...
217 if (!SetTimer(pToolbar->hToolbarWnd, TOOLBAR_THROTTLE_UPDATES_TIMER, 200, (TIMERPROC)NULL)) pToolbar->throttlingAddRemoveUpdates = false;
218
221/*
222 if (pSettings->debugLogging)
223 {
224 if (lParam == TASKITEM_ADDED) SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INFORMATION_MESSAGE, (LPARAM)"Toolbar -> TASKITEM_ADDED");
225 else if (lParam == TASKITEM_REMOVED) SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INFORMATION_MESSAGE, (LPARAM)"Toolbar -> TASKITEM_REMOVED");
226 else if (lParam == TASKITEM_REFRESH) SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INFORMATION_MESSAGE, (LPARAM)"Toolbar -> TASKITEM_REFRESH");
227 }
228*/
229 }
230 else pToolbar->updatesThrottled = true;
231 }
232
233 //====================
234
235 else if (lParam == TASKITEM_MODIFIED || lParam == TASKITEM_FLASHED)
236 {
237 if (wParam != NULL)
238 {
239 int i = pTaskbar->FindTask((HWND)wParam);
241/*
242 if (pSettings->debugLogging)
243 {
244 if (lParam == TASKITEM_MODIFIED) SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INFORMATION_MESSAGE, (LPARAM)"Toolbar -> TASKITEM_MODIFIED");
245 else if (lParam == TASKITEM_FLASHED) SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INFORMATION_MESSAGE, (LPARAM)"Toolbar -> TASKITEM_FLASHED");
246 }
247*/
248 }
249 }
250
251 //====================
252
253 else if (lParam == TASKITEM_ACTIVATED)
254 {
255 if (pTaskbar->FindTask((HWND)wParam) >= 0)
256 {
258 {
259 // Wait at least 100 msec between activity related UI updates to
260 // suppress e.g. active task flipping when operating the menu...
262 if (!SetTimer(pToolbar->hToolbarWnd, TOOLBAR_THROTTLE_UPDATES_TIMER, 100, (TIMERPROC)NULL)) pToolbar->throttlingActivityUpdates = false;
264 }
265 else pToolbar->updatesThrottled = true;
266
267// if (pSettings->debugLogging) SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INFORMATION_MESSAGE, (LPARAM)"Toolbar -> TASKITEM_ACTIVATED -> Taskbar item activated...");
268 }
269 else
270 {
271// if (pSettings->debugLogging) SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INFORMATION_MESSAGE, (LPARAM)"Toolbar -> TASKITEM_ACTIVATED -> Non-taskbar item activated...");
273 }
274 }
275 }
276 }
277 break;
278
279 //====================
280
281 case BB_ADDTASK:
282 {
283 pTaskbar->AddTask((HWND)wParam);
284 }
285 break;
286
287 case BB_REMOVETASK:
288 {
289 pTaskbar->RemoveTask((HWND)wParam);
290 }
291 break;
292
293 case BB_ACTIVETASK:
294 {
295 pTaskbar->SetActiveTask((HWND)wParam);
296 }
297 break;
298
299 case BB_REDRAW:
300 {
301 pTaskbar->RedrawTask((HWND)wParam);
302 }
303 break;
304
306 {
308 }
309 break;
310
311 //====================
312
313 case WM_TIMER:
314 {
315 if (wParam == TOOLBAR_THROTTLE_UPDATES_TIMER)
316 {
318
320 {
322 {
325
326 // if (pSettings->debugLogging) SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INFORMATION_MESSAGE, (LPARAM)"Toolbar -> throttlingAddRemoveUpdates ended.");
327 }
328 else // if (pToolbar->throttlingActivityUpdates)
329 {
331
332 // if (pSettings->debugLogging) SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INFORMATION_MESSAGE, (LPARAM)"Toolbar -> throttlingActivityUpdates ended.");
333 }
334 }
335
337
338 return 0;
339 }
340
341 //====================
342
343 else if (wParam == TOOLBAR_SAVE_WIDTH_TIMER)
344 {
347 {
348 WriteInt(pSettings->xobrcFile, "xoblite.toolbar.horizontal.width:", pSettings->toolbarHorizontalWidth);
350 }
351 return 0;
352 }
353
354 //====================
355
356 else // TOOLBAR_UPDATE_TIMER
357 {
358 bool updateToolbar = false;
359
360 // Should we update the toolbar clock? (nb. every 40x250 msec == 10 seconds; same as the Desktop clock)
362 else
363 {
364 if (pToolbar->GetClockText(false)) updateToolbar = true;
366 }
367
368 // Should we update the toolbar windowLabel? (nb. only applicable if the taskbar is hidden)
370 {
371 int i = pTaskbar->GetActiveTask();
372 if (i >= 0)
373 {
374 if (pTaskbar->taskList[i]->hidden || IsIconic(pTaskbar->taskList[i]->hwnd))
375 {
376 if (wcslen(pToolbar->CurrentWindow) > 0)
377 {
378 pToolbar->CurrentWindow[0] = '\0'; // -> Display "xoblite" as the toolbar windowLabel instead...
379 updateToolbar = true;
380 }
381 }
382 else if (_wcsicmp(pToolbar->CurrentWindow, pTaskbar->taskList[i]->captionUnicode)) // Has the active task's window title text changed?
383 {
384 wcscpy(pToolbar->CurrentWindow, pTaskbar->taskList[i]->captionUnicode);
385 updateToolbar = true;
386 }
387
388 // if (updateToolbar && pSettings->debugLogging) SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INFORMATION_MESSAGE, (LPARAM)"Toolbar -> TOOLBAR_UPDATE_TIMER -> WindowLabel updated.");
389 }
390 }
391
392 // Has the number of visible task buttons on the taskbar changed? (nb. this should normally happen automatically,
393 // but every now and then the toolbar and taskbar may fall out of sync drawing so let's add a failsafe... :) )
394// if (pTaskbar->GetTaskButtonsToDraw() != pTaskbar->taskButtonsLastDrawn) updateToolbar = true;
395
396 if (updateToolbar) pToolbar->UpdateToolbarWindow();
397
398 return 0;
399 }
400 }
401 break;
402
403 //====================
404
405 case WM_DROPFILES:
406 {
407 return pTaskbar->DropFiles(hwnd, wParam, (pSettings->taskbarMode != TASKBAR_MODE_HIDDEN));
408 }
409 break;
410
411 //====================
412
413 case BB_RECONFIGURE:
414 {
415 SetRectEmpty(&pToolbar->currentWindowLabelRect);
416 pToolbar->UpdatePosition(); // Gets new settings and resizes window if needed...
417
419 {
420 // Update the tooltips colours (background+text), matching the current toolbar style colors...
421// SendMessage(pTooltips->hToolTipsWnd, TTM_SETTIPBKCOLOR, (WPARAM)pSettings->Toolbar->TextColor, 0);
422// SendMessage(pTooltips->hToolTipsWnd, TTM_SETTIPTEXTCOLOR, (WPARAM)pSettings->Toolbar->Color, 0);
423// SendMessage(pTooltips->hToolTipsWnd, TTM_SETTIPBKCOLOR, (WPARAM)pSettings->ToolbarWindowLabel->Color, 0);
424// SendMessage(pTooltips->hToolTipsWnd, TTM_SETTIPTEXTCOLOR, (WPARAM)pSettings->ToolbarWindowLabel->TextColor, 0);
425 }
426 }
427 break;
428
429 //====================
430
431 case BB_TOGGLETOOLBAR:
432 {
434 else pSettings->toolbarHidden = false;
435
437 ShowWindow(pToolbar->hToolbarWnd, pSettings->toolbarHidden ? SW_HIDE : SW_SHOWNOACTIVATE);
438
439 if (pDesktop) pDesktop->UpdateDesktopWindow(); // In case e.g. the workspace indicators need to be moved given the new toolbar placement
440
442
443 WriteBool(pSettings->xobrcFile, "xoblite.toolbar.hidden:", pSettings->toolbarHidden);
444 }
445 break;
446
447 //====================
448
450 {
452 }
453 break;
454
455 //====================
456
457 case WM_CLOSE:
458 return 0;
459
460 //====================
461
462 case WM_DISPLAYCHANGE:
463 {
464 if (pSettings->toolbarHidden) break;
466 }
467 break;
468
469 case WM_SETTINGCHANGE:
470 {
471 // Update the toolbar's position (and maybe also dimensions) if the work area changes...
472 // (e.g. if the Explorer taskbar is moved to another screen edge)
473 if (pSettings->toolbarHidden) break;
474 if (wParam == SPI_SETWORKAREA) pToolbar->UpdatePosition();
475 return 0;
476 }
477
478 //====================
479/*
480 case WM_MOUSEACTIVATE:
481 return MA_NOACTIVATE;
482
483 case WM_ACTIVATE:
484 if (LOWORD(wParam) == WA_ACTIVE || LOWORD(wParam) == WA_CLICKACTIVE) SetActiveWindow(hwnd);
485 return 0;
486*/
487 //====================
488
489 case WM_EXITSIZEMOVE:
490 {
492 {
494
495 RECT r;
496 GetWindowRect(pToolbar->hToolbarWnd, &r);
500
501// pToolbar->UpdatePosition();
503
506 SetTimer(pToolbar->hToolbarWnd, TOOLBAR_SAVE_WIDTH_TIMER, 1000, (TIMERPROC)NULL);
507 }
508
509 return 0;
510 }
511
512 //====================
513
514 // Allow window to move if control key is being held down,
515 // holding down the shift key and left clicking moves the window
516 // back to the default position...
517 case WM_NCHITTEST:
518 {
519 if ((GetAsyncKeyState(VK_CONTROL) & 0x8000))
520 {
521 POINT pt;
522 pt.x = GET_X_LPARAM(lParam);
523 pt.y = GET_Y_LPARAM(lParam);
524 ScreenToClient(hwnd, &pt);
525
526 if ((pSettings->taskbarMode != TASKBAR_MODE_HIDDEN) && PtInRect(&pToolbar->winlabelRect, pt)) return HTCLIENT;
527 else
528 {
530 return HTCAPTION;
531 }
532 }
533 else return HTCLIENT;
534 }
535 break;
536
537 //====================
538
539 case WM_LBUTTONDBLCLK:
540 {
541 if (GetAsyncKeyState(VK_MENU) & 0x8000)
542 {
544 {
546 else pToolbar->toolbarVerticalPeeking = true;
548 }
549 }
550 else
551 {
552 POINT pt = {LOWORD(lParam), HIWORD(lParam)};
553 // Doubleclick on the workspace label -> edit current workspace name
554 if (!pSettings->toolbarLabelHidden && (pSettings->numberOfWorkspaces > 1) && PtInRect(&pToolbar->labelRect, pt)) BBExecute(GetDesktopWindow(), NULL, pSettings->preferredEditor, pSettings->xobrcDefaultFile, NULL, SW_SHOWNORMAL, false);
555 // Doubleclick on the clock -> open date/time properties
556 else if (!pSettings->toolbarClockHidden && PtInRect(&pToolbar->clockRect, pt)) BBExecute(GetDesktopWindow(), NULL, "control.exe", "timedate.cpl", NULL, SW_SHOWNORMAL, false);
557 }
558 }
559 break;
560
561 //====================
562
563 case WM_LBUTTONDOWN:
564 case WM_LBUTTONUP:
565 case WM_RBUTTONDOWN:
566 case WM_RBUTTONUP:
567 case WM_MBUTTONDOWN:
568 case WM_MBUTTONUP:
569 case WM_XBUTTONDOWN:
570 case WM_XBUTTONUP:
571 {
573 {
574 if (pTaskbar->MouseButtonOnTaskbar(hwnd, message, wParam, lParam))
575 {
576 return DefWindowProc(hwnd, message, wParam, lParam);
577 }
578 }
579
580 //====================
581
582 if (message == WM_LBUTTONDOWN)
583 {
584 TRACKMOUSEEVENT track;
585 ZeroMemory(&track,sizeof(track));
586 track.cbSize = sizeof(track);
587 track.dwFlags = TME_LEAVE;
588 track.dwHoverTime = HOVER_DEFAULT;
589 track.hwndTrack = pToolbar->hToolbarWnd;
590 _TrackMouseEvent(&track);
591
592 POINT pt = {LOWORD(lParam), HIWORD(lParam)};
593
595 {
596 if (PtInRect(&pToolbar->button1Rect, pt))
597 {
598 pToolbar->ButtonPressed1 = true;
599 // InvalidateRect(pToolbar->hToolbarWnd, &pToolbar->button1Rect, false);
601 }
602 else if (PtInRect(&pToolbar->button2Rect, pt))
603 {
604 pToolbar->ButtonPressed2 = true;
605 // InvalidateRect(pToolbar->hToolbarWnd, &pToolbar->button2Rect, false);
607 }
608 }
609
611 {
612 if (PtInRect(&pToolbar->button3Rect, pt))
613 {
614 pToolbar->ButtonPressed3 = true;
615 // InvalidateRect(pToolbar->hToolbarWnd, &pToolbar->button3Rect, false);
617 }
618 else if (PtInRect(&pToolbar->button4Rect, pt))
619 {
620 pToolbar->ButtonPressed4 = true;
621 // InvalidateRect(pToolbar->hToolbarWnd, &pToolbar->button4Rect, false);
623 }
624 }
625
627 }
628
629 //====================
630
631 else if (message == WM_LBUTTONUP)
632 {
633 if (pToolbar->ButtonPressed1) // Toolbar "down" button
634 {
635 if ((strlen(pSettings->toolbarDownButtonOverride) > 0) && !(GetAsyncKeyState(VK_MENU) & 0x8000))
636 {
637 BBSmartExecute(pSettings->toolbarDownButtonOverride); // -> User configured override command for the "down" button
638 }
639 else SendMessage(pToolbar->hBlackboxWnd, BB_WORKSPACE, 0, 0); // -> Previous workspace ("DeskLeft")
640 }
641 else if (pToolbar->ButtonPressed2) // Toolbar "up" button
642 {
643 if ((strlen(pSettings->toolbarUpButtonOverride) > 0) && !(GetAsyncKeyState(VK_MENU) & 0x8000))
644 {
645 BBSmartExecute(pSettings->toolbarUpButtonOverride); // -> User configured override command for the "up" button
646 }
647 else SendMessage(pToolbar->hBlackboxWnd, BB_WORKSPACE, 1, 0); // -> Next workspace ("DeskRight")
648 }
649 else if (pToolbar->ButtonPressed3) // Toolbar "left" button
650 {
651 if ((strlen(pSettings->toolbarLeftButtonOverride) > 0) && !(GetAsyncKeyState(VK_MENU) & 0x8000))
652 {
653 BBSmartExecute(pSettings->toolbarLeftButtonOverride); // -> User configured override command for the "left" button
654 }
655 else pToolbar->ToolbarModeButtonPressed(false); // -> Previous toolbar mode
656 }
657 else if (pToolbar->ButtonPressed4) // Toolbar "right" button
658 {
659 if ((strlen(pSettings->toolbarRightButtonOverride) > 0) && !(GetAsyncKeyState(VK_MENU) & 0x8000))
660 {
661 BBSmartExecute(pSettings->toolbarRightButtonOverride); // -> User configured override command for the "right" button
662 }
663 else pToolbar->ToolbarModeButtonPressed(true); // -> Next toolbar mode
664 }
665
668 }
669
670 //====================
671
672 else if (message == WM_RBUTTONUP)
673 {
674 if (GetAsyncKeyState(VK_MENU) & 0x8000) SendMessage(GetBBWnd(), BB_MENU, 0, 0); // -> Main menu
675 else
676 {
677 POINT pt = {LOWORD(lParam), HIWORD(lParam)};
678// if (!pSettings->toolbarLabelHidden && (pSettings->numberOfWorkspaces > 1) && PtInRect(&pToolbar->labelRect, pt)) SendMessage(GetBBWnd(), BB_MENU, 1, 0); // -> Workspaces menu
679// else if (!pSettings->toolbarClockHidden && PtInRect(&pToolbar->clockRect, pt)) SendMessage(GetBBWnd(), BB_MENU, 2, 0); // -> Configuration menu
680// else SendMessage(GetBBWnd(), BB_MENU, 0, 0); // -> Main menu
681 if (!pSettings->toolbarClockHidden && PtInRect(&pToolbar->clockRect, pt)) SendMessage(GetBBWnd(), BB_MENU, 2, 0); // -> Configuration menu
682 else SendMessage(GetBBWnd(), BB_MENU, 0, 0); // -> Main menu
683 }
684 }
685
686 //====================
687
688 else if (message == WM_MBUTTONUP)
689 {
690 if (GetAsyncKeyState(VK_MENU) & 0x8000) PostMessage(GetBBWnd(), BB_TOGGLEDOCK, 0, 0); // -> Toggle dock
691 else if (GetAsyncKeyState(VK_SHIFT) & 0x8000) PostMessage(GetBBWnd(), BB_TOGGLEPLUGINS, 0, 0); // -> Toggle plugins
692 else
693 {
694 POINT pt = {LOWORD(lParam), HIWORD(lParam)};
695 if ((pSettings->taskbarMode != TASKBAR_MODE_HIDDEN) || !PtInRect(&pToolbar->winlabelRect, pt)) pToolbar->ToolbarModeButtonPressed(true); // -> Next toolbar mode
696 }
697 }
698
699 //====================
700
701 else if (message == WM_XBUTTONDOWN)
702 {
703 if (HIWORD(wParam) == XBUTTON1)
704 {
705 if (GetAsyncKeyState(VK_MENU) & 0x8000)
706 {
708 {
710 else pToolbar->toolbarVerticalPeeking = true;
713 }
714 }
715// else if (GetAsyncKeyState(VK_SHIFT) & 0x8000) BBExecute(GetDesktopWindow(), NULL, "control.exe", "desk.cpl,,3", NULL, SW_SHOWNORMAL, false);
716 else
717 {
718 // Toggle toolbar orientation... (horizontal<->vertical)
720 else pSettings->toolbarVertical = true;
721
724
725 WriteBool(pSettings->xobrcFile, "xoblite.toolbar.vertical:", pSettings->toolbarVertical);
726 }
727 }
728 else if (HIWORD(wParam) == XBUTTON2)
729 {
731 {
732 // Toggle toolbar peeking if already in vertical orientation...
734 else pToolbar->toolbarVerticalPeeking = true;
735 }
736 else
737 {
738 // Change to vertical toolbar orientation and enable peeking directly...
741// WriteBool(pSettings->xobrcFile, "xoblite.toolbar.vertical:", pSettings->toolbarVertical);
742 }
743
746 }
747 }
748 }
749 break;
750
751 //====================
752
753 case WM_MOUSEWHEEL: // -> Regular vertical mouse scroll wheel i.e. up/down movement
754 case WM_MOUSEHWHEEL: // -> Horizontal mouse scroll wheel (or more commonly, a touchpad) i.e. left/right movement
755 {
756 // Only allow mousewheel resizing when the control key is held down...
757 if ((message == WM_MOUSEWHEEL) && (GetAsyncKeyState(VK_CONTROL) & 0x8000))
758 {
759 // ...when the toolbar width is defined as a percentage of the screen size...
760 if (pSettings->toolbarHorizontalWidth > 100) break;
761 // ...and the toolbar is horizontally oriented...
762 if (pSettings->toolbarVertical) break;
763
764 bool sizechanged = false;
765
766 if (GET_WHEEL_DELTA_WPARAM(wParam) < 0)
767 {
769 {
771 sizechanged = true;
772 }
773 }
774 else
775 {
777 {
779 sizechanged = true;
780 }
781 }
782
783 if (sizechanged)
784 {
787
788 // Force re-rendering of the background and task button bitmaps...
792
793 if (pSettings->toolbarOnTop) SetWindowPos(pToolbar->hToolbarWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE);
794 else SetWindowPos(pToolbar->hToolbarWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE);
795
796 // Due to the number of repeated updates when using the mousewheel to change the toolbar width,
797 // we wait a second before saving the width to xoblite.rc, in case we're not done resizing yet...
800 SetTimer(pToolbar->hToolbarWnd, TOOLBAR_SAVE_WIDTH_TIMER, 1000, (TIMERPROC)NULL);
801 }
802 }
803
804 //====================
805
806 // ...otherwise the mousewheel controls the visible span of taskbar items, if the total
807 // number of taskbar items is > than the configured maximum simultaneously visible...
809 {
810 if (((message == WM_MOUSEWHEEL) && (GET_WHEEL_DELTA_WPARAM(wParam) < 0)) || ((message == WM_MOUSEHWHEEL) && (GET_WHEEL_DELTA_WPARAM(wParam) > 0)))
811 {
813 int firstButton = pTaskbar->FindFirstVisible();
814 if (pTaskbar->FindLastVisible(firstButton) < 0) pTaskbar->taskButtonsOffset--; // Couldn't scroll further down/right...
816 }
817 else if (pTaskbar->taskButtonsOffset > 0)
818 {
821 }
822 }
823 }
824 break;
825
826 //====================
827/*
828 case WM_MOUSEMOVE:
829 {
830 }
831 break;
832*/
833 //====================
834/*
835 case WM_MOUSEHOVER:
836 case WM_NCMOUSEHOVER:
837 {
838 // Do something?
839// pSettings->toolbarTransparencyAlpha = 255;
840 pToolbar->UpdateToolbarWindow();
841 break;
842 }
843*/
844 case WM_MOUSELEAVE:
845 case WM_NCMOUSELEAVE:
846 {
849 }
850 break;
851
852 //====================
853
854 // If moved, snap window to screen edges...
855 case WM_WINDOWPOSCHANGING:
856 {
857 // Snap window to screen edges when in manual positioning mode?
859 {
860 if (pToolbar)
861 {
862 if (IsWindowVisible(hwnd)) SnapWindowToEdge((WINDOWPOS*)lParam, pSettings->edgeSnapThreshold, true);
863 }
864 }
865 }
866 return 0;
867
868 //====================
869
870 default:
871 return DefWindowProc(hwnd,message,wParam,lParam);
872
873 //====================
874 }
875 return 0;
876}
Desktop * pDesktop
Definition Blackbox.cpp:37
void BBSmartExecute(LPSTR inputString)
Definition BBApi.cpp:1767
MenuCommon * pMenuCommon
Definition Blackbox.cpp:41
void SnapWindowToEdge(WINDOWPOS *pwPos, int nDist, bool bUseScreenSize)
Definition BBApi.cpp:1970
HINSTANCE BBExecute(HWND Owner, LPCSTR szOperation, LPCSTR szCommand, LPCSTR szArgs, LPCSTR szDirectory, int nShowCmd, bool noErrorMsgs)
Definition BBApi.cpp:1648
#define BB_ACTIVETASK
Definition BBApi.h:198
#define TASKITEM_ACTIVATED
Definition BBApi.h:288
#define BB_TOGGLEPLUGINS
Definition BBApi.h:167
#define TASKITEM_MODIFIED
Definition BBApi.h:287
#define TASKITEM_ADDED
Definition BBApi.h:286
#define BB_MENU
Definition BBApi.h:160
#define BB_RECONFIGURE
Definition BBApi.h:147
#define BB_ADDTASK
Definition BBApi.h:195
#define BB_REDRAW
Definition BBApi.h:200
#define TASKITEM_FLASHED
Definition BBApi.h:291
#define BB_WORKSPACE
Definition BBApi.h:183
#define TASKITEM_REFRESH
Definition BBApi.h:290
#define TASKITEM_REMOVED
Definition BBApi.h:289
#define BB_TOGGLESYSTEMBAR
Definition BBApi.h:163
#define BB_ACTIVATESHELLWINDOW
Definition BBApi.h:197
#define BB_REMOVETASK
Definition BBApi.h:196
#define BB_TOGGLEDOCK
Definition BBApi.h:170
#define BB_TASKSUPDATE
Definition BBApi.h:187
#define BB_TOGGLETOOLBAR
Definition BBApi.h:171
Toolbar * pToolbar
Definition Blackbox.cpp:48
#define GET_Y_LPARAM(lp)
Definition Menu.h:60
#define GET_X_LPARAM(lp)
Definition Menu.h:56
#define PLACEMENT_MANUAL
Definition Settings.h:67
#define TOOLBAR_THROTTLE_UPDATES_TIMER
Definition Toolbar.h:52
void UpdateDesktopWindow()
Definition Desktop.cpp:315
bool Hide(int index=0)
Definition MenuCommon.cpp:1028
char toolbarUpButtonOverride[MAX_LINE_LENGTH]
Definition Settings.h:211
char preferredEditor[MAX_LINE_LENGTH]
Definition Settings.h:341
char toolbarLeftButtonOverride[MAX_LINE_LENGTH]
Definition Settings.h:212
char xobrcDefaultFile[MAX_LINE_LENGTH]
Definition Settings.h:406
char toolbarRightButtonOverride[MAX_LINE_LENGTH]
Definition Settings.h:213
char toolbarDownButtonOverride[MAX_LINE_LENGTH]
Definition Settings.h:210
int edgeSnapThreshold
Definition Settings.h:354
bool toolbarSnapToEdges
Definition Settings.h:194
int DropFiles(HWND hwnd, WPARAM wParam, bool checkTaskbarDrop)
Definition Taskbar.cpp:565
int GetActiveTask()
Definition Taskbar.cpp:402
int FindTask(HWND window)
Definition Taskbar.cpp:255
void AddTask(HWND newWindow)
Definition Taskbar.cpp:117
void ActivateShellWindow()
Definition Taskbar.cpp:484
bool MouseButtonOnTaskbar(HWND hwnd, unsigned int message, WPARAM wParam, LPARAM lParam)
Definition Taskbar.cpp:580
void SetActiveTask(HWND activeWindow)
Definition Taskbar.cpp:293
int FindLastVisible(int offset)
Definition Taskbar.cpp:1567
void RemoveTask(HWND oldWindow)
Definition Taskbar.cpp:217
int FindFirstVisible()
Definition Taskbar.cpp:1550
vector< taskListItem * > taskList
Definition Taskbar.h:148
int taskButtonsOffset
Definition Taskbar.h:142
void RedrawTask(HWND window)
Definition Taskbar.cpp:429
void ToolbarModeButtonPressed(bool nextMode)
Definition Toolbar.cpp:2041
int rcx
Definition Settings.h:90
int rcy
Definition Settings.h:91

Member Data Documentation

◆ hToolbarInstance

HINSTANCE Toolbar::hToolbarInstance

◆ hBlackboxWnd

HWND Toolbar::hBlackboxWnd

◆ hToolbarWnd

HWND Toolbar::hToolbarWnd

◆ tbBitmap

HBITMAP Toolbar::tbBitmap

◆ ScreenWidth

int Toolbar::ScreenWidth

◆ ScreenHeight

int Toolbar::ScreenHeight

◆ ToolbarX

int Toolbar::ToolbarX

◆ ToolbarY

int Toolbar::ToolbarY

◆ ToolbarWidth

int Toolbar::ToolbarWidth

◆ ToolbarHeight

int Toolbar::ToolbarHeight

◆ ButtonPressed1

bool Toolbar::ButtonPressed1

◆ ButtonPressed2

bool Toolbar::ButtonPressed2

◆ ButtonPressed3

bool Toolbar::ButtonPressed3

◆ ButtonPressed4

bool Toolbar::ButtonPressed4

◆ tbLabelX

int Toolbar::tbLabelX

◆ tbLabelY

int Toolbar::tbLabelY

◆ tbLabelW

int Toolbar::tbLabelW

◆ tbLabelH

int Toolbar::tbLabelH

◆ tbWinLabelX

int Toolbar::tbWinLabelX

◆ tbWinLabelY

int Toolbar::tbWinLabelY

◆ tbWinLabelW

int Toolbar::tbWinLabelW

◆ tbWinLabelH

int Toolbar::tbWinLabelH

◆ tbClockX

int Toolbar::tbClockX

◆ tbClockY

int Toolbar::tbClockY

◆ tbClockW

int Toolbar::tbClockW

◆ tbClockH

int Toolbar::tbClockH

◆ labelRect

RECT Toolbar::labelRect

◆ winlabelRect

RECT Toolbar::winlabelRect

◆ clockRect

RECT Toolbar::clockRect

◆ tbButtonX1

int Toolbar::tbButtonX1

◆ tbButtonX2

int Toolbar::tbButtonX2

◆ tbButtonX3

int Toolbar::tbButtonX3

◆ tbButtonX4

int Toolbar::tbButtonX4

◆ tbButtonY

int Toolbar::tbButtonY

◆ tbButtonWH

int Toolbar::tbButtonWH

◆ button1Rect

RECT Toolbar::button1Rect

◆ button2Rect

RECT Toolbar::button2Rect

◆ button3Rect

RECT Toolbar::button3Rect

◆ button4Rect

RECT Toolbar::button4Rect

◆ ToolbarPosInProgress

bool Toolbar::ToolbarPosInProgress

◆ ToolbarWorkspaceName

char Toolbar::ToolbarWorkspaceName[MAX_LINE_LENGTH]

◆ CurrentWindow

wchar_t Toolbar::CurrentWindow[MAX_LINE_LENGTH]

◆ CurrentTime

wchar_t Toolbar::CurrentTime[MAX_LINE_LENGTH]

◆ systemTime

time_t Toolbar::systemTime

◆ localTime

struct tm Toolbar::localTime

◆ currentMinute

int Toolbar::currentMinute

◆ displayedMinute

int Toolbar::displayedMinute

◆ clockTimerCounter

int Toolbar::clockTimerCounter

◆ temp

char Toolbar::temp[MAX_LINE_LENGTH]

◆ saveWidthAfterDelay

bool Toolbar::saveWidthAfterDelay

◆ throttlingAddRemoveUpdates

bool Toolbar::throttlingAddRemoveUpdates

◆ throttlingActivityUpdates

bool Toolbar::throttlingActivityUpdates

◆ updatesThrottled

bool Toolbar::updatesThrottled

◆ toolbarVerticalPeeking

bool Toolbar::toolbarVerticalPeeking

◆ origDesktopArea

RECT Toolbar::origDesktopArea

◆ cachedBackground

HDC Toolbar::cachedBackground

◆ cachedToolbarButton

HDC Toolbar::cachedToolbarButton

◆ cachedToolbarButtonPressed

HDC Toolbar::cachedToolbarButtonPressed

◆ cachedBitmapsExist

bool Toolbar::cachedBitmapsExist

◆ cachedToolbarWindowLabel

HDC Toolbar::cachedToolbarWindowLabel

◆ currentWindowLabelRect

RECT Toolbar::currentWindowLabelRect

◆ currentWindowLabelWidth

int Toolbar::currentWindowLabelWidth

◆ currentWindowLabelHeight

int Toolbar::currentWindowLabelHeight

◆ thumbnail

HTHUMBNAIL Toolbar::thumbnail