]> git.saurik.com Git - wxWidgets.git/commitdiff
If the icon is smaller than the allotted space then center it.
authorRobin Dunn <robin@alldunn.com>
Wed, 14 Apr 2004 05:59:30 +0000 (05:59 +0000)
committerRobin Dunn <robin@alldunn.com>
Wed, 14 Apr 2004 05:59:30 +0000 (05:59 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26768 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/unix/taskbarx11.cpp

index 841786b04bcd4d2ed29283204ae27e4d14d67f83..52d44d68a24f8fc335d8161b2d5be5a2dd0b106d 100644 (file)
@@ -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())