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

#include <Dock.h>

Public Member Functions

 Dock (HINSTANCE hInstance)
 
 ~Dock ()
 
void UpdateDockWindow ()
 
void UpdatePosition ()
 
void ReconfigureLock (bool enable)
 
void ToggleAlwaysOnTop ()
 
bool CheckIfMouseHover ()
 

Public Attributes

HINSTANCE hDockInstance
 
HWND hDockWnd
 
HWND hBlackboxWnd
 
int DockX
 
int DockY
 
int DockWidth
 
int DockHeight
 
HDC cachedBackground
 
bool cachedBackgroundExists
 
bool reconfigureLock
 
bool positioningInProgress
 
DockPluginsVector DockPlugins
 
vector< dockPluginItem >::iterator plugin
 
vector< dockPluginItem >::iterator member
 
vector< dockPluginItem >::iterator firstInGroup
 
vector< dockPluginItem >::iterator lastInGroup
 

Friends

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

Constructor & Destructor Documentation

◆ Dock()

Dock::Dock ( HINSTANCE hInstance)
48{
49 hDockWnd = NULL;
51 hDockInstance = hInstance;
52
53 cachedBackground = CreateCompatibleDC(NULL);
55
58
59 //====================
60
61 // Register window class...
62 WNDCLASS wc;
63 ZeroMemory(&wc,sizeof(wc));
64 wc.hInstance = hDockInstance;
65 wc.lpfnWndProc = DockWndProc; // window procedure
66 wc.lpszClassName = szDockName; // window class name
67 wc.hbrBackground = NULL; // no class background brush
68 wc.style = CS_DBLCLKS; // class styles (e.g. to accept doubleclicks)
69 wc.hCursor = LoadCursor(NULL, IDC_ARROW); // always display the regular arrow cursor
70
71 if (!RegisterClass(&wc))
72 {
73 MessageBox(0, "Error registering dock window class!", szDockName, MB_OK | MB_ICONERROR | MB_TOPMOST);
74 Log("Dock", "Error registering window class!");
75 return;
76 }
77
78 // Create dock window...
79 hDockWnd = CreateWindowEx(
80 WS_EX_TOOLWINDOW | WS_EX_ACCEPTFILES, // window style
81 szDockName, // window class
82 NULL, // window name
83 WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, // window parameters
84 DockX, // x position
85 DockY, // y position
86 0, // window width
87 0, // window height
88 hBlackboxWnd, // owner window
89 NULL, // no menu
90 hDockInstance, // hInstance
91 NULL // no window creation data
92 );
93
94 if (!hDockWnd)
95 {
96 UnregisterClass(szDockName, hDockInstance); // unregister window class
97 MessageBox(0, "Error creating dock window!", szDockName, MB_OK | MB_ICONERROR | MB_TOPMOST);
98 Log("Dock", "Error creating window!");
99 return;
100 }
101
102 //====================
103
104 // Subscribe to Blackbox messages applicable to the dock...
105 SendMessage(hBlackboxWnd, BB_REGISTERMESSAGE, (WPARAM)hDockWnd, (LPARAM)dockMessageSubscription);
106
107 // Make the dock window sticky...
109
110 // After a short locking interval to allow plugins to dock first,
111 // we show+update or hide the dock window as applicable...
112 // (nb. here this includes setting its z-order, window transparency, etc)
113 ReconfigureLock(true);
114}
void MakeSticky(HWND window)
Definition BBApi.cpp:2965
void Log(LPCSTR des, LPCSTR line)
Definition BBApi.cpp:638
HWND GetBBWnd()
Definition BBApi.cpp:128
#define BB_REGISTERMESSAGE
Definition BBApi.h:142
int dockMessageSubscription[]
Definition Dock.cpp:43
const char szDockName[]
Definition Dock.cpp:34
HWND hBlackboxWnd
Definition Dock.h:87
int DockWidth
Definition Dock.h:89
HDC cachedBackground
Definition Dock.h:91
int DockHeight
Definition Dock.h:89
int DockX
Definition Dock.h:89
HWND hDockWnd
Definition Dock.h:86
bool reconfigureLock
Definition Dock.h:94
int DockY
Definition Dock.h:89
bool cachedBackgroundExists
Definition Dock.h:92
bool positioningInProgress
Definition Dock.h:95
void ReconfigureLock(bool enable)
Definition Dock.cpp:718
friend LRESULT CALLBACK DockWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition Dock.cpp:133
HINSTANCE hDockInstance
Definition Dock.h:85

◆ ~Dock()

Dock::~Dock ( )
119{
121
122 // Unsubscribe to previously subscribed Blackbox messages...
124
125 DestroyWindow(hDockWnd); // Destroy window...
126 UnregisterClass(szDockName, hDockInstance); // Unregister window class...
127
128 DeleteDC(cachedBackground); // Delete cached bitmaps...
129}
#define BB_UNREGISTERMESSAGE
Definition BBApi.h:143
#define DOCK_RECONFIGURE_LOCK_TIMER
Definition Dock.h:52

Member Function Documentation

◆ UpdateDockWindow()

void Dock::UpdateDockWindow ( )
447{
448 if (reconfigureLock) return; // Is the reconfigure lock enabled?
449
450 //====================
451
452 if (pSettings->dockHidden) // The dock is currently hidden, so no need to update its window...
453 {
454 DockWidth = DockHeight = 10; // Safeguard
455 ShowWindow(hDockWnd, SW_HIDE);
456 }
457
458 //====================
459
460 else // The dock is currently visible, so we need to update its window...
461 {
462 if (DockPlugins.size() > 0) // Any plugins currently docked?
463 {
464 RECT r = {0, 0, 0, 0};
465 int maxwidth = 0, maxheight = 0;
466
467 //====================
468
469 // Scan through the plugin list and calculate
470 // the maximum plugin width and height...
471 for (plugin = DockPlugins.begin(); plugin != DockPlugins.end(); plugin++)
472 {
473 if (IsWindow(plugin->hwndPlugin)) // Check if the window is valid...
474 {
475 GetWindowRect(plugin->hwndPlugin, &r);
476
477 plugin->width = r.right - r.left;
478 plugin->height = r.bottom - r.top;
479
480 if (plugin->width > maxwidth) maxwidth = plugin->width;
481 if (plugin->height > maxheight) maxheight = plugin->height;
482 }
483 else // ...if not, we remove it from the list...
484 {
485 DockPlugins.erase(plugin);
486 plugin--;
487 }
488 }
489
490 //====================
491
492 int padding = pSettings->Dock->marginWidth;
493 if (padding < 2) padding = 2;
494 int xpad, ypad;
495 int offset = pSettings->Dock->borderWidth + padding + 1;
496 int tempX = offset;
497 int tempY = offset;
498 int totalGroupWidth = 0, totalGroupHeight = 0;
499 int maxwidthWithPadding = maxwidth + padding;
500 int maxheightWithPadding = maxheight + padding;
501 int maxwidthInGroup = 0, maxheightInGroup = 0;
502
503 //====================
504
505 // "Puzzle positioning" == Automatic positioning of plugins within the dock...
507 {
509
510 for (plugin = DockPlugins.begin(); plugin != DockPlugins.end(); plugin++)
511 {
512 if (pSettings->dockVertical) // Vertical dock alignment
513 {
514 totalGroupWidth = tempX + plugin->width + padding;
515
516 if (totalGroupWidth > maxwidthWithPadding)
517 {
518 if (firstInGroup->width != maxwidth)
519 {
520 xpad = ((maxwidth - tempX) / 2) + pSettings->Dock->borderWidth + padding;
521
523 {
524 if (member->height == maxheightInGroup) ypad = 0;
525 else ypad = (maxheightInGroup - member->height) / 2;
526
527 member->x += xpad;
528 member->y += ypad;
529 }
530 }
531
532 tempX = offset;
533 if (plugin != DockPlugins.begin()) tempY = tempY + maxheightInGroup + padding;
534 totalGroupWidth = offset + plugin->width + padding;
535 totalGroupHeight = offset + plugin->height + padding;
536
537 maxwidthInGroup = maxheightInGroup = 0;
539 }
540 }
541 else // Horizontal dock alignment
542 {
543 totalGroupHeight = tempY + plugin->height + padding;
544
545 if (totalGroupHeight > maxheightWithPadding)
546 {
547 if (firstInGroup->height != maxheight)
548 {
549 ypad = ((maxheight - tempY) / 2) + pSettings->Dock->borderWidth + padding;
550
552 {
553 if (member->width == maxwidthInGroup) xpad = 0;
554 else xpad = (maxwidthInGroup - member->width) / 2;
555
556 member->x += xpad;
557 member->y += ypad;
558 }
559 }
560
561 if (plugin != DockPlugins.begin()) tempX = tempX + maxwidthInGroup + padding;
562 tempY = offset;
563 totalGroupWidth = offset + plugin->width + padding;
564 totalGroupHeight = offset + plugin->height + padding;
565
566 maxwidthInGroup = maxheightInGroup = 0;
568 }
569 }
570
571 plugin->x = tempX;
572 plugin->y = tempY;
574 if (plugin->width > maxwidthInGroup) maxwidthInGroup = plugin->width;
575 if (plugin->height > maxheightInGroup) maxheightInGroup = plugin->height;
576
577 if (pSettings->dockVertical) tempX = tempX + plugin->width + padding;
578 else tempY = tempY + plugin->height + padding;
579 }
580
581 // Finish alignment for the last group...
583 {
584 xpad = (maxwidth - tempX) / 2 + pSettings->Dock->borderWidth + padding;
585
587 {
588 if (member->height == maxheightInGroup) ypad = 0;
589 else ypad = (maxheightInGroup - member->height) / 2;
590
591 if (member->width != maxwidth) member->x += xpad;
592 member->y += ypad;
593 }
594 }
595 else
596 {
597 ypad = (maxheight - tempY) / 2 + pSettings->Dock->borderWidth + padding;
598
600 {
601 if (member->width == maxwidthInGroup) xpad = 0;
602 else xpad = (maxwidthInGroup - member->width) / 2;
603
604 member->x += xpad;
605 if (member->height != maxheight) member->y += ypad;
606 }
607 }
608
609 // Finally, we re-position the plugins...
610 for (plugin = DockPlugins.begin(); plugin != DockPlugins.end(); plugin++)
611 {
612 SetWindowPos(plugin->hwndPlugin, NULL, plugin->x, plugin->y, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
613 }
614 }
615
616 //====================
617
618 // Normal positioning == Plugins are placed in a single horizontal row / vertical column...
619 else
620 {
621 for (plugin = DockPlugins.begin(); plugin != DockPlugins.end(); plugin++)
622 {
624 {
625 // Calculate necessary padding to get a centered x position...
626 if (plugin->width == maxwidth) xpad = 0;
627 else xpad = (maxwidth - plugin->width) / 2;
628 SetWindowPos(plugin->hwndPlugin, NULL, (tempX + xpad), tempY, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
629 tempY = tempY + plugin->height + padding;
630 }
631 else
632 {
633 // Calculate necessary padding to get a centered y position...
634 if (plugin->height == maxheight) ypad = 0;
635 else ypad = (maxheight - plugin->height) / 2;
636 SetWindowPos(plugin->hwndPlugin, NULL, tempX, (tempY + ypad), 0, 0, SWP_NOZORDER | SWP_NOSIZE);
637 tempX = tempX + plugin->width + padding;
638 }
639 }
640 }
641
642 //====================
643
644 // Finally, we resize the dimensions of the dock to fit all the plugins...
646 {
647 DockWidth = maxwidth + (offset * 2);
648 if (pSettings->dockPuzzlePositioning) DockHeight = tempY + maxheightInGroup + offset;
649 else DockHeight = tempY - padding + offset;
650 }
651 else
652 {
653 if (pSettings->dockPuzzlePositioning) DockWidth = tempX + maxwidthInGroup + offset;
654 else DockWidth = tempX - padding + offset;
655 DockHeight = maxheight + (offset * 2);
656 }
657 }
658
659 //====================
660
661 else // No plugins are currently docked, so we'll display a <Dock> tag instead; let's make room for it...
662 {
663 SIZE size;
664 HDC fonthdc = CreateDC("DISPLAY", NULL, NULL, NULL);
665 HFONT font = CreateFont(pSettings->Dock->FontHeight, 0, 0, 0, pSettings->Dock->FontWeight, false, false, false, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, pSettings->Dock->Font);
666 HGDIOBJ oldfont = SelectObject(fonthdc, font);
667 GetTextExtentPoint32(fonthdc, "---", strlen("---"), &size);
669 DockHeight = size.cy + (pSettings->Dock->marginWidth * 2) + (pSettings->Dock->borderWidth * 2);
670 DeleteObject(SelectObject(fonthdc, oldfont));
671 DeleteDC(fonthdc);
672 }
673
674 //====================
675
676 ShowWindow(hDockWnd, SW_SHOWNOACTIVATE);
678 }
679}
Settings * pSettings
Definition Blackbox.cpp:46
vector< dockPluginItem >::iterator member
Definition Dock.h:98
void UpdatePosition()
Definition Dock.cpp:683
vector< dockPluginItem >::iterator firstInGroup
Definition Dock.h:98
vector< dockPluginItem >::iterator lastInGroup
Definition Dock.h:98
vector< dockPluginItem >::iterator plugin
Definition Dock.h:98
DockPluginsVector DockPlugins
Definition Dock.h:97
bool dockHidden
Definition Settings.h:230
bool dockVertical
Definition Settings.h:234
StyleItem * Dock
Definition Settings.h:444
bool dockPuzzlePositioning
Definition Settings.h:235
int borderWidth
Definition BBApi.h:417
int FontWeight
Definition BBApi.h:410
int marginWidth
Definition BBApi.h:416
int FontHeight
Definition BBApi.h:409
char Font[128]
Definition BBApi.h:413

◆ UpdatePosition()

void Dock::UpdatePosition ( )
684{
685 // Update the dock window position...
691
692 // Force re-rendering of the background bitmap...
694
695 // Resize the dock window, move it to its new position, and request a WM_PAINT repaint...
696 // (nb. the dock window is *not* a DWM layered window like most other xoblite core windows)
697 MoveWindow(hDockWnd, DockX, DockY, DockWidth, DockHeight, false);
698 InvalidateRect(hDockWnd, NULL, false);
699
700 // Set the dock window transparency... (nb. the dock window is *not* a DWM layered window and hence only supports window transparency, not per pixel alpha etc)
701// SetTransparency(hDockWnd, pSettings->dockTransparencyAlpha);
704
705 // Set the dock window z-order position... (regular or always on top)
706 if (pSettings->dockOnTop) SetWindowPos(hDockWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE);
707 else SetWindowPos(hDockWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE);
708
709 // Finally, we ask all docked plugins to repaint their windows (i.e. the child windows of the dock window) too...
710 for (plugin = DockPlugins.begin(); plugin != DockPlugins.end(); plugin++)
711 {
712 if (IsWindow(plugin->hwndPlugin)) InvalidateRect(plugin->hwndPlugin, NULL, false);
713 }
714}
bool SetTransparency(HWND hwnd, BYTE alpha)
Definition BBApi.cpp:3068
bool dockOnTop
Definition Settings.h:236
void PositionFromPlacement(Placement *inputPlacement)
Definition Settings.cpp:3236
Placement DockPlacement
Definition Settings.h:231
BYTE dockTransparencyAlpha
Definition Settings.h:238
int height
Definition Settings.h:97
int width
Definition Settings.h:96
int x
Definition Settings.h:94
int y
Definition Settings.h:95

◆ ReconfigureLock()

void Dock::ReconfigureLock ( bool enable)
719{
720 if (enable)
721 {
722 if (!SetTimer(hDockWnd, DOCK_RECONFIGURE_LOCK_TIMER, 300, (TIMERPROC)NULL))
723 {
724 MessageBox(GetBBWnd(), "Error creating reconfigure lock timer!", szDockName, MB_OK | MB_ICONERROR | MB_TOPMOST);
725 Log("Dock", "Error creating reconfigure lock timer!");
726 return;
727 }
728 reconfigureLock = true;
729 ShowWindow(hDockWnd, SW_HIDE); // Hide the window to "hide" any display artifacts while updating all plugins...
730 }
731 else
732 {
734 pDock->reconfigureLock = false;
736 }
737}
Dock * pDock
Definition Blackbox.cpp:38
void UpdateDockWindow()
Definition Dock.cpp:446

◆ ToggleAlwaysOnTop()

void Dock::ToggleAlwaysOnTop ( )
742{
743 if (!pSettings->dockOnTop)
744 {
745 pSettings->dockOnTop = true;
746 SetWindowPos(hDockWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE);
747 }
748 else
749 {
750 pSettings->dockOnTop = false;
751 SetWindowPos(hDockWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE);
752 }
753
754 WriteBool(pSettings->xobrcFile, "xoblite.dock.onTop:", pSettings->dockOnTop);
755}
void WriteBool(LPCSTR fp, LPCSTR keyword, bool value)
Definition BBApi.cpp:3131
char xobrcFile[MAX_LINE_LENGTH]
Definition Settings.h:405

◆ CheckIfMouseHover()

bool Dock::CheckIfMouseHover ( )
760{
761 POINT mousepos;
762 GetCursorPos(&mousepos);
763 if (mousepos.x >= DockX && mousepos.x <= (DockX + DockWidth))
764 {
765 if (mousepos.y >= DockY && mousepos.y <= (DockY + DockHeight)) return true;
766 }
767
768 return false;
769}

Friends And Related Symbol Documentation

◆ DockWndProc

LRESULT CALLBACK DockWndProc ( HWND hwnd,
UINT message,
WPARAM wParam,
LPARAM lParam )
friend
134{
135 switch (message)
136 {
137 //====================
138
139 case WM_PAINT:
140 {
141 PAINTSTRUCT ps;
142 HDC hdc = BeginPaint(pDock->hDockWnd, &ps);
143
144 // If we have not yet created a cached background, let's do that...
146 {
147
148 HBITMAP tempBitmap = CreateCompatibleBitmap(hdc, pDock->DockWidth, pDock->DockHeight);
149 DeleteObject(SelectObject(pDock->cachedBackground, tempBitmap));
150
151 // Draw dock background... (nb. as per the current style+settings if the dock is not empty, highly transparent black with white --- tag if the dock is empty)
152 RECT r;
153 GetClientRect(hwnd, &r);
154 if (pDock->DockPlugins.size() > 0)
155 {
158
160 {
162 }
163 }
164 else
165 {
166 MakeGradientSuper(pDock->cachedBackground, r, B_SOLID, 0x000000, 0, 0, 0, 0, 0, 0, 0, false, BEVEL_FLAT, 0, 0, 0, 0);
167 HFONT font = CreateFont(pSettings->Dock->FontHeight, 0, 0, 0, pSettings->Dock->FontWeight, false, false, false, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, pSettings->Dock->Font);
168 HGDIOBJ oldfont = SelectObject(pDock->cachedBackground, font);
169 SetBkMode(pDock->cachedBackground, TRANSPARENT);
170 DrawTextWithEffects(pDock->cachedBackground, r, "---", DT_CENTER | DT_VCENTER | DT_NOPREFIX | DT_SINGLELINE | DT_WORD_ELLIPSIS, 0xffffff, false, 0, false, 0, 0, 0);
171 DeleteObject(SelectObject(pDock->cachedBackground, oldfont));
172 }
173
174 DeleteObject(tempBitmap);
175
176 // Set the "cached background created" indicator...
178 }
179
180 // Copy the cached background into the dock window HDC...
181 BitBlt(hdc, ps.rcPaint.left, ps.rcPaint.top, (ps.rcPaint.right - ps.rcPaint.left), (ps.rcPaint.bottom - ps.rcPaint.top), pDock->cachedBackground, ps.rcPaint.left, ps.rcPaint.top, SRCCOPY);
182
183 EndPaint(pDock->hDockWnd, &ps);
184 }
185 break;
186
187 //====================
188
189 case WM_CLOSE:
190 return 0;
191
192 //====================
193
194 case BB_RECONFIGURE:
195 {
196 // NOTE: When only need to do this if the dock is *empty*, since any docked plugins
197 // will send SLIT_UPDATE which will in turn invalidate the parent dock window...
198 if (pDock->DockPlugins.size() == 0) pDock->UpdateDockWindow();
199 }
200 break;
201
202 //====================
203
204 case WM_DISPLAYCHANGE:
205 {
206 // Update the dock's position if the screen resolution changes...
208 }
209 break;
210
211 case WM_SETTINGCHANGE:
212 {
213 // Update the dock's position if the work area changes...
214 // (e.g. if the Explorer taskbar is moved to another screen edge)
215 if (wParam == SPI_SETWORKAREA) pDock->UpdatePosition();
216 return 0;
217 }
218
219 //====================
220
221 case DOCK_ADD: // -> A plugin is being docked... (added to the dock)
222 {
223 if (IsWindow((HWND)lParam))
224 {
225 dockPluginItem plugin;
226 plugin.hwndPlugin = (HWND)lParam;
227 pDock->DockPlugins.push_back(plugin);
228
229 SetWindowLongPtr((HWND)lParam, GWL_STYLE, (GetWindowLongPtr((HWND)lParam, GWL_STYLE) & ~WS_POPUP) | WS_CHILD);
230 SetParent((HWND)lParam, pDock->hDockWnd);
231 }
232
234 }
235 break;
236
237 //====================
238
239 case DOCK_REMOVE: // -> A plugin is being undocked... (removed from the dock)
240 {
241 vector<dockPluginItem>::iterator dockPlugin;
242
243 for (dockPlugin = pDock->DockPlugins.begin(); dockPlugin != pDock->DockPlugins.end(); dockPlugin++)
244 {
245 if (dockPlugin->hwndPlugin == (HWND)lParam)
246 {
247 if (IsWindow((HWND)lParam))
248 {
249 SetWindowLongPtr((HWND)lParam, GWL_STYLE, (GetWindowLongPtr((HWND)lParam, GWL_STYLE) & ~WS_CHILD) | WS_POPUP);
250 SetParent((HWND)lParam, NULL);
251 }
252
253 pDock->DockPlugins.erase(dockPlugin);
254
255 break;
256 }
257 }
258
260 }
261 break;
262
263 //====================
264
265 case DOCK_UPDATE: // -> Update the dock window...
266 {
268 }
269 break;
270
271 //====================
272
273 case BB_TOGGLEDOCK: // -> Toggle the dock shown/hidden...
274 {
276 else pSettings->dockHidden = false;
279 WriteBool(pSettings->xobrcFile, "xoblite.dock.hidden:", pSettings->dockHidden);
280 }
281 break;
282
283 //====================
284
285 case WM_NCHITTEST:
286 {
287 POINT p;
288 GetCursorPos(&p);
289 RECT r;
290 GetWindowRect(pDock->hDockWnd, &r);
291 pDock->DockX = r.left;
292 pDock->DockY = r.top;
293
294 p.x = p.x - pDock->DockX;
295 p.y = p.y - pDock->DockY;
296
297 // Allow mouse drag manual positioning if we're not hovering over
298 // a child (plugin) window, and the control key is being held down...
299 if (ChildWindowFromPoint(pDock->hDockWnd, p) == pDock->hDockWnd)
300 {
301 if (GetAsyncKeyState(VK_CONTROL) & 0x8000)
302 {
304 return HTCAPTION;
305 }
306 }
307
308 return HTCLIENT;
309 }
310
311 //====================
312
313 case WM_LBUTTONUP:
314 {
316 return 0;
317 }
318
319 case WM_LBUTTONDOWN: {} break;
320
321 //====================
322
323 case WM_RBUTTONUP:
324 case WM_NCRBUTTONUP:
325 {
326 if (GetAsyncKeyState(VK_CONTROL) & 0x8000) SendMessage(GetBBWnd(), BB_MENU, 0, 0); // Ctrl+RightClick -> Main menu
327 else if (GetAsyncKeyState(VK_MENU) & 0x8000) SendMessage(GetBBWnd(), BB_MENU, 0, 0); // Alt+RightClick -> Main menu
328 else SendMessage(GetBBWnd(), BB_MENU, 2, 0); // RightClick without modifiers -> Configuration menu
329 return 0;
330 }
331
332 case WM_RBUTTONDOWN:
333 case WM_NCRBUTTONDOWN: {} break;
334
335 //====================
336
337 case WM_MBUTTONUP:
338 case WM_NCMBUTTONUP:
339 {
340 if (GetAsyncKeyState(VK_CONTROL) & 0x8000) PostMessage(GetBBWnd(), BB_TOGGLEPLUGINS, 0, 0); // Ctrl+MidClick -> Toggle plugins
341 else if (GetAsyncKeyState(VK_MENU) & 0x8000) PostMessage(GetBBWnd(), BB_TOGGLEPLUGINS, 0, 0); // Alt+MidClick -> Toggle plugins
342 else PostMessage(GetBBWnd(), BB_TOGGLETOOLBAR, 0, 0); // MidClick without modifiers -> Toggle toolbar
343 }
344 break;
345
346 case WM_MBUTTONDOWN:
347 case WM_NCMBUTTONDOWN: {} break;
348
349 //====================
350
351 case WM_XBUTTONDOWN:
352 {
353 if (HIWORD(wParam) == XBUTTON1) // X1 Click without modifiers -> Toggle dock orientation (horizontal/vertical)
354 {
356 else pSettings->dockVertical = true;
358 WriteBool(pSettings->xobrcFile, "xoblite.dock.vertical:", pSettings->dockVertical);
359 }
360 }
361 break;
362
363 //====================
364
365 case WM_MOUSEWHEEL:
366 case WM_MOUSEHWHEEL:
367 {
368 // Forward any mousewheel messages to the
369 // child plugin window beneath the mouse cursor...
370 POINT p;
371 GetCursorPos(&p);
372 p.x = p.x - pDock->DockX;
373 p.y = p.y - pDock->DockY;
374 HWND pluginWnd = ChildWindowFromPoint(pDock->hDockWnd, p);
375 if ((pluginWnd != NULL) && (pluginWnd != pDock->hDockWnd)) PostMessage(pluginWnd, message, (WPARAM)wParam, (LPARAM)lParam);
376 }
377 break;
378
379 //====================
380
381 case WM_DROPFILES:
382 {
383 return ParseDropFiles(hwnd, wParam); // -> Common handling of drag'n'drop events for all core UI elements
384 }
385 break;
386
387 //====================
388
389 case WM_WINDOWPOSCHANGING:
390 {
392 {
393 // Snap window to screen edges when in manual positioning mode?
395 {
396 if (IsWindowVisible(hwnd)) SnapWindowToEdge((WINDOWPOS*)lParam, pSettings->edgeSnapThreshold, true);
397 }
398 }
399 return 0;
400 }
401
402 //====================
403
404 case WM_EXITSIZEMOVE:
405 {
407 {
409
410 RECT r;
411 GetWindowRect(pDock->hDockWnd, &r);
415
417 }
418
419 return 0;
420 }
421
422 //====================
423
424 case WM_TIMER:
425 {
426 if (wParam == DOCK_RECONFIGURE_LOCK_TIMER)
427 {
428 pDock->ReconfigureLock(false);
429 return 0;
430 }
431 }
432 break;
433
434 //====================
435
436 default:
437 return DefWindowProc(hwnd,message,wParam,lParam);
438
439 //====================
440 }
441 return 0;
442}
int ParseDropFiles(HWND hwnd, WPARAM wParam)
Definition BBApi.cpp:3381
void DrawImageIntoRect(HDC hdc, RECT r, StyleItem *styleItem, bool useAlpha, bool drawBorder)
Definition BBApi.cpp:2333
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
MenuCommon * pMenuCommon
Definition Blackbox.cpp:41
void SnapWindowToEdge(WINDOWPOS *pwPos, int nDist, bool bUseScreenSize)
Definition BBApi.cpp:1970
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
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
#define DOCK_ADD
Definition BBApi.h:251
#define B_SOLID
Definition BBApi.h:80
#define DOCK_UPDATE
Definition BBApi.h:253
#define BB_TOGGLEPLUGINS
Definition BBApi.h:167
#define BB_MENU
Definition BBApi.h:160
#define BB_RECONFIGURE
Definition BBApi.h:147
#define BEVEL_FLAT
Definition BBApi.h:105
#define DOCK_REMOVE
Definition BBApi.h:252
#define B_IMAGEFROMFILE
Definition BBApi.h:83
#define BB_TOGGLEDOCK
Definition BBApi.h:170
#define BB_TOGGLETOOLBAR
Definition BBApi.h:171
#define PLACEMENT_MANUAL
Definition Settings.h:67
void PlaySoundFX(int sound)
Definition Sounds.cpp:40
@ SFX_TOGGLE_ELEMENT
Definition Sounds.h:48
bool Hide(int index=0)
Definition MenuCommon.cpp:1028
bool dockSnapToEdges
Definition Settings.h:237
int bevelWidth
Definition Settings.h:564
StyleItem * DockBorder
Definition Settings.h:445
void WritePlacement(Placement *inputPlacement)
Definition Settings.cpp:3436
int edgeSnapThreshold
Definition Settings.h:354
int placement
Definition Settings.h:89
int rcx
Definition Settings.h:90
int rcy
Definition Settings.h:91
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 Color6
Definition BBApi.h:437
int type
Definition BBApi.h:402
int bevelposition
Definition BBApi.h:401
COLORREF Color7
Definition BBApi.h:438
COLORREF Color8
Definition BBApi.h:439
bool interlaced
Definition BBApi.h:404
COLORREF Color3
Definition BBApi.h:433
COLORREF borderColor
Definition BBApi.h:418

Member Data Documentation

◆ hDockInstance

HINSTANCE Dock::hDockInstance

◆ hDockWnd

HWND Dock::hDockWnd

◆ hBlackboxWnd

HWND Dock::hBlackboxWnd

◆ DockX

int Dock::DockX

◆ DockY

int Dock::DockY

◆ DockWidth

int Dock::DockWidth

◆ DockHeight

int Dock::DockHeight

◆ cachedBackground

HDC Dock::cachedBackground

◆ cachedBackgroundExists

bool Dock::cachedBackgroundExists

◆ reconfigureLock

bool Dock::reconfigureLock

◆ positioningInProgress

bool Dock::positioningInProgress

◆ DockPlugins

DockPluginsVector Dock::DockPlugins

◆ plugin

vector<dockPluginItem>::iterator Dock::plugin

◆ member

vector<dockPluginItem>::iterator Dock::member

◆ firstInGroup

vector<dockPluginItem>::iterator Dock::firstInGroup

◆ lastInGroup

vector<dockPluginItem>::iterator Dock::lastInGroup