Hack up wx to support @2x images in the toolbar. Oh please let's switch to Qt...
This commit is contained in:
parent
624c92f97e
commit
693cee36cb
|
@ -305,7 +305,13 @@ wxBitmap::
|
|||
#endif
|
||||
ConvertToDisabled(unsigned char brightness) const
|
||||
{
|
||||
return ConvertToImage().ConvertToDisabled(brightness);
|
||||
// XXX comex: scale support
|
||||
wxImage disabledImage = ConvertToImage().ConvertToDisabled(brightness);
|
||||
#ifdef __APPLE__
|
||||
return wxBitmap(disabledImage, -1, GetScaleFactor());
|
||||
#else
|
||||
return disabledImage;
|
||||
#endif
|
||||
}
|
||||
#endif // wxUSE_IMAGE
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// XXX comex: scale support
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Name: src/aui/auibar.cpp
|
||||
|
@ -279,11 +280,11 @@ void wxAuiDefaultToolBarArt::DrawButton(
|
|||
{
|
||||
bmpX = rect.x +
|
||||
(rect.width/2) -
|
||||
(item.GetBitmap().GetWidth()/2);
|
||||
(item.GetBitmap().GetScaledWidth()/2);
|
||||
|
||||
bmpY = rect.y +
|
||||
((rect.height-textHeight)/2) -
|
||||
(item.GetBitmap().GetHeight()/2);
|
||||
(item.GetBitmap().GetScaledHeight()/2);
|
||||
|
||||
textX = rect.x + (rect.width/2) - (textWidth/2) + 1;
|
||||
textY = rect.y + rect.height - textHeight - 1;
|
||||
|
@ -294,9 +295,9 @@ void wxAuiDefaultToolBarArt::DrawButton(
|
|||
|
||||
bmpY = rect.y +
|
||||
(rect.height/2) -
|
||||
(item.GetBitmap().GetHeight()/2);
|
||||
(item.GetBitmap().GetScaledHeight()/2);
|
||||
|
||||
textX = bmpX + 3 + item.GetBitmap().GetWidth();
|
||||
textX = bmpX + 3 + item.GetBitmap().GetScaledWidth();
|
||||
textY = rect.y +
|
||||
(rect.height/2) -
|
||||
(textHeight/2);
|
||||
|
@ -390,20 +391,20 @@ void wxAuiDefaultToolBarArt::DrawDropDownButton(
|
|||
|
||||
dropBmpX = dropDownRect.x +
|
||||
(dropDownRect.width/2) -
|
||||
(m_buttonDropDownBmp.GetWidth()/2);
|
||||
(m_buttonDropDownBmp.GetScaledWidth()/2);
|
||||
dropBmpY = dropDownRect.y +
|
||||
(dropDownRect.height/2) -
|
||||
(m_buttonDropDownBmp.GetHeight()/2);
|
||||
(m_buttonDropDownBmp.GetScaledHeight()/2);
|
||||
|
||||
|
||||
if (m_textOrientation == wxAUI_TBTOOL_TEXT_BOTTOM)
|
||||
{
|
||||
bmpX = buttonRect.x +
|
||||
(buttonRect.width/2) -
|
||||
(item.GetBitmap().GetWidth()/2);
|
||||
(item.GetBitmap().GetScaledWidth()/2);
|
||||
bmpY = buttonRect.y +
|
||||
((buttonRect.height-textHeight)/2) -
|
||||
(item.GetBitmap().GetHeight()/2);
|
||||
(item.GetBitmap().GetScaledHeight()/2);
|
||||
|
||||
textX = rect.x + (rect.width/2) - (textWidth/2) + 1;
|
||||
textY = rect.y + rect.height - textHeight - 1;
|
||||
|
@ -414,9 +415,9 @@ void wxAuiDefaultToolBarArt::DrawDropDownButton(
|
|||
|
||||
bmpY = rect.y +
|
||||
(rect.height/2) -
|
||||
(item.GetBitmap().GetHeight()/2);
|
||||
(item.GetBitmap().GetScaledHeight()/2);
|
||||
|
||||
textX = bmpX + 3 + item.GetBitmap().GetWidth();
|
||||
textX = bmpX + 3 + item.GetBitmap().GetScaledWidth();
|
||||
textY = rect.y +
|
||||
(rect.height/2) -
|
||||
(textHeight/2);
|
||||
|
@ -553,8 +554,8 @@ wxSize wxAuiDefaultToolBarArt::GetToolSize(
|
|||
if (!item.GetBitmap().IsOk() && !(m_flags & wxAUI_TB_TEXT))
|
||||
return wxSize(16,16);
|
||||
|
||||
int width = item.GetBitmap().GetWidth();
|
||||
int height = item.GetBitmap().GetHeight();
|
||||
int width = item.GetBitmap().GetScaledWidth();
|
||||
int height = item.GetBitmap().GetScaledHeight();
|
||||
|
||||
if (m_flags & wxAUI_TB_TEXT)
|
||||
{
|
||||
|
@ -694,8 +695,8 @@ void wxAuiDefaultToolBarArt::DrawOverflowButton(wxDC& dc,
|
|||
}
|
||||
}
|
||||
|
||||
int x = rect.x+1+(rect.width-m_overflowBmp.GetWidth())/2;
|
||||
int y = rect.y+1+(rect.height-m_overflowBmp.GetHeight())/2;
|
||||
int x = rect.x+1+(rect.width-m_overflowBmp.GetScaledWidth())/2;
|
||||
int y = rect.y+1+(rect.height-m_overflowBmp.GetScaledHeight())/2;
|
||||
dc.DrawBitmap(m_overflowBmp, x, y, true);
|
||||
}
|
||||
|
||||
|
|
|
@ -1225,6 +1225,8 @@ bool wxBitmap::LoadFile(const wxString& filename, wxBitmapType type)
|
|||
{
|
||||
UnRef();
|
||||
|
||||
// XXX comex: how exactly is this supposed to work!? @2x support isn't used in this case
|
||||
/*
|
||||
wxBitmapHandler *handler = FindHandler(type);
|
||||
|
||||
if ( handler )
|
||||
|
@ -1234,6 +1236,7 @@ bool wxBitmap::LoadFile(const wxString& filename, wxBitmapType type)
|
|||
return handler->LoadFile(this, filename, type, -1, -1);
|
||||
}
|
||||
else
|
||||
*/
|
||||
{
|
||||
#if wxUSE_IMAGE
|
||||
double scale = 1.0;
|
||||
|
|
Loading…
Reference in New Issue