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
This commit is contained in:
Robin Dunn 2004-04-14 05:59:30 +00:00
parent b19d7524fc
commit 71a0c62f2f

View File

@ -34,6 +34,7 @@
#include "wx/frame.h" #include "wx/frame.h"
#include "wx/bitmap.h" #include "wx/bitmap.h"
#include "wx/statbmp.h" #include "wx/statbmp.h"
#include "wx/sizer.h"
#ifdef __VMS #ifdef __VMS
#pragma message disable nosimpint #pragma message disable nosimpint
@ -188,6 +189,15 @@ bool wxTaskBarIcon::SetIcon(const wxIcon& icon, const wxString& tooltip)
wxBitmap bmp; wxBitmap bmp;
bmp.CopyFromIcon(icon); bmp.CopyFromIcon(icon);
wxTaskBarIconArea *area = new wxTaskBarIconArea(this, m_iconWnd, bmp); 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()); m_iconWnd->SetClientSize(area->GetSize());
#if wxUSE_TOOLTIPS #if wxUSE_TOOLTIPS
if (!tooltip.empty()) if (!tooltip.empty())