resize taskbar buttons on WM_SIZE

svn path=/trunk/; revision=8729
This commit is contained in:
Martin Fuchs 2004-03-14 18:51:35 +00:00
parent 38b3d10879
commit 254292d714
5 changed files with 14 additions and 6 deletions

View file

@ -41,7 +41,7 @@ exe explorer :
dialogs/searchprogram.cpp
dialogs/settings.cpp
i386-stub-win32.c
: <define>WIN32 <define>_WIN32_IE=0x0501 <define>_WIN32_WINNT=0x0501
: <define>WIN32 <define>_WIN32_IE=0x0600 <define>_WIN32_WINNT=0x0501
<cxxflags>-I$(INCLUDE)
#nur für GCC: <cxxflags>-fexceptions <cxxflags>-Wall
<find-shared-library>gdi32

View file

@ -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

View file

@ -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);
}
}
}

View file

@ -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);

View file

@ -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)