mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
Changed scroll size of PackageList;
Added 'collapse' option for card notes; Made variant of DECLARE_TYPEOF for maps (two template arguments). git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@202 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -64,18 +64,26 @@ END_EVENT_TABLE ()
|
||||
// ----------------------------------------------------------------------------- : Button with image and hover effect
|
||||
|
||||
|
||||
HoverButton::HoverButton(Window* parent, int id, const String& name)
|
||||
: wxControl(parent, id, wxDefaultPosition, wxDefaultSize, wxNO_BORDER)
|
||||
, bg_normal(load_resource_image(name + _("_normal")))
|
||||
, bg_hover (load_resource_image(name + _("_hover")))
|
||||
, bg_focus (load_resource_image(name + _("_focus")))
|
||||
, bg_down (load_resource_image(name + _("_down")))
|
||||
HoverButton::HoverButton(Window* parent, int id, const String& name, const Color& background)
|
||||
: wxControl(parent, id, wxDefaultPosition, wxDefaultSize, wxNO_BORDER )
|
||||
, hover(false), focus(false), mouse_down(false), key_down(false)
|
||||
, last_drawn(nullptr)
|
||||
, background(background)
|
||||
{
|
||||
loadBitmaps(name);
|
||||
SetSize(DoGetBestSize());
|
||||
}
|
||||
|
||||
void HoverButton::loadBitmaps(const String& name) {
|
||||
if (bitmaps == name) return;
|
||||
bitmaps = name;
|
||||
bg_normal = Bitmap(load_resource_image(name + _("_normal")));
|
||||
bg_hover = Bitmap(load_resource_image(name + _("_hover")));
|
||||
bg_focus = Bitmap(load_resource_image(name + _("_focus")));
|
||||
bg_down = Bitmap(load_resource_image(name + _("_down")));
|
||||
Refresh(false);
|
||||
}
|
||||
|
||||
void HoverButton::onMouseEnter(wxMouseEvent&) {
|
||||
hover = true;
|
||||
refreshIfNeeded();
|
||||
@@ -151,10 +159,10 @@ void HoverButton::draw(DC& dc) {
|
||||
// clear background (for transparent button images)
|
||||
wxSize ws = GetClientSize();
|
||||
dc.SetPen(*wxTRANSPARENT_PEN);
|
||||
dc.SetBrush(Color(240,247,255));
|
||||
dc.SetBrush(background != wxNullColour ? background : wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
|
||||
dc.DrawRectangle(0, 0, ws.GetWidth(), ws.GetHeight());
|
||||
// draw button
|
||||
dc.DrawBitmap(*toDraw(), 0, 0);
|
||||
dc.DrawBitmap(*toDraw(), 0, 0, true);
|
||||
last_drawn = toDraw();
|
||||
}
|
||||
int HoverButton::drawDelta() const {
|
||||
|
||||
Reference in New Issue
Block a user