From: Vladislav Timonin timoninvlad@yandex.ru
--- dlls/comdlg32/navbar.c | 53 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 2 deletions(-)
diff --git a/dlls/comdlg32/navbar.c b/dlls/comdlg32/navbar.c index 5ad19137213..9c8677545fd 100644 --- a/dlls/comdlg32/navbar.c +++ b/dlls/comdlg32/navbar.c @@ -37,6 +37,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(commdlg); #define IDC_NAVUP 203 #define IDC_NAVCRUMB 204
+#define BACKGROUND_SUBCLASS_ID 1 + typedef struct { HWND parent_hwnd; HWND container_hwnd; @@ -50,6 +52,10 @@ typedef struct { HWND fwd_btn_hwnd; HWND up_btn_hwnd;
+ HWND background_hwnd; + INT background_x; + INT background_w; + struct list crumbs; INT crumbs_total_n; INT crumbs_visible_n; @@ -92,6 +98,28 @@ static void set_title_and_add_tooltip(NAVBAR_INFO *info, HWND window, UINT strin SendMessageW(info->tooltip, TTM_ADDTOOLW, 0, (LPARAM)&toolinfo); }
+static LRESULT CALLBACK NAVBAR_BACKGROUND_SubclassProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, UINT_PTR id_subclass, DWORD_PTR ref_data) +{ + switch (msg) + { + case WM_PAINT: + { + PAINTSTRUCT ps; + HDC hdc = BeginPaint(hwnd, &ps); + RECT rc; + + GetClientRect(hwnd, &rc); + + /* draw a frame without left border */ + DrawEdge(hdc, &rc, EDGE_SUNKEN, BF_TOP | BF_BOTTOM | BF_RIGHT | BF_FLAT); + + return 0; /* processed */ + } + } + + return DefSubclassProc(hwnd, msg, wparam, lparam); +} + static void NAVBAR_CalcLayout(NAVBAR_INFO *info) { RECT container_rc, up_button_rc; @@ -181,6 +209,9 @@ static void NAVBAR_CalcLayout(NAVBAR_INFO *info) else prev_x = buttons_w + w;
+ info->background_x = prev_x; + info->background_w = container_rc.right - prev_x; + info->crumbs_visible_n = crumbs_visible_n;
LIST_FOR_EACH_ENTRY_REV(crumb1, &info->crumbs, struct crumb, entry) @@ -211,6 +242,7 @@ static HDWP NAVBAR_DoLayout(NAVBAR_INFO *info, HDWP hdwp) { struct crumb *crumb; INT can_fit_n = info->crumbs_visible_n; + UINT background_flags = 0;
LIST_FOR_EACH_ENTRY_REV(crumb, &info->crumbs, struct crumb, entry) { @@ -229,6 +261,16 @@ static HDWP NAVBAR_DoLayout(NAVBAR_INFO *info, HDWP hdwp) can_fit_n -= 1; }
+ if (info->background_w > 0) + background_flags |= SWP_SHOWWINDOW | SWP_NOCOPYBITS; + else + background_flags |= SWP_HIDEWINDOW; + + hdwp = DeferWindowPos(hdwp, info->background_hwnd, HWND_TOP, + info->background_x, 0, + info->background_w, info->container_h, + background_flags); + return hdwp; }
@@ -284,6 +326,13 @@ static LRESULT NAVBAR_Create(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) set_icon(info->icons, ILI_UP, info->up_btn_hwnd); set_title_and_add_tooltip(info, info->up_btn_hwnd, IDS_UPFOLDER);
+ x += cs->cy + 1; + info->background_hwnd = CreateWindowExW(0, WC_STATICW, NULL, + WS_CHILD | WS_VISIBLE, + x, 0, 0, cs->cy, + hwnd, 0, COMDLG32_hInstance, NULL); + SetWindowSubclass(info->background_hwnd, NAVBAR_BACKGROUND_SubclassProc, BACKGROUND_SUBCLASS_ID, (DWORD_PTR)info); + SetWindowLongPtrW(hwnd, 0, (DWORD_PTR)info);
return DefWindowProcW(hwnd, msg, wparam, lparam); @@ -315,7 +364,7 @@ static LRESULT NAVBAR_Size(HWND hwnd, NAVBAR_INFO *info, UINT msg, WPARAM wparam
NAVBAR_CalcLayout(info);
- hdwp = BeginDeferWindowPos(info->crumbs_total_n); + hdwp = BeginDeferWindowPos(info->crumbs_total_n + 1); hdwp = NAVBAR_DoLayout(info, hdwp); EndDeferWindowPos(hdwp);
@@ -445,7 +494,7 @@ static LRESULT NAVBAR_SetPIDL(HWND hwnd, NAVBAR_INFO *info, UINT msg, WPARAM wpa
NAVBAR_CalcLayout(info);
- hdwp = BeginDeferWindowPos(info->crumbs_total_n); + hdwp = BeginDeferWindowPos(info->crumbs_total_n + 1); hdwp = NAVBAR_DoLayout(info, hdwp); EndDeferWindowPos(hdwp);