summaryrefslogtreecommitdiff
path: root/library/customButton.cpp
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 16:56:34 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 16:56:34 +0200
commit9084fa27f0f43cfa31dbc3a7ef87e2600c2dc3ca (patch)
tree61e2edc315a164d6fa3940b7de4b14dda0a9838c /library/customButton.cpp
parent1.15 (diff)
downloadFreeFileSync-9084fa27f0f43cfa31dbc3a7ef87e2600c2dc3ca.tar.gz
FreeFileSync-9084fa27f0f43cfa31dbc3a7ef87e2600c2dc3ca.tar.bz2
FreeFileSync-9084fa27f0f43cfa31dbc3a7ef87e2600c2dc3ca.zip
1.16
Diffstat (limited to 'library/customButton.cpp')
-rw-r--r--library/customButton.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/library/customButton.cpp b/library/customButton.cpp
index 5cfa8a5a..02cfdad0 100644
--- a/library/customButton.cpp
+++ b/library/customButton.cpp
@@ -10,15 +10,18 @@ wxButtonWithImage::wxButtonWithImage(wxWindow *parent,
long style,
const wxValidator& validator,
const wxString& name) :
- wxBitmapButton(parent, id, wxNullBitmap, pos, size, style | wxBU_AUTODRAW, validator, name)
+ wxBitmapButton(parent, id, wxNullBitmap, pos, size, style | wxBU_AUTODRAW, validator, name),
+ m_spaceAfter(0),
+ m_spaceBefore(0)
{
setTextLabel(label);
}
-void wxButtonWithImage::setBitmapFront(const wxBitmap& bitmap)
+void wxButtonWithImage::setBitmapFront(const wxBitmap& bitmap, unsigned spaceAfter)
{
- bitmapFront = bitmap;
+ bitmapFront = bitmap;
+ m_spaceAfter = spaceAfter;
refreshButtonLabel();
}
@@ -31,9 +34,10 @@ void wxButtonWithImage::setTextLabel(const wxString& text)
}
-void wxButtonWithImage::setBitmapBack(const wxBitmap& bitmap)
+void wxButtonWithImage::setBitmapBack(const wxBitmap& bitmap, unsigned spaceBefore)
{
- bitmapBack = bitmap;
+ bitmapBack = bitmap;
+ m_spaceBefore = spaceBefore;
refreshButtonLabel();
}
@@ -258,7 +262,7 @@ void wxButtonWithImage::refreshButtonLabel()
//calculate dimensions of new button
const int height = std::max(std::max(bitmapFront.GetHeight(), bitmapText.GetHeight()), bitmapBack.GetHeight());
- const int width = bitmapFront.GetWidth() + bitmapText.GetWidth() + bitmapBack.GetWidth();
+ const int width = bitmapFront.GetWidth() + m_spaceAfter + bitmapText.GetWidth() + m_spaceBefore + bitmapBack.GetWidth();
//create a transparent image
wxImage transparentImage(width, height, false);
@@ -274,12 +278,12 @@ void wxButtonWithImage::refreshButtonLabel()
if (bitmapText.IsOk())
writeToImage(wxImage(bitmapText.ConvertToImage()),
- wxPoint(bitmapFront.GetWidth(), (transparentImage.GetHeight() - bitmapText.GetHeight()) / 2),
+ wxPoint(bitmapFront.GetWidth() + m_spaceAfter, (transparentImage.GetHeight() - bitmapText.GetHeight()) / 2),
transparentImage);
if (bitmapBack.IsOk())
writeToImage(wxImage(bitmapBack.ConvertToImage()),
- wxPoint(bitmapFront.GetWidth() + bitmapText.GetWidth(), (transparentImage.GetHeight() - bitmapBack.GetHeight()) / 2),
+ wxPoint(bitmapFront.GetWidth() + m_spaceAfter + bitmapText.GetWidth() + m_spaceBefore, (transparentImage.GetHeight() - bitmapBack.GetHeight()) / 2),
transparentImage);
//adjust button size
bgstack15