From 9fea4c7f27004797b37f341e3a36a2b74f33d391 Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Thu, 25 Oct 2012 03:00:42 -0700 Subject: [PATCH] Mac: Fix icons in Simple View Task and Project selection combo boxes; eliminate some unnecessary code --- checkin_notes | 11 ++++++++++- clientgui/mac/MacBitmapComboBox.cpp | 27 +++------------------------ clientgui/sg_CustomControls.cpp | 5 ++++- clientgui/sg_CustomControls.h | 2 ++ 4 files changed, 19 insertions(+), 26 deletions(-) diff --git a/checkin_notes b/checkin_notes index a13080ad95..69faca599c 100644 --- a/checkin_notes +++ b/checkin_notes @@ -6214,5 +6214,14 @@ Charlie 24 Oct 2012 Charlie 24 Oct 2012 - Fix transparent static text for wxWidgets 2.9.4. - clientgui\ + clientgui/ + sg_CustomControls.cpp,.h + +Charlie 25 Oct 2012 + - Mac: Fix icons in Simple View Task and Project selection combo boxes. + - Mac: Eliminate some unnecessary code. + + clientgui/ + mac/ + MacBitmapComboBox.cpp,.h sg_CustomControls.cpp,.h diff --git a/clientgui/mac/MacBitmapComboBox.cpp b/clientgui/mac/MacBitmapComboBox.cpp index 0d9ed9a53a..279e0e60b2 100644 --- a/clientgui/mac/MacBitmapComboBox.cpp +++ b/clientgui/mac/MacBitmapComboBox.cpp @@ -53,32 +53,11 @@ CBOINCBitmapChoice::~CBOINCBitmapChoice() { } void CBOINCBitmapChoice::SetItemBitmap(unsigned int n, const wxBitmap& bitmap) { - MenuHandle mhandle = (MenuHandle) m_popUpMenu; - unsigned int index = n + 1; - - if ( mhandle == NULL || index == 0) - return ; + wxMenuItem *item = m_popUpMenu->FindItemByPosition(n); - if ( bitmap.Ok() ) + if ( item && bitmap.Ok() ) { - CGImageRef imageRef = (CGImageRef)( bitmap.CreateCGImage() ) ; - SetMenuItemIconHandle( mhandle , index , - kMenuCGImageRefType , (Handle) imageRef ) ; - -#if 0// wxUSE_BMPBUTTON - ControlButtonContentInfo info ; - wxMacCreateBitmapButton( &info , bitmap ) ; - if ( info.contentType != kControlNoContent ) - { - if ( info.contentType == kControlContentIconRef ) - SetMenuItemIconHandle( mhandle , index , - kMenuIconRefType , (Handle) info.u.iconRef ) ; - else if ( info.contentType == kControlContentCGImageRef ) - SetMenuItemIconHandle( mhandle , index , - kMenuCGImageRefType , (Handle) info.u.imageRef ) ; - } - wxMacReleaseBitmapButton( &info ) ; -#endif + item->SetBitmap(bitmap); } } void CBOINCBitmapChoice::OnMouseDown(wxMouseEvent& event) { diff --git a/clientgui/sg_CustomControls.cpp b/clientgui/sg_CustomControls.cpp index c0ca49b958..9074efa36d 100644 --- a/clientgui/sg_CustomControls.cpp +++ b/clientgui/sg_CustomControls.cpp @@ -60,7 +60,9 @@ IMPLEMENT_DYNAMIC_CLASS (CTransparentStaticText, wxStaticText) BEGIN_EVENT_TABLE(CTransparentStaticText, wxStaticText) EVT_ERASE_BACKGROUND(CTransparentStaticText::OnEraseBackground) +#ifndef __WXMAC__ EVT_PAINT(CTransparentStaticText::OnPaint) +#endif END_EVENT_TABLE() @@ -83,12 +85,13 @@ bool CTransparentStaticText::Create(wxWindow* parent, wxWindowID id, const wxStr } +#ifndef __WXMAC__ void CTransparentStaticText::OnPaint(wxPaintEvent& /*event*/) { wxPaintDC dc(this); dc.SetFont(GetFont()); dc.DrawText(GetLabel(), 0, 0); } - +#endif IMPLEMENT_DYNAMIC_CLASS (CTransparentStaticTextAssociate, wxPanel) diff --git a/clientgui/sg_CustomControls.h b/clientgui/sg_CustomControls.h index a550791208..c1da829983 100644 --- a/clientgui/sg_CustomControls.h +++ b/clientgui/sg_CustomControls.h @@ -90,7 +90,9 @@ public: virtual bool HasTransparentBackground() { return true; }; virtual void OnEraseBackground(wxEraseEvent& /*event*/) {}; +#ifndef __WXMAC__ virtual void OnPaint(wxPaintEvent& event); +#endif DECLARE_EVENT_TABLE() };