summaryrefslogtreecommitdiff
path: root/wx+/bitmap_button.h
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2020-08-31 20:07:13 -0400
committerB Stack <bgstack15@gmail.com>2020-08-31 20:07:13 -0400
commit8a27fa9c617533e76673ce61a65e2ba869b52208 (patch)
treeacfdfb3e1046db87040477033fda0df76d92916a /wx+/bitmap_button.h
parentMerge branch '11.0' into 'master' (diff)
downloadFreeFileSync-8a27fa9c617533e76673ce61a65e2ba869b52208.tar.gz
FreeFileSync-8a27fa9c617533e76673ce61a65e2ba869b52208.tar.bz2
FreeFileSync-8a27fa9c617533e76673ce61a65e2ba869b52208.zip
add upstream 11.1
Diffstat (limited to 'wx+/bitmap_button.h')
-rw-r--r--wx+/bitmap_button.h17
1 files changed, 11 insertions, 6 deletions
diff --git a/wx+/bitmap_button.h b/wx+/bitmap_button.h
index 508a72fc..8fe8e146 100644
--- a/wx+/bitmap_button.h
+++ b/wx+/bitmap_button.h
@@ -26,7 +26,7 @@ public:
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
- const wxString& name = wxButtonNameStr) :
+ const wxString& name = wxASCII_STR(wxButtonNameStr)) :
wxBitmapButton(parent, id, wxNullBitmap, pos, size, style, validator, name)
{
SetLabel(label);
@@ -98,9 +98,10 @@ wxBitmap renderSelectedButton(const wxSize& sz)
wxBitmap bmp(sz); //seems we don't need to pass 24-bit depth here even for high-contrast color schemes
{
wxMemoryDC dc(bmp);
- dc.SetBrush(wxColor(0xcc, 0xe4, 0xf8)); //light blue
- dc.SetPen (wxColor(0x79, 0xbc, 0xed)); //medium blue
- dc.DrawRectangle(wxRect(bmp.GetSize()));
+
+ const wxColor borderCol(0x79, 0xbc, 0xed); //medium blue
+ const wxColor innerCol (0xcc, 0xe4, 0xf8); //light blue
+ drawFilledRectangle(dc, wxRect(bmp.GetSize()), fastFromDIP(1), borderCol, innerCol);
}
return bmp;
}
@@ -116,7 +117,8 @@ wxBitmap renderPressedButton(const wxSize& sz)
const wxColor colTo(0x11, 0x79, 0xfe); //light blue
wxMemoryDC dc(bmp);
- dc.SetBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
+ dc.SetPen(*wxTRANSPARENT_PEN); //wxTRANSPARENT_PEN is about 2x faster than redundantly drawing with col!
+
wxRect rect(bmp.GetSize());
const int borderSize = fastFromDIP(3);
@@ -125,10 +127,13 @@ wxBitmap renderPressedButton(const wxSize& sz)
const wxColor colGradient((colFrom.Red () * (borderSize - i) + colTo.Red () * i) / borderSize,
(colFrom.Green() * (borderSize - i) + colTo.Green() * i) / borderSize,
(colFrom.Blue () * (borderSize - i) + colTo.Blue () * i) / borderSize);
- dc.SetPen(colGradient);
+ dc.SetBrush(colGradient);
dc.DrawRectangle(rect);
rect.Deflate(1);
}
+
+ dc.SetBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
+ dc.DrawRectangle(rect);
}
return bmp;
}
bgstack15