From 71a0c62f2f9b5ee66b5c84ad82a9fc3bde02a8df Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Wed, 14 Apr 2004 05:59:30 +0000 Subject: [PATCH] If the icon is smaller than the allotted space then center it. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26768 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/unix/taskbarx11.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/unix/taskbarx11.cpp b/src/unix/taskbarx11.cpp index 841786b04b..52d44d68a2 100644 --- a/src/unix/taskbarx11.cpp +++ b/src/unix/taskbarx11.cpp @@ -34,6 +34,7 @@ #include "wx/frame.h" #include "wx/bitmap.h" #include "wx/statbmp.h" +#include "wx/sizer.h" #ifdef __VMS #pragma message disable nosimpint @@ -188,6 +189,15 @@ bool wxTaskBarIcon::SetIcon(const wxIcon& icon, const wxString& tooltip) wxBitmap bmp; bmp.CopyFromIcon(icon); wxTaskBarIconArea *area = new wxTaskBarIconArea(this, m_iconWnd, bmp); + + // make a sizer to keep the icon centered, in case it is smaller than the + // alotted space. + wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL); + sizer->Add(0,0,1); + sizer->Add(area, 0, wxALIGN_CENTER); + sizer->Add(0,0,1); + m_iconWnd->SetSizer(sizer); + m_iconWnd->SetClientSize(area->GetSize()); #if wxUSE_TOOLTIPS if (!tooltip.empty())