Mac: Fix icons in Simple View Task and Project selection combo boxes; eliminate some unnecessary code

This commit is contained in:
Charlie Fenton 2012-10-25 03:00:42 -07:00 committed by Oliver Bock
parent 4ac21f182d
commit 9fea4c7f27
4 changed files with 19 additions and 26 deletions

View File

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

View File

@ -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;
wxMenuItem *item = m_popUpMenu->FindItemByPosition(n);
if ( mhandle == NULL || index == 0)
return ;
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) {

View File

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

View File

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