ReactOS  0.4.14-dev-115-g4576127
tooldock.c File Reference
#include <precomp.h>
Include dependency graph for tooldock.c:

Go to the source code of this file.

Classes

struct  _TOOLDOCKWND_INIT
 

Macros

#define GWLP_TBDOCKS   0
 
#define GWLP_DOCKITEM   (GWLP_TBDOCKS + sizeof(PTOOLBAR_DOCKS))
 
#define TD_EXTRA_BYTES   (GWLP_DOCKITEM + sizeof(PDOCKBAR_ITEM))
 

Typedefs

typedef struct _TOOLDOCKWND_INIT TOOLDOCKWND_INIT
 
typedef struct _TOOLDOCKWND_INITPTOOLDOCKWND_INIT
 

Functions

static UINT TbdCalculateInsertIndex (PTOOLBAR_DOCKS TbDocks, DOCK_POSITION Position, POINT pt)
 
INT TbdAdjustUpdateClientRect (PTOOLBAR_DOCKS TbDocks, PRECT rcClient)
 
HDWP TbdDeferDocks (HDWP hWinPosInfo, PTOOLBAR_DOCKS TbDocks)
 
static PDOCKBAR_ITEM TbnDockbarItemFromBandId (PTOOLBAR_DOCKS TbDocks, DOCK_POSITION Position, UINT uBand)
 
static VOID TbnRebarChangeSize (PTOOLBAR_DOCKS TbDocks, DOCK_POSITION Position)
 
static VOID TbnRebarChevronPushed (PTOOLBAR_DOCKS TbDocks, DOCK_POSITION Position, LPNMREBARCHEVRON lpnm)
 
static LRESULT TbnRebarBeginDrag (PTOOLBAR_DOCKS TbDocks, DOCK_POSITION Position, LPNMREBAR lpnmrb)
 
static VOID TbnRebarEndDrag (PTOOLBAR_DOCKS TbDocks, DOCK_POSITION Position, LPNMREBAR lpnmrb)
 
BOOL TbdDockBarIdFromClientWindow (PTOOLBAR_DOCKS TbDocks, HWND hWndClient, UINT *Id)
 
BOOL TbdHandleNotifications (PTOOLBAR_DOCKS TbDocks, LPNMHDR pnmh, LRESULT *Result)
 
static BOOL TbdCreateToolbarWnd (PTOOLBAR_DOCKS TbDocks, PDOCKBAR_ITEM Item, DOCK_POSITION PrevPosition, UINT PrevBandIndex, LPREBARBANDINFO rbi, POINT pt, HWND hRebar, UINT uBand, BOOL Drag)
 
static BOOL TdbInsertToolbar (PTOOLBAR_DOCKS TbDocks, PDOCKBAR_ITEM Item, DOCK_POSITION Position)
 
BOOL TbdAddToolbar (PTOOLBAR_DOCKS TbDocks, const DOCKBAR *Dockbar, PVOID Context, const DOCKBAR_ITEM_CALLBACKS *Callbacks)
 
static LRESULT CALLBACK ToolDockWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static LRESULT CALLBACK RebarSubclassProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData)
 
VOID TbdHandleEnabling (PTOOLBAR_DOCKS TbDocks, HWND hWnd, BOOL Enable)
 
VOID TbdHandleActivation (PTOOLBAR_DOCKS TbDocks, HWND hWnd, WPARAM *wParam, LPARAM *lParam)
 
VOID TbdShowFloatingToolbars (PTOOLBAR_DOCKS TbDocks, BOOL Show)
 
VOID TbdInitializeDocks (PTOOLBAR_DOCKS TbDocks, HWND hWndParent, PVOID Context, PDOCKBAR_PARENTRESIZE ParentResizeProc)
 
BOOL TbdInitImpl (VOID)
 
VOID TbdUninitImpl (VOID)
 

Variables

static const TCHAR szToolDockWndClass [] = TEXT("ImageSoftToolDockWndClass")
 

Macro Definition Documentation

◆ GWLP_DOCKITEM

#define GWLP_DOCKITEM   (GWLP_TBDOCKS + sizeof(PTOOLBAR_DOCKS))

Definition at line 638 of file tooldock.c.

◆ GWLP_TBDOCKS

#define GWLP_TBDOCKS   0

Definition at line 637 of file tooldock.c.

◆ TD_EXTRA_BYTES

#define TD_EXTRA_BYTES   (GWLP_DOCKITEM + sizeof(PDOCKBAR_ITEM))

Definition at line 639 of file tooldock.c.

Typedef Documentation

◆ PTOOLDOCKWND_INIT

◆ TOOLDOCKWND_INIT

Function Documentation

◆ RebarSubclassProc()

static LRESULT CALLBACK RebarSubclassProc ( HWND  hWnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
UINT_PTR  uIdSubclass,
DWORD_PTR  dwRefData 
)
static

Definition at line 718 of file tooldock.c.

724 {
725  LRESULT Ret;
726 
727  Ret = DefSubclassProc(hWnd,
728  uMsg,
729  wParam,
730  lParam);
731 
732  if (uMsg == WM_MOUSEMOVE && (wParam & MK_LBUTTON))
733  {
734  DOCK_POSITION Position, DragTo = NO_DOCK;
735  RECT rcClient;
736  POINT pt;
738  SIZE szTearOff;
739 
740  szTearOff.cx = GetSystemMetrics(SM_CXCURSOR);
741  szTearOff.cy = GetSystemMetrics(SM_CYCURSOR);
742 
743  /*
744  * Check if we're dragging and if it's time to remove the band
745  */
746  if (TbDocks->Dragging != NULL && GetCapture() == hWnd)
747  {
749  &rcClient);
750  InflateRect(&rcClient,
751  szTearOff.cx,
752  szTearOff.cy);
753 
754  pt.x = GET_X_LPARAM(lParam);
755  pt.y = GET_Y_LPARAM(lParam);
756 
757  if (!PtInRect(&rcClient,
758  pt))
759  {
760  REBARBANDINFO rbi;
761  UINT uBand;
762  RECT rc;
763 
764  /* Save all rebar band information, don't query RBBIM_HEADERSIZE because it
765  seems to cause problems with toolbars*/
766  rbi.cbSize = sizeof(rbi);
770  rbi.lpText = TbDocks->szTempText;
771  rbi.cch = sizeof(TbDocks->szTempText);
772 
773  uBand = (UINT)SendMessage(hWnd,
774  RB_IDTOINDEX,
775  (WPARAM)TbDocks->DraggingBandId,
776  0);
777 
778  if (uBand != (UINT)-1 &&
781  (WPARAM)uBand,
782  (LPARAM)&rbi))
783  {
785  HWND_DESKTOP,
786  &pt,
787  1);
788 
789  /* Check if the user is trying to drag it into another dock */
791  {
792  if (TbDocks->hRebar[Position] != NULL &&
793  TbDocks->hRebar[Position] != hWnd &&
794  GetWindowRect(TbDocks->hRebar[Position],
795  &rc))
796  {
797  InflateRect(&rc,
798  szTearOff.cx,
799  szTearOff.cy);
800 
801  if (PtInRect(&rc,
802  pt))
803  {
804  DragTo = Position;
805  break;
806  }
807  }
808  }
809 
810  /* Get the current dock */
812  {
813  if (TbDocks->hRebar[Position] == hWnd)
814  {
815  break;
816  }
817  }
818 
819  ReleaseCapture();
820 
821  if (SendMessage(hWnd,
822  RB_SHOWBAND,
823  (WPARAM)uBand,
824  FALSE))
825  {
826  /* Change the parent to the new rebar control */
827  if (TbDocks->Dragging->hWndClient != NULL)
828  {
829  SetWindowPos(TbDocks->Dragging->hWndClient,
830  NULL,
831  0,
832  0,
833  0,
834  0,
836 
837  SetParent(TbDocks->Dragging->hWndClient,
838  TbDocks->hRebar[DragTo]);
839 
840  SetWindowPos(TbDocks->Dragging->hWndClient,
841  NULL,
842  0,
843  0,
844  0,
845  0,
847  }
848 
849  if (DragTo == NO_DOCK)
850  {
851  if (!TbdCreateToolbarWnd(TbDocks,
852  TbDocks->Dragging,
853  Position,
854  uBand,
855  &rbi,
856  pt,
857  hWnd,
858  uBand,
859  TRUE))
860  {
861  goto MoveFailed;
862  }
863  }
864  else
865  {
866  BOOL Moved = FALSE;
867 
868  /* Remove the band from the current rebar control */
869  if (SendMessage(hWnd,
871  (WPARAM)uBand,
872  0))
873  {
874  UINT uIndex;
875 
876  /* Calculate where to insert the new bar */
877  uIndex = TbdCalculateInsertIndex(TbDocks,
878  DragTo,
879  pt);
880 
881  SetActiveWindow(TbDocks->hRebar[DragTo]);
882 
883  TbDocks->Dragging->Callbacks->DockBand(TbDocks,
884  &TbDocks->Dragging->DockBar,
885  TbDocks->Dragging->Context,
886  Position,
887  DragTo,
888  &rbi);
889 
890  if (rbi.fMask & RBBIM_CHILD)
891  TbDocks->Dragging->hWndClient = rbi.hwndChild;
892  else
893  TbDocks->Dragging->hWndClient = NULL;
894 
895  /* Insert the toolbar into the new rebar */
896  rbi.fMask |= RBBIM_STYLE;
897  rbi.fStyle |= RBBS_HIDDEN;
898  if (SendMessage(TbDocks->hRebar[DragTo],
900  (WPARAM)uIndex,
901  (LPARAM)&rbi))
902  {
903  uBand = (UINT)SendMessage(TbDocks->hRebar[DragTo],
904  RB_IDTOINDEX,
905  (WPARAM)TbDocks->DraggingBandId,
906  0);
907 
908  SendMessage(TbDocks->hRebar[DragTo],
909  RB_SHOWBAND,
910  (WPARAM)uBand,
911  TRUE);
912 
913  /* Simulate a mouse click to continue dragging */
914  if (uBand != (UINT)-1 &&
915  TbDocks->Dragging->hWndClient != NULL &&
917  &rc))
918  {
919  switch (DragTo)
920  {
921  case LEFT_DOCK:
922  case RIGHT_DOCK:
923  pt.x = rc.left + ((rc.right - rc.left) / 2);
924  pt.y = rc.top - 1;
925  break;
926 
927  default:
928  pt.x = rc.left - 1;
929  pt.y = rc.top + ((rc.bottom - rc.top) / 2);
930  break;
931  }
932 
934  TbDocks->hRebar[DragTo],
935  &pt,
936  1);
937 
939 
940  SendMessage(TbDocks->hRebar[DragTo],
942  wParam,
943  MAKELPARAM(pt.x,
944  pt.y));
945 
946  Moved = TRUE;
947  }
948  }
949  }
950 
951  if (!Moved)
952  {
953 MoveFailed:
954  TbDocks->Dragging = NULL;
955 
957  RB_SHOWBAND,
958  (WPARAM)uBand,
959  TRUE);
960  }
961  }
962  }
963  }
964  }
965  }
966  }
967 
968  return Ret;
969 }
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
#define TRUE
Definition: types.h:120
#define RBBIM_CHILD
Definition: commctrl.h:1478
const DOCKBAR_ITEM_CALLBACKS * Callbacks
Definition: tooldock.h:65
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
#define WM_LBUTTONDOWN
Definition: winuser.h:1758
PDOCKBAR_DOCKBAND DockBand
Definition: tooldock.h:52
#define MK_LBUTTON
Definition: winuser.h:2342
#define RB_GETBANDINFO
Definition: commctrl.h:1584
#define pt(x, y)
Definition: drawing.c:79
HWND WINAPI SetParent(_In_ HWND, _In_opt_ HWND)
static COORD Position
Definition: mouse.c:34
_In_ SUBCLASSPROC _In_ UINT_PTR _In_ DWORD_PTR dwRefData
Definition: commctrl.h:5027
#define MAKELPARAM(l, h)
Definition: winuser.h:3947
UINT DraggingBandId
Definition: tooldock.h:83
HWND hWnd
Definition: settings.c:17
#define SM_CYCURSOR
Definition: winuser.h:965
LONG top
Definition: windef.h:292
#define GET_X_LPARAM(lp)
Definition: windowsx.h:274
#define RBBIM_ID
Definition: commctrl.h:1482
UINT_PTR WPARAM
Definition: windef.h:207
LONG left
Definition: windef.h:291
#define SWP_NOZORDER
Definition: winuser.h:1232
LONG right
Definition: windef.h:293
#define RBBIM_LPARAM
Definition: commctrl.h:1484
WPARAM wParam
Definition: combotst.c:138
#define RBBIM_IMAGE
Definition: commctrl.h:1477
#define SWP_HIDEWINDOW
Definition: winuser.h:1226
#define RBBIM_STYLE
Definition: commctrl.h:1474
#define RBBIM_SIZE
Definition: commctrl.h:1480
HWND WINAPI SetActiveWindow(_In_ HWND)
unsigned int BOOL
Definition: ntddk_ex.h:94
HWND WINAPI GetCapture(void)
Definition: message.c:2879
#define RB_INSERTBAND
Definition: commctrl.h:1574
smooth NULL
Definition: ftsmooth.c:416
HWND hWndClient
Definition: tooldock.h:62
LONG cx
Definition: windef.h:319
LONG_PTR LPARAM
Definition: windef.h:208
DOCK_POSITION
Definition: tooldock.h:2
LRESULT WINAPI DefSubclassProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: commctrl.c:1496
#define RBBIM_COLORS
Definition: commctrl.h:1475
#define REBARBANDINFO
Definition: commctrl.h:1541
#define RBBIM_TEXT
Definition: commctrl.h:1476
#define SM_CXCURSOR
Definition: winuser.h:964
int WINAPI GetSystemMetrics(_In_ int)
#define RBBIM_CHILDSIZE
Definition: commctrl.h:1479
#define RB_SHOWBAND
Definition: commctrl.h:1590
struct _TOOLBAR_DOCKS * PTOOLBAR_DOCKS
static UINT TbdCalculateInsertIndex(PTOOLBAR_DOCKS TbDocks, DOCK_POSITION Position, POINT pt)
Definition: tooldock.c:12
#define LoadCursor
Definition: winuser.h:5713
#define SWP_NOSIZE
Definition: winuser.h:1230
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
TCHAR szTempText[255]
Definition: tooldock.h:84
#define RBBS_HIDDEN
Definition: commctrl.h:1464
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
#define RB_IDTOINDEX
Definition: commctrl.h:1560
#define IDC_SIZEALL
Definition: winuser.h:691
#define HWND_DESKTOP
Definition: winuser.h:1195
unsigned int UINT
Definition: ndis.h:50
#define WM_MOUSEMOVE
Definition: winuser.h:1757
HWND hRebar[DOCKS_COUNT]
Definition: tooldock.h:77
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:275
BOOL WINAPI PtInRect(_In_ LPCRECT, _In_ POINT)
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2888
#define SendMessage
Definition: winuser.h:5744
#define RB_DELETEBAND
Definition: commctrl.h:1548
LONG bottom
Definition: windef.h:294
DOCKBAR DockBar
Definition: tooldock.h:59
#define SWP_NOMOVE
Definition: winuser.h:1229
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
LONG_PTR LRESULT
Definition: windef.h:209
static BOOL TbdCreateToolbarWnd(PTOOLBAR_DOCKS TbDocks, PDOCKBAR_ITEM Item, DOCK_POSITION PrevPosition, UINT PrevBandIndex, LPREBARBANDINFO rbi, POINT pt, HWND hRebar, UINT uBand, BOOL Drag)
Definition: tooldock.c:349
PVOID Context
Definition: tooldock.h:60
LONG cy
Definition: windef.h:320
LPARAM lParam
Definition: combotst.c:139
#define RBBIM_IDEALSIZE
Definition: commctrl.h:1483
PDOCKBAR_ITEM Dragging
Definition: tooldock.h:82
#define RBBIM_BACKGROUND
Definition: commctrl.h:1481

Referenced by TbdInitializeDocks().

◆ TbdAddToolbar()

BOOL TbdAddToolbar ( PTOOLBAR_DOCKS  TbDocks,
const DOCKBAR Dockbar,
PVOID  Context,
const DOCKBAR_ITEM_CALLBACKS Callbacks 
)

Definition at line 585 of file tooldock.c.

589 {
590  PDOCKBAR_ITEM Item;
591  HWND hRebar;
592 
593  hRebar = TbDocks->hRebar[Dockbar->Position];
594  if (hRebar != NULL)
595  {
596  Item = HeapAlloc(ProcessHeap,
597  0,
598  sizeof(DOCKBAR_ITEM));
599  if (Item != NULL)
600  {
601  /* Initialize the item */
602  Item->DockBar = *Dockbar;
603  Item->Context = Context;
604  Item->hWndTool = NULL;
605  Item->PrevDock = Dockbar->Position;
606 
607  Item->Callbacks = Callbacks;
608 
609  /* Create the client control */
610  if (Callbacks->CreateClient != NULL &&
611  !Callbacks->CreateClient(TbDocks,
612  &Item->DockBar,
613  Context,
614  hRebar,
615  &Item->hWndClient))
616  {
618  0,
619  Item);
620 
621  return FALSE;
622  }
623 
624  /* Insert the item into the list */
625  Item->Next = TbDocks->Items;
626  TbDocks->Items = Item;
627 
628  return TdbInsertToolbar(TbDocks,
629  Item,
630  Dockbar->Position);
631  }
632  }
633 
634  return FALSE;
635 }
DOCK_POSITION PrevDock
Definition: tooldock.h:63
const DOCKBAR_ITEM_CALLBACKS * Callbacks
Definition: tooldock.h:65
struct _DOCKBAR_ITEM * Next
Definition: tooldock.h:58
DOCK_POSITION Position
Definition: tooldock.h:16
smooth NULL
Definition: ftsmooth.c:416
HWND hWndClient
Definition: tooldock.h:62
const DOCKBAR * Dockbar
Definition: tooldock.h:22
HWND hWndTool
Definition: tooldock.h:61
PDOCKBAR_ITEM Items
Definition: tooldock.h:80
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
const struct winhelp_callbacks Callbacks
Definition: callback.c:161
HANDLE ProcessHeap
Definition: servman.c:15
HWND hRebar[DOCKS_COUNT]
Definition: tooldock.h:77
struct tagContext Context
Definition: acpixf.h:1024
DOCKBAR DockBar
Definition: tooldock.h:59
static BOOL TdbInsertToolbar(PTOOLBAR_DOCKS TbDocks, PDOCKBAR_ITEM Item, DOCK_POSITION Position)
Definition: tooldock.c:480
PVOID Context
Definition: tooldock.h:60
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by CreateToolbars().

◆ TbdAdjustUpdateClientRect()

INT TbdAdjustUpdateClientRect ( PTOOLBAR_DOCKS  TbDocks,
PRECT  rcClient 
)

Definition at line 44 of file tooldock.c.

46 {
47  INT i, DocksVisible = 0;
48 
49  for (i = 0; i < DOCKS_COUNT; i++)
50  {
51  if (TbDocks->hRebar[i] != NULL)
52  {
53  DocksVisible++;
54  }
55  }
56 
57  if (DocksVisible != 0)
58  {
59  rcClient->top += TbDocks->rcRebar[TOP_DOCK].bottom;
60  rcClient->left += TbDocks->rcRebar[LEFT_DOCK].right;
61  rcClient->right -= TbDocks->rcRebar[RIGHT_DOCK].right;
62  rcClient->bottom -= TbDocks->rcRebar[BOTTOM_DOCK].bottom;
63  }
64 
65  TbDocks->rcClient = *rcClient;
66 
67  return DocksVisible;
68 }
LONG top
Definition: windef.h:292
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
int32_t INT
Definition: typedefs.h:56
RECT rcRebar[DOCKS_COUNT]
Definition: tooldock.h:78
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
#define DOCKS_COUNT
Definition: tooldock.h:72
HWND hRebar[DOCKS_COUNT]
Definition: tooldock.h:77
LONG bottom
Definition: windef.h:294
RECT rcClient
Definition: tooldock.h:79

Referenced by MainWndResize().

◆ TbdCalculateInsertIndex()

static UINT TbdCalculateInsertIndex ( PTOOLBAR_DOCKS  TbDocks,
DOCK_POSITION  Position,
POINT  pt 
)
static

Definition at line 12 of file tooldock.c.

15 {
16  RECT rcRebar;
17  UINT Ret = 0;
18 
19  GetWindowRect(TbDocks->hRebar[Position],
20  &rcRebar);
21 
22  switch (Position)
23  {
24  case TOP_DOCK:
25  case BOTTOM_DOCK:
26  if (pt.y > rcRebar.top + ((rcRebar.bottom - rcRebar.top) / 2))
27  Ret = (UINT)-1;
28  break;
29 
30  case LEFT_DOCK:
31  case RIGHT_DOCK:
32  if (pt.x > rcRebar.left + ((rcRebar.right - rcRebar.left) / 2))
33  Ret = (UINT)-1;
34  break;
35 
36  default:
37  break;
38  }
39 
40  return Ret;
41 }
#define pt(x, y)
Definition: drawing.c:79
static COORD Position
Definition: mouse.c:34
LONG top
Definition: windef.h:292
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
unsigned int UINT
Definition: ndis.h:50
HWND hRebar[DOCKS_COUNT]
Definition: tooldock.h:77
LONG bottom
Definition: windef.h:294
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)

Referenced by RebarSubclassProc().

◆ TbdCreateToolbarWnd()

static BOOL TbdCreateToolbarWnd ( PTOOLBAR_DOCKS  TbDocks,
PDOCKBAR_ITEM  Item,
DOCK_POSITION  PrevPosition,
UINT  PrevBandIndex,
LPREBARBANDINFO  rbi,
POINT  pt,
HWND  hRebar,
UINT  uBand,
BOOL  Drag 
)
static

Definition at line 349 of file tooldock.c.

358 {
359  LPCTSTR lpCaption = NULL;
361  HWND hToolbar;
362 
363  Init.TbDocks = TbDocks;
364  Init.Item = Item;
365 
366  if (rbi->fMask & RBBIM_TEXT)
367  {
368  lpCaption = rbi->lpText;
369  }
370 
371  Item->Callbacks->DockBand(TbDocks,
372  &Item->DockBar,
373  Item->Context,
374  PrevPosition,
375  NO_DOCK,
376  rbi);
377 
378  if (rbi->fMask & RBBIM_CHILD)
379  Item->hWndClient = rbi->hwndChild;
380  else
381  Item->hWndClient = NULL;
382 
383 
384  if ((rbi->fMask & (RBBIM_CHILDSIZE | RBBIM_SIZE)) == (RBBIM_CHILDSIZE | RBBIM_SIZE))
385  {
386  RECT rcWnd;
387  static const DWORD dwStyle = WS_POPUPWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_DLGFRAME;
388  static const DWORD dwExStyle = WS_EX_TOOLWINDOW;
389 
392  rcWnd.right = rcWnd.left + rbi->cx;
393  rcWnd.bottom = rcWnd.top + rbi->cyMinChild;
394 
395  if (AdjustWindowRectEx(&rcWnd,
396  dwStyle,
397  FALSE,
398  dwExStyle))
399  {
400  hToolbar = CreateWindowEx(dwExStyle,
402  lpCaption,
403  dwStyle,
404  rcWnd.left,
405  rcWnd.top,
406  rcWnd.right - rcWnd.left,
407  rcWnd.bottom - rcWnd.top,
408  TbDocks->hParent,
409  NULL,
410  hInstance,
411  &Init);
412  if (hToolbar != NULL)
413  {
414  RECT rcClient;
415 
416  if (uBand != (UINT)-1)
417  {
418  /* delete the band before showing the client window,
419  otherwise deleting the band will cause the client
420  window to be hidden, regardless of whether the band
421  was hidden before being deleted or not */
422  SendMessage(hRebar,
424  (WPARAM)uBand,
425  0);
426  }
427 
428  if (Item->hWndClient != NULL)
429  {
430  GetClientRect(hToolbar,
431  &rcClient);
432 
433  SetParent(Item->hWndClient,
434  hToolbar);
435 
436  SetWindowPos(Item->hWndClient,
437  NULL,
438  0,
439  0,
440  rcClient.right,
441  rcClient.bottom,
442  SWP_NOZORDER);
443 
444  SetWindowPos(Item->hWndClient,
445  HWND_TOP,
446  0,
447  0,
448  0,
449  0,
451  }
452 
453  SetWindowPos(hToolbar,
454  HWND_TOP,
455  0,
456  0,
457  0,
458  0,
460 
461  if (Drag)
462  {
464  SendMessage(hToolbar,
466  HTCAPTION,
467  MAKELPARAM(pt.x,
468  pt.y));
469  }
470 
471  return TRUE;
472  }
473  }
474  }
475 
476  return FALSE;
477 }
#define WM_NCLBUTTONDOWN
Definition: winuser.h:1674
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define WS_POPUPWINDOW
Definition: pedump.c:638
#define SM_CYFIXEDFRAME
Definition: winuser.h:959
#define TRUE
Definition: types.h:120
const CHAR * LPCTSTR
Definition: xmlstorage.h:193
#define SM_CXFIXEDFRAME
Definition: winuser.h:957
#define RBBIM_CHILD
Definition: commctrl.h:1478
const DOCKBAR_ITEM_CALLBACKS * Callbacks
Definition: tooldock.h:65
PDOCKBAR_DOCKBAND DockBand
Definition: tooldock.h:52
#define pt(x, y)
Definition: drawing.c:79
HWND WINAPI SetParent(_In_ HWND, _In_opt_ HWND)
#define MAKELPARAM(l, h)
Definition: winuser.h:3947
LONG top
Definition: windef.h:292
#define WS_DLGFRAME
Definition: pedump.c:626
BOOL WINAPI AdjustWindowRectEx(_Inout_ LPRECT, _In_ DWORD, _In_ BOOL, _In_ DWORD)
#define HWND_TOP
Definition: winuser.h:1193
UINT_PTR WPARAM
Definition: windef.h:207
BOOL Init(PUSERCONNECT UserCon)
Definition: dllmain.c:385
LONG left
Definition: windef.h:291
#define SWP_NOZORDER
Definition: winuser.h:1232
#define WS_CLIPCHILDREN
Definition: pedump.c:619
LONG right
Definition: windef.h:293
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
#define RBBIM_SIZE
Definition: commctrl.h:1480
HINSTANCE hInstance
Definition: charmap.c:20
static const TCHAR szToolDockWndClass[]
Definition: tooldock.c:3
#define CreateWindowEx
Definition: winuser.h:5656
smooth NULL
Definition: ftsmooth.c:416
HWND hWndClient
Definition: tooldock.h:62
#define RBBIM_TEXT
Definition: commctrl.h:1476
int WINAPI GetSystemMetrics(_In_ int)
unsigned long DWORD
Definition: ntddk_ex.h:95
#define RBBIM_CHILDSIZE
Definition: commctrl.h:1479
#define LoadCursor
Definition: winuser.h:5713
#define SWP_NOSIZE
Definition: winuser.h:1230
#define HTCAPTION
Definition: winuser.h:2451
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
unsigned int UINT
Definition: ndis.h:50
#define SWP_SHOWWINDOW
Definition: winuser.h:1233
HWND hParent
Definition: tooldock.h:75
#define IDC_ARROW
Definition: winuser.h:682
#define SendMessage
Definition: winuser.h:5744
#define RB_DELETEBAND
Definition: commctrl.h:1548
LONG bottom
Definition: windef.h:294
DOCKBAR DockBar
Definition: tooldock.h:59
#define SWP_NOMOVE
Definition: winuser.h:1229
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
PVOID Context
Definition: tooldock.h:60
#define SM_CYSMCAPTION
Definition: winuser.h:1004

Referenced by RebarSubclassProc(), and TdbInsertToolbar().

◆ TbdDeferDocks()

HDWP TbdDeferDocks ( HDWP  hWinPosInfo,
PTOOLBAR_DOCKS  TbDocks 
)

Definition at line 71 of file tooldock.c.

73 {
74  LONG cx, cy;
75  HDWP hRet = hWinPosInfo;
76 
77  cx = TbDocks->rcClient.right - TbDocks->rcClient.left;
78  cy = TbDocks->rcClient.bottom - TbDocks->rcClient.top;
79 
80  /* Top dock */
81  if (TbDocks->hRebar[TOP_DOCK] != NULL)
82  {
83  hRet = DeferWindowPos(hRet,
84  TbDocks->hRebar[TOP_DOCK],
85  NULL,
86  TbDocks->rcClient.left - TbDocks->rcRebar[LEFT_DOCK].right,
87  TbDocks->rcClient.top - TbDocks->rcRebar[TOP_DOCK].bottom,
88  cx + TbDocks->rcRebar[LEFT_DOCK].right + TbDocks->rcRebar[RIGHT_DOCK].right,
89  TbDocks->rcRebar[TOP_DOCK].bottom,
90  SWP_NOZORDER);
91  if (hRet == NULL)
92  return NULL;
93  }
94 
95  /* Left dock */
96  if (TbDocks->hRebar[LEFT_DOCK] != NULL)
97  {
98  hRet = DeferWindowPos(hRet,
99  TbDocks->hRebar[LEFT_DOCK],
100  NULL,
101  TbDocks->rcClient.left - TbDocks->rcRebar[LEFT_DOCK].right,
102  TbDocks->rcClient.top,
103  TbDocks->rcRebar[LEFT_DOCK].right,
104  cy,
105  SWP_NOZORDER);
106  if (hRet == NULL)
107  return NULL;
108  }
109 
110  /* Right dock */
111  if (TbDocks->hRebar[RIGHT_DOCK] != NULL)
112  {
113  hRet = DeferWindowPos(hRet,
114  TbDocks->hRebar[RIGHT_DOCK],
115  NULL,
116  TbDocks->rcClient.right,
117  TbDocks->rcClient.top,
118  TbDocks->rcRebar[RIGHT_DOCK].right,
119  cy,
120  SWP_NOZORDER);
121  if (hRet == NULL)
122  return NULL;
123  }
124 
125  /* Bottom dock */
126  if (TbDocks->hRebar[BOTTOM_DOCK] != NULL)
127  {
128  hRet = DeferWindowPos(hRet,
129  TbDocks->hRebar[BOTTOM_DOCK],
130  NULL,
131  TbDocks->rcClient.left - TbDocks->rcRebar[LEFT_DOCK].right,
132  TbDocks->rcClient.bottom,
133  cx + TbDocks->rcRebar[LEFT_DOCK].right + TbDocks->rcRebar[RIGHT_DOCK].right,
134  TbDocks->rcRebar[BOTTOM_DOCK].bottom,
135  SWP_NOZORDER);
136  if (hRet == NULL)
137  return NULL;
138  }
139 
140  return hRet;
141 }
LONG top
Definition: windef.h:292
LONG left
Definition: windef.h:291
#define SWP_NOZORDER
Definition: winuser.h:1232
LONG right
Definition: windef.h:293
RECT rcRebar[DOCKS_COUNT]
Definition: tooldock.h:78
long LONG
Definition: pedump.c:60
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:570
smooth NULL
Definition: ftsmooth.c:416
HDWP WINAPI DeferWindowPos(_In_ HDWP, _In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
HWND hRebar[DOCKS_COUNT]
Definition: tooldock.h:77
_Out_opt_ int * cx
Definition: commctrl.h:570
LONG bottom
Definition: windef.h:294
RECT rcClient
Definition: tooldock.h:79

Referenced by MainWndResize().

◆ TbdDockBarIdFromClientWindow()

BOOL TbdDockBarIdFromClientWindow ( PTOOLBAR_DOCKS  TbDocks,
HWND  hWndClient,
UINT Id 
)

Definition at line 267 of file tooldock.c.

270 {
271  PDOCKBAR_ITEM Item;
272  BOOL Ret = FALSE;
273 
274  Item = TbDocks->Items;
275  while (Item != NULL)
276  {
277  if (Item->hWndClient == hWndClient)
278  {
279  *Id = Item->DockBar.BarId;
280  Ret = TRUE;
281  break;
282  }
283 
284  Item = Item->Next;
285  }
286 
287  return Ret;
288 }
#define TRUE
Definition: types.h:120
DWORD Id
struct _DOCKBAR_ITEM * Next
Definition: tooldock.h:58
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
HWND hWndClient
Definition: tooldock.h:62
UINT BarId
Definition: tooldock.h:13
PDOCKBAR_ITEM Items
Definition: tooldock.h:80
DOCKBAR DockBar
Definition: tooldock.h:59

Referenced by MainWndProc().

◆ TbdHandleActivation()

VOID TbdHandleActivation ( PTOOLBAR_DOCKS  TbDocks,
HWND  hWnd,
WPARAM wParam,
LPARAM lParam 
)

Definition at line 992 of file tooldock.c.

996 {
997  BOOL SynchronizeSiblings = TRUE;
998  BOOL KeepActive = *(BOOL*)wParam;
999  HWND hWndActivate = *(HWND*)lParam;
1000  PDOCKBAR_ITEM Item;
1001 
1002  Item = TbDocks->Items;
1003  while (Item != NULL)
1004  {
1005  if (Item->hWndTool != NULL &&
1006  Item->hWndTool == hWndActivate)
1007  {
1008  KeepActive = TRUE;
1009  SynchronizeSiblings = FALSE;
1010  break;
1011  }
1012  Item = Item->Next;
1013  }
1014 
1015  if (hWndActivate != (HWND)-1)
1016  {
1017  if (SynchronizeSiblings)
1018  {
1019  Item = TbDocks->Items;
1020  while (Item != NULL)
1021  {
1022  if (Item->hWndTool != NULL &&
1023  Item->hWndTool != hWnd &&
1024  Item->hWndTool != hWndActivate)
1025  {
1026  SendMessage(Item->hWndTool,
1027  WM_NCACTIVATE,
1028  (WPARAM)KeepActive,
1029  (LPARAM)-1);
1030  }
1031  Item = Item->Next;
1032  }
1033  }
1034  }
1035  else
1036  *lParam = 0;
1037 
1038  *wParam = (WPARAM)KeepActive;
1039 }
#define TRUE
Definition: types.h:120
HWND hWnd
Definition: settings.c:17
UINT_PTR WPARAM
Definition: windef.h:207
WPARAM wParam
Definition: combotst.c:138
struct _DOCKBAR_ITEM * Next
Definition: tooldock.h:58
#define WM_NCACTIVATE
Definition: winuser.h:1670
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
HWND hWndTool
Definition: tooldock.h:61
PDOCKBAR_ITEM Items
Definition: tooldock.h:80
#define SendMessage
Definition: winuser.h:5744
LPARAM lParam
Definition: combotst.c:139

Referenced by MainWndProc(), and ToolDockWndProc().

◆ TbdHandleEnabling()

VOID TbdHandleEnabling ( PTOOLBAR_DOCKS  TbDocks,
HWND  hWnd,
BOOL  Enable 
)

Definition at line 972 of file tooldock.c.

975 {
976  PDOCKBAR_ITEM Item;
977 
978  Item = TbDocks->Items;
979  while (Item != NULL)
980  {
981  if (Item->hWndTool != NULL &&
982  Item->hWndTool != hWnd)
983  {
984  EnableWindow(Item->hWndTool,
985  Enable);
986  }
987  Item = Item->Next;
988  }
989 }
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:140
HWND hWnd
Definition: settings.c:17
struct _DOCKBAR_ITEM * Next
Definition: tooldock.h:58
smooth NULL
Definition: ftsmooth.c:416
HWND hWndTool
Definition: tooldock.h:61
PDOCKBAR_ITEM Items
Definition: tooldock.h:80
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)

Referenced by MainWndProc().

◆ TbdHandleNotifications()

BOOL TbdHandleNotifications ( PTOOLBAR_DOCKS  TbDocks,
LPNMHDR  pnmh,
LRESULT Result 
)

Definition at line 291 of file tooldock.c.

294 {
295  BOOL Handled = FALSE;
296 
297  if (pnmh->hwndFrom != NULL)
298  {
300 
302  {
303  if (pnmh->hwndFrom == TbDocks->hRebar[Position])
304  {
305  switch (pnmh->code)
306  {
307  case RBN_HEIGHTCHANGE:
308  {
309  TbnRebarChangeSize(TbDocks,
310  Position);
311  break;
312  }
313 
314  case RBN_BEGINDRAG:
315  {
316  *Result = TbnRebarBeginDrag(TbDocks,
317  Position,
318  (LPNMREBAR)pnmh);
319  break;
320  }
321 
322  case RBN_ENDDRAG:
323  {
324  TbnRebarEndDrag(TbDocks,
325  Position,
326  (LPNMREBAR)pnmh);
327  break;
328  }
329 
330  case RBN_CHEVRONPUSHED:
331  {
332  TbnRebarChevronPushed(TbDocks,
333  Position,
334  (LPNMREBARCHEVRON)pnmh);
335  break;
336  }
337  }
338 
339  Handled = TRUE;
340  break;
341  }
342  }
343  }
344 
345  return Handled;
346 }
#define TRUE
Definition: types.h:120
#define RBN_HEIGHTCHANGE
Definition: commctrl.h:1600
static COORD Position
Definition: mouse.c:34
UINT code
Definition: winuser.h:3133
unsigned int BOOL
Definition: ntddk_ex.h:94
#define RBN_BEGINDRAG
Definition: commctrl.h:1604
smooth NULL
Definition: ftsmooth.c:416
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
DOCK_POSITION
Definition: tooldock.h:2
static VOID TbnRebarEndDrag(PTOOLBAR_DOCKS TbDocks, DOCK_POSITION Position, LPNMREBAR lpnmrb)
Definition: tooldock.c:250
_In_ BOOLEAN Handled
Definition: ketypes.h:337
static LRESULT TbnRebarBeginDrag(PTOOLBAR_DOCKS TbDocks, DOCK_POSITION Position, LPNMREBAR lpnmrb)
Definition: tooldock.c:229
HWND hwndFrom
Definition: winuser.h:3131
static VOID TbnRebarChangeSize(PTOOLBAR_DOCKS TbDocks, DOCK_POSITION Position)
Definition: tooldock.c:165
HWND hRebar[DOCKS_COUNT]
Definition: tooldock.h:77
static VOID TbnRebarChevronPushed(PTOOLBAR_DOCKS TbDocks, DOCK_POSITION Position, LPNMREBARCHEVRON lpnm)
Definition: tooldock.c:208
#define RBN_ENDDRAG
Definition: commctrl.h:1605
#define RBN_CHEVRONPUSHED
Definition: commctrl.h:1609

Referenced by MainWndProc().

◆ TbdInitializeDocks()

VOID TbdInitializeDocks ( PTOOLBAR_DOCKS  TbDocks,
HWND  hWndParent,
PVOID  Context,
PDOCKBAR_PARENTRESIZE  ParentResizeProc 
)

Definition at line 1064 of file tooldock.c.

1068 {
1072 
1074 
1075  TbDocks->hParent = hWndParent;
1076  TbDocks->Context = Context;
1077  TbDocks->ParentResize = ParentResizeProc;
1078 
1079  for (Position = TOP_DOCK; Position < NO_DOCK; Position++)
1080  {
1081  switch (Position)
1082  {
1083  case LEFT_DOCK:
1084  case RIGHT_DOCK:
1085  rbStyle |= CCS_VERT;
1086  break;
1087  default:
1088  rbStyle &= ~CCS_VERT;
1089  break;
1090  }
1091 
1094  NULL,
1095  rbStyle,
1096  0,
1097  0,
1098  0,
1099  0,
1100  TbDocks->hParent,
1101  NULL,
1102  hInstance,
1103  NULL);
1104 
1105  if (TbDocks->hRebar[Position] != NULL)
1106  {
1107  SetWindowSubclass(TbDocks->hRebar[Position],
1109  1,
1110  (DWORD_PTR)TbDocks);
1111  }
1112  }
1113 }
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define RBS_VARHEIGHT
Definition: commctrl.h:1443
static COORD Position
Definition: mouse.c:34
#define WS_CHILD
Definition: pedump.c:617
#define WS_CLIPCHILDREN
Definition: pedump.c:619
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
#define CCS_VERT
Definition: commctrl.h:2221
#define CCS_NODIVIDER
Definition: commctrl.h:2220
HINSTANCE hInstance
Definition: charmap.c:20
#define CreateWindowEx
Definition: winuser.h:5656
smooth NULL
Definition: ftsmooth.c:416
#define CCS_NOPARENTALIGN
Definition: commctrl.h:2218
DOCK_POSITION
Definition: tooldock.h:2
BOOL WINAPI SetWindowSubclass(HWND hWnd, SUBCLASSPROC pfnSubclass, UINT_PTR uIDSubclass, DWORD_PTR dwRef)
Definition: commctrl.c:1261
#define RBS_AUTOSIZE
Definition: commctrl.h:1447
unsigned long DWORD
Definition: ntddk_ex.h:95
PVOID Context
Definition: tooldock.h:76
uint32_t DWORD_PTR
Definition: typedefs.h:63
#define REBARCLASSNAME
Definition: commctrl.h:1438
HWND hRebar[DOCKS_COUNT]
Definition: tooldock.h:77
static LRESULT CALLBACK RebarSubclassProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData)
Definition: tooldock.c:718
HWND hParent
Definition: tooldock.h:75
#define CCS_NOMOVEY
Definition: commctrl.h:2215
struct tagContext Context
Definition: acpixf.h:1024
#define CCS_NOMOVEX
Definition: commctrl.h:2224
#define WS_VISIBLE
Definition: pedump.c:620
PDOCKBAR_PARENTRESIZE ParentResize
Definition: tooldock.h:81

Referenced by InitMainWnd().

◆ TbdInitImpl()

BOOL TbdInitImpl ( VOID  )

Definition at line 1116 of file tooldock.c.

1117 {
1118  WNDCLASSEX wc = {0};
1119 
1120  wc.cbSize = sizeof(WNDCLASSEX);
1121  wc.style = CS_HREDRAW | CS_VREDRAW;
1124  wc.hInstance = hInstance;
1125  wc.hCursor = LoadCursor(NULL,
1126  IDC_ARROW);
1127  wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
1129 
1130  return RegisterClassEx(&wc) != (ATOM)0;
1131 }
UINT style
Definition: winuser.h:3176
#define RegisterClassEx
Definition: winuser.h:5738
HCURSOR hCursor
Definition: winuser.h:3182
WNDPROC lpfnWndProc
Definition: winuser.h:3177
LPCSTR lpszClassName
Definition: winuser.h:3185
WORD ATOM
Definition: dimm.idl:113
#define CS_HREDRAW
Definition: winuser.h:648
HINSTANCE hInstance
Definition: charmap.c:20
static LRESULT CALLBACK ToolDockWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: tooldock.c:642
static const TCHAR szToolDockWndClass[]
Definition: tooldock.c:3
HINSTANCE hInstance
Definition: winuser.h:3180
smooth NULL
Definition: ftsmooth.c:416
UINT cbSize
Definition: winuser.h:3175
#define TD_EXTRA_BYTES
Definition: tooldock.c:639
HBRUSH hbrBackground
Definition: winuser.h:3183
#define CS_VREDRAW
Definition: winuser.h:653
int cbWndExtra
Definition: winuser.h:3179
#define COLOR_BTNFACE
Definition: winuser.h:918
#define LoadCursor
Definition: winuser.h:5713
#define IDC_ARROW
Definition: winuser.h:682
WNDCLASSEXA WNDCLASSEX
Definition: winuser.h:5620

Referenced by _tWinMain().

◆ TbdShowFloatingToolbars()

VOID TbdShowFloatingToolbars ( PTOOLBAR_DOCKS  TbDocks,
BOOL  Show 
)

Definition at line 1042 of file tooldock.c.

1044 {
1045  PDOCKBAR_ITEM Item;
1046 
1047  Item = TbDocks->Items;
1048  while (Item != NULL)
1049  {
1050  if (Item->hWndTool != NULL)
1051  {
1052  if ((Show && !IsWindowVisible(Item->hWndTool)) ||
1053  (!Show && IsWindowVisible(Item->hWndTool)))
1054  {
1055  ShowWindow(Item->hWndTool,
1056  (Show ? SW_SHOW : SW_HIDE));
1057  }
1058  }
1059  Item = Item->Next;
1060  }
1061 }
#define SW_HIDE
Definition: winuser.h:762
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
struct _DOCKBAR_ITEM * Next
Definition: tooldock.h:58
smooth NULL
Definition: ftsmooth.c:416
#define SW_SHOW
Definition: winuser.h:769
HWND hWndTool
Definition: tooldock.h:61
PDOCKBAR_ITEM Items
Definition: tooldock.h:80
BOOL WINAPI IsWindowVisible(_In_ HWND)

◆ TbdUninitImpl()

VOID TbdUninitImpl ( VOID  )

Definition at line 1134 of file tooldock.c.

1135 {
1137  hInstance);
1138 }
HINSTANCE hInstance
Definition: charmap.c:20
static const TCHAR szToolDockWndClass[]
Definition: tooldock.c:3
#define UnregisterClass
Definition: winuser.h:5762

Referenced by _tWinMain().

◆ TbnDockbarItemFromBandId()

static PDOCKBAR_ITEM TbnDockbarItemFromBandId ( PTOOLBAR_DOCKS  TbDocks,
DOCK_POSITION  Position,
UINT  uBand 
)
static

Definition at line 144 of file tooldock.c.

147 {
148  REBARBANDINFO rbi = {0};
149 
150  rbi.cbSize = sizeof(rbi);
151  rbi.fMask = RBBIM_LPARAM;
152 
153  if (SendMessage(TbDocks->hRebar[Position],
155  (WPARAM)uBand,
156  (LPARAM)&rbi))
157  {
158  return (PDOCKBAR_ITEM)rbi.lParam;
159  }
160 
161  return NULL;
162 }
#define RB_GETBANDINFO
Definition: commctrl.h:1584
static COORD Position
Definition: mouse.c:34
UINT_PTR WPARAM
Definition: windef.h:207
#define RBBIM_LPARAM
Definition: commctrl.h:1484
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define REBARBANDINFO
Definition: commctrl.h:1541
HWND hRebar[DOCKS_COUNT]
Definition: tooldock.h:77
#define SendMessage
Definition: winuser.h:5744

Referenced by TbnRebarBeginDrag(), TbnRebarChevronPushed(), and TbnRebarEndDrag().

◆ TbnRebarBeginDrag()

static LRESULT TbnRebarBeginDrag ( PTOOLBAR_DOCKS  TbDocks,
DOCK_POSITION  Position,
LPNMREBAR  lpnmrb 
)
static

Definition at line 229 of file tooldock.c.

232 {
233  PDOCKBAR_ITEM Item;
234 
235  Item = TbnDockbarItemFromBandId(TbDocks,
236  Position,
237  lpnmrb->uBand);
238 
239  if (Item != NULL)
240  {
241  TbDocks->Dragging = Item;
242  TbDocks->DraggingBandId = lpnmrb->wID;
243  return FALSE;
244  }
245 
246  return TRUE;
247 }
UINT wID
Definition: commctrl.h:1626
#define TRUE
Definition: types.h:120
static COORD Position
Definition: mouse.c:34
UINT DraggingBandId
Definition: tooldock.h:83
static PDOCKBAR_ITEM TbnDockbarItemFromBandId(PTOOLBAR_DOCKS TbDocks, DOCK_POSITION Position, UINT uBand)
Definition: tooldock.c:144
UINT uBand
Definition: commctrl.h:1624
smooth NULL
Definition: ftsmooth.c:416
PDOCKBAR_ITEM Dragging
Definition: tooldock.h:82

Referenced by TbdHandleNotifications().

◆ TbnRebarChangeSize()

static VOID TbnRebarChangeSize ( PTOOLBAR_DOCKS  TbDocks,
DOCK_POSITION  Position 
)
static

Definition at line 165 of file tooldock.c.

167 {
168  LONG cRebar;
169 
170  TbDocks->rcRebar[Position].left = 0;
171  TbDocks->rcRebar[Position].top = 0;
172 
173  cRebar = (LONG)SendMessage(TbDocks->hRebar[Position],
175  0,
176  0);
177 
178  switch (Position)
179  {
180  case TOP_DOCK:
181  case BOTTOM_DOCK:
182  TbDocks->rcRebar[Position].bottom = cRebar;
183  break;
184 
185  case LEFT_DOCK:
186  case RIGHT_DOCK:
187  TbDocks->rcRebar[Position].right = cRebar;
188  break;
189 
190  default:
191  break;
192  }
193 
194  if (TbDocks->ParentResize != NULL)
195  {
196  RECT rcClient = {0};
197 
198  GetClientRect(TbDocks->hParent,
199  &rcClient);
200 
201  TbDocks->ParentResize(TbDocks->Context,
202  rcClient.right - rcClient.left,
203  rcClient.bottom - rcClient.top);
204  }
205 }
#define RB_GETBARHEIGHT
Definition: commctrl.h:1580
static COORD Position
Definition: mouse.c:34
LONG top
Definition: windef.h:292
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
RECT rcRebar[DOCKS_COUNT]
Definition: tooldock.h:78
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
PVOID Context
Definition: tooldock.h:76
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
HWND hRebar[DOCKS_COUNT]
Definition: tooldock.h:77
HWND hParent
Definition: tooldock.h:75
#define SendMessage
Definition: winuser.h:5744
LONG bottom
Definition: windef.h:294
PDOCKBAR_PARENTRESIZE ParentResize
Definition: tooldock.h:81

Referenced by TbdHandleNotifications().

◆ TbnRebarChevronPushed()

static VOID TbnRebarChevronPushed ( PTOOLBAR_DOCKS  TbDocks,
DOCK_POSITION  Position,
LPNMREBARCHEVRON  lpnm 
)
static

Definition at line 208 of file tooldock.c.

211 {
212  PDOCKBAR_ITEM Item;
213 
214  Item = TbnDockbarItemFromBandId(TbDocks,
215  Position,
216  lpnm->uBand);
217 
218  if (Item != NULL && Item->Callbacks->ChevronPushed)
219  {
220  Item->Callbacks->ChevronPushed(TbDocks,
221  &Item->DockBar,
222  Item->Context,
223  Item->hWndClient,
224  lpnm);
225  }
226 }
const DOCKBAR_ITEM_CALLBACKS * Callbacks
Definition: tooldock.h:65
PDOCKBAR_CHEVRONPUSHED ChevronPushed
Definition: tooldock.h:53
static COORD Position
Definition: mouse.c:34
static PDOCKBAR_ITEM TbnDockbarItemFromBandId(PTOOLBAR_DOCKS TbDocks, DOCK_POSITION Position, UINT uBand)
Definition: tooldock.c:144
smooth NULL
Definition: ftsmooth.c:416
HWND hWndClient
Definition: tooldock.h:62
DOCKBAR DockBar
Definition: tooldock.h:59
PVOID Context
Definition: tooldock.h:60

Referenced by TbdHandleNotifications().

◆ TbnRebarEndDrag()

static VOID TbnRebarEndDrag ( PTOOLBAR_DOCKS  TbDocks,
DOCK_POSITION  Position,
LPNMREBAR  lpnmrb 
)
static

Definition at line 250 of file tooldock.c.

253 {
254  PDOCKBAR_ITEM Item;
255 
256  Item = TbnDockbarItemFromBandId(TbDocks,
257  Position,
258  lpnmrb->uBand);
259 
260  if (Item != NULL)
261  {
262  /* Nothing to do */
263  }
264 }
static COORD Position
Definition: mouse.c:34
static PDOCKBAR_ITEM TbnDockbarItemFromBandId(PTOOLBAR_DOCKS TbDocks, DOCK_POSITION Position, UINT uBand)
Definition: tooldock.c:144
UINT uBand
Definition: commctrl.h:1624
smooth NULL
Definition: ftsmooth.c:416

Referenced by TbdHandleNotifications().

◆ TdbInsertToolbar()

static BOOL TdbInsertToolbar ( PTOOLBAR_DOCKS  TbDocks,
PDOCKBAR_ITEM  Item,
DOCK_POSITION  Position 
)
static

Definition at line 480 of file tooldock.c.

483 {
484  LPTSTR lpCaption = NULL;
485  REBARBANDINFO rbi = {0};
486  BOOL Ret = FALSE;
487 
488  rbi.cbSize = sizeof(rbi);
489  rbi.fMask = RBBIM_ID | RBBIM_STYLE | RBBIM_LPARAM;
490  rbi.wID = Item->DockBar.BarId;
491  rbi.fStyle = RBBS_GRIPPERALWAYS;
492  rbi.lParam = (LPARAM)Item;
493 
494  if (Item->DockBar.DisplayTextId != 0)
495  {
496  if (AllocAndLoadString(&lpCaption,
497  hInstance,
498  Item->DockBar.DisplayTextId))
499  {
500  rbi.fMask |= RBBIM_TEXT;
501  rbi.lpText = lpCaption;
502  }
503  }
504 
505  if (Item->hWndClient != NULL)
506  {
507  rbi.fMask |= RBBIM_CHILD;
508  rbi.hwndChild = Item->hWndClient;
509  }
510 
511  switch (Item->DockBar.Position)
512  {
513  case NO_DOCK:
514  {
515  POINT pt = {0};
516 
517  /* FIXME - calculate size */
518  Ret = TbdCreateToolbarWnd(TbDocks,
519  Item,
520  Item->DockBar.Position,
521  (UINT)-1,
522  &rbi,
523  pt,
524  NULL,
525  (UINT)-1,
526  FALSE);
527  break;
528  }
529 
530  default:
531  {
532  UINT Index = -1;
533  BOOL AddBand = TRUE;
534 
535  if (Item->Callbacks->InsertBand != NULL)
536  {
537  AddBand = Item->Callbacks->InsertBand(TbDocks,
538  &Item->DockBar,
539  Item->Context,
540  &Index,
541  &rbi);
542  }
543 
544  if (AddBand)
545  {
546  Item->Callbacks->DockBand(TbDocks,
547  &Item->DockBar,
548  Item->Context,
549  NO_DOCK,
550  Item->DockBar.Position,
551  &rbi);
552 
553  if (rbi.fMask & RBBIM_CHILD)
554  Item->hWndClient = rbi.hwndChild;
555  else
556  Item->hWndClient = NULL;
557 
558  Ret = SendMessage(TbDocks->hRebar[Position],
560  (WPARAM)Index,
561  (LPARAM)&rbi) != 0;
562  if (Ret)
563  {
564  Item->PrevDock = Position;
565  Item->PrevBandIndex = (UINT)SendMessage(TbDocks->hRebar[Position],
566  RB_IDTOINDEX,
567  (WPARAM)Item->DockBar.BarId,
568  0);
569  }
570  }
571 
572  break;
573  }
574  }
575 
576  if (lpCaption != NULL)
577  {
578  LocalFree((HLOCAL)lpCaption);
579  }
580 
581  return Ret;
582 }
#define TRUE
Definition: types.h:120
DOCK_POSITION PrevDock
Definition: tooldock.h:63
#define RBBIM_CHILD
Definition: commctrl.h:1478
const DOCKBAR_ITEM_CALLBACKS * Callbacks
Definition: tooldock.h:65
PDOCKBAR_DOCKBAND DockBand
Definition: tooldock.h:52
#define pt(x, y)
Definition: drawing.c:79
static COORD Position
Definition: mouse.c:34
#define RBBIM_ID
Definition: commctrl.h:1482
UINT_PTR WPARAM
Definition: windef.h:207
static INT AllocAndLoadString(OUT LPTSTR *lpTarget, IN HINSTANCE hInst, IN UINT uID)
Definition: misc.c:60
#define RBBIM_LPARAM
Definition: commctrl.h:1484
CHAR * LPTSTR
Definition: xmlstorage.h:192
#define RBBIM_STYLE
Definition: commctrl.h:1474
HINSTANCE hInstance
Definition: charmap.c:20
unsigned int BOOL
Definition: ntddk_ex.h:94
DOCK_POSITION Position
Definition: tooldock.h:16
#define RB_INSERTBAND
Definition: commctrl.h:1574
smooth NULL
Definition: ftsmooth.c:416
HWND hWndClient
Definition: tooldock.h:62
LONG_PTR LPARAM
Definition: windef.h:208
UINT BarId
Definition: tooldock.h:13
#define REBARBANDINFO
Definition: commctrl.h:1541
#define RBBIM_TEXT
Definition: commctrl.h:1476
static const UCHAR Index[8]
Definition: usbohci.c:18
UINT DisplayTextId
Definition: tooldock.h:15
PDOCKBAR_INSERTBAND InsertBand
Definition: tooldock.h:51
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define RB_IDTOINDEX
Definition: commctrl.h:1560
unsigned int UINT
Definition: ndis.h:50
HWND hRebar[DOCKS_COUNT]
Definition: tooldock.h:77
#define RBBS_GRIPPERALWAYS
Definition: commctrl.h:1468
#define SendMessage
Definition: winuser.h:5744
DOCKBAR DockBar
Definition: tooldock.h:59
UINT PrevBandIndex
Definition: tooldock.h:64
static BOOL TbdCreateToolbarWnd(PTOOLBAR_DOCKS TbDocks, PDOCKBAR_ITEM Item, DOCK_POSITION PrevPosition, UINT PrevBandIndex, LPREBARBANDINFO rbi, POINT pt, HWND hRebar, UINT uBand, BOOL Drag)
Definition: tooldock.c:349
PVOID Context
Definition: tooldock.h:60

Referenced by TbdAddToolbar().

◆ ToolDockWndProc()

static LRESULT CALLBACK ToolDockWndProc ( HWND  hwnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 642 of file tooldock.c.

646 {
647  PTOOLBAR_DOCKS TbDocks;
648  PDOCKBAR_ITEM Item;
649  LRESULT Ret = 0;
650 
651  /* Get the window context */
653  GWLP_TBDOCKS);
655  GWLP_DOCKITEM);
656 
657  if ((TbDocks == NULL || Item == NULL) && uMsg != WM_CREATE)
658  {
659  goto HandleDefaultMessage;
660  }
661 
662  switch (uMsg)
663  {
664  case WM_NCACTIVATE:
665  {
666  TbdHandleActivation(TbDocks,
667  hwnd,
668  &wParam,
669  &lParam);
670  goto HandleDefaultMessage;
671  }
672 
673  case WM_CREATE:
674  {
675  TbDocks = ((PTOOLDOCKWND_INIT)(((LPCREATESTRUCT)lParam)->lpCreateParams))->TbDocks;
676  Item = ((PTOOLDOCKWND_INIT)(((LPCREATESTRUCT)lParam)->lpCreateParams))->Item;
677  Item->hWndTool = hwnd;
678 
680  GWLP_TBDOCKS,
681  (LONG_PTR)TbDocks);
684  (LONG_PTR)Item);
685 
686  Ret = TRUE;
687  break;
688  }
689 
690  case WM_DESTROY:
691  {
692  Item->hWndTool = NULL;
693 
696  0);
699  0);
700  break;
701  }
702 
703  default:
704  {
705 HandleDefaultMessage:
706  Ret = DefWindowProc(hwnd,
707  uMsg,
708  wParam,
709  lParam);
710  break;
711  }
712  }
713 
714  return Ret;
715 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
struct _TOOLDOCKWND_INIT * PTOOLDOCKWND_INIT
#define TRUE
Definition: types.h:120
#define SetWindowLongPtr
Definition: treelist.c:70
WPARAM wParam
Definition: combotst.c:138
#define WM_NCACTIVATE
Definition: winuser.h:1670
#define GWLP_USERDATA
Definition: treelist.c:63
smooth NULL
Definition: ftsmooth.c:416
HWND hWndTool
Definition: tooldock.h:61
#define DefWindowProc
Definition: ros2win.h:31
#define WM_DESTROY
Definition: winuser.h:1591
#define GWLP_TBDOCKS
Definition: tooldock.c:637
struct _TOOLBAR_DOCKS * PTOOLBAR_DOCKS
VOID TbdHandleActivation(PTOOLBAR_DOCKS TbDocks, HWND hWnd, WPARAM *wParam, LPARAM *lParam)
Definition: tooldock.c:992
#define GWLP_DOCKITEM
Definition: tooldock.c:638
struct _DOCKBAR_ITEM * PDOCKBAR_ITEM
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define WM_CREATE
Definition: winuser.h:1590
#define GetWindowLongPtr
Definition: treelist.c:73
LONG_PTR LRESULT
Definition: windef.h:209
LPARAM lParam
Definition: combotst.c:139

Referenced by TbdInitImpl().

Variable Documentation

◆ szToolDockWndClass

const TCHAR szToolDockWndClass[] = TEXT("ImageSoftToolDockWndClass")
static

Definition at line 3 of file tooldock.c.

Referenced by TbdCreateToolbarWnd(), TbdInitImpl(), and TbdUninitImpl().