From 254292d714645037aed27fc239b6cf6aa4f014d5 Mon Sep 17 00:00:00 2001 From: Martin Fuchs Date: Sun, 14 Mar 2004 18:51:35 +0000 Subject: [PATCH] resize taskbar buttons on WM_SIZE svn path=/trunk/; revision=8729 --- reactos/subsys/system/explorer/Jamfile | 2 +- reactos/subsys/system/explorer/Makefile | 2 +- reactos/subsys/system/explorer/taskbar/taskbar.cpp | 13 ++++++++++--- reactos/subsys/system/explorer/taskbar/taskbar.h | 1 + .../subsys/system/explorer/taskbar/traynotify.cpp | 2 +- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/reactos/subsys/system/explorer/Jamfile b/reactos/subsys/system/explorer/Jamfile index 96bbdf01abd..6aaa45f9215 100644 --- a/reactos/subsys/system/explorer/Jamfile +++ b/reactos/subsys/system/explorer/Jamfile @@ -41,7 +41,7 @@ exe explorer : dialogs/searchprogram.cpp dialogs/settings.cpp i386-stub-win32.c - : WIN32 _WIN32_IE=0x0501 _WIN32_WINNT=0x0501 + : WIN32 _WIN32_IE=0x0600 _WIN32_WINNT=0x0501 -I$(INCLUDE) #nur für GCC: -fexceptions -Wall gdi32 diff --git a/reactos/subsys/system/explorer/Makefile b/reactos/subsys/system/explorer/Makefile index 7e835f2710f..b63bfbbbcd1 100644 --- a/reactos/subsys/system/explorer/Makefile +++ b/reactos/subsys/system/explorer/Makefile @@ -43,7 +43,7 @@ ifndef UNICODE UNICODE = 1 endif -CFLAGS = -DWIN32 -D_ROS_ -D_WIN32_IE=0x0501 -D_WIN32_WINNT=0x0501 -fexceptions -Wall -I$(W32API_PATH)/include +CFLAGS = -DWIN32 -D_ROS_ -D_WIN32_IE=0x0600 -D_WIN32_WINNT=0x0501 -fexceptions -Wall -I$(W32API_PATH)/include RCFLAGS = -DWIN32 -D_ROS_ -D__WINDRES__ --include-dir $(W32API_PATH)/include LFLAGS = -Wl,--subsystem,windows diff --git a/reactos/subsys/system/explorer/taskbar/taskbar.cpp b/reactos/subsys/system/explorer/taskbar/taskbar.cpp index ff015aab44a..c7ce5caa480 100644 --- a/reactos/subsys/system/explorer/taskbar/taskbar.cpp +++ b/reactos/subsys/system/explorer/taskbar/taskbar.cpp @@ -58,6 +58,7 @@ TaskBarMap::~TaskBarMap() TaskBar::TaskBar(HWND hwnd) : super(hwnd) { + _last_btn_width = 0; } TaskBar::~TaskBar() @@ -86,13 +87,14 @@ LRESULT TaskBar::Init(LPCREATESTRUCT pcs) _htoolbar = CreateToolbarEx(_hwnd, WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN| - CCS_TOP|CCS_NODIVIDER | TBSTYLE_LIST|TBSTYLE_TOOLTIPS|TBSTYLE_WRAPABLE, + CCS_TOP|CCS_NODIVIDER | TBSTYLE_LIST|TBSTYLE_TOOLTIPS|TBSTYLE_WRAPABLE,//|TBSTYLE_AUTOSIZE IDW_TASKTOOLBAR, 0, 0, 0, NULL, 0, 0, 0, 16, 16, sizeof(TBBUTTON)); SendMessage(_htoolbar, TB_SETBUTTONWIDTH, 0, MAKELONG(TASKBUTTONWIDTH_MAX,TASKBUTTONWIDTH_MAX)); //SendMessage(_htoolbar, TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_MIXEDBUTTONS); //SendMessage(_htoolbar, TB_SETDRAWTEXTFLAGS, DT_CENTER|DT_VCENTER, DT_CENTER|DT_VCENTER); //SetWindowFont(_htoolbar, GetStockFont(ANSI_VAR_FONT), FALSE); + //SendMessage(_htoolbar, TB_SETPADDING, 0, MAKELPARAM(8,8)); _next_id = IDC_FIRST_APP; @@ -110,6 +112,7 @@ LRESULT TaskBar::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam) switch(nmsg) { case WM_SIZE: SendMessage(_htoolbar, WM_SIZE, 0, 0); + ResizeButtons(); break; case WM_TIMER: @@ -463,7 +466,11 @@ void TaskBar::ResizeButtons() else if (btn_width > TASKBUTTONWIDTH_MAX) btn_width = TASKBUTTONWIDTH_MAX; - SendMessage(_htoolbar, TB_SETBUTTONWIDTH, 0, MAKELONG(btn_width,btn_width)); - SendMessage(_htoolbar, TB_AUTOSIZE, 0, 0); + if (btn_width != _last_btn_width) { + _last_btn_width = btn_width; + + SendMessage(_htoolbar, TB_SETBUTTONWIDTH, 0, MAKELONG(btn_width,btn_width)); + SendMessage(_htoolbar, TB_AUTOSIZE, 0, 0); + } } } diff --git a/reactos/subsys/system/explorer/taskbar/taskbar.h b/reactos/subsys/system/explorer/taskbar/taskbar.h index 0e66b449b6a..9b8a7cd4c1a 100644 --- a/reactos/subsys/system/explorer/taskbar/taskbar.h +++ b/reactos/subsys/system/explorer/taskbar/taskbar.h @@ -84,6 +84,7 @@ protected: TaskBarMap _map; int _next_id; WindowHandle _last_foreground_wnd; + int _last_btn_width; LRESULT Init(LPCREATESTRUCT pcs); LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam); diff --git a/reactos/subsys/system/explorer/taskbar/traynotify.cpp b/reactos/subsys/system/explorer/taskbar/traynotify.cpp index 18edddb1be6..9fa62f65a58 100644 --- a/reactos/subsys/system/explorer/taskbar/traynotify.cpp +++ b/reactos/subsys/system/explorer/taskbar/traynotify.cpp @@ -108,7 +108,7 @@ NotifyArea::NotifyArea(HWND hwnd) _clock_width = 0; _show_hidden = false; - _tooltip.add(_hwnd, _hwnd); + _tooltip.add(_hwnd, _hwnd); ///@todo use one area for each icon } LRESULT NotifyArea::Init(LPCREATESTRUCT pcs)