mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
Improvements to keyboard handling (TAB)
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@660 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -62,10 +62,11 @@ END_EVENT_TABLE ()
|
||||
// ----------------------------------------------------------------------------- : Button with image and hover effect
|
||||
|
||||
|
||||
HoverButton::HoverButton(Window* parent, int id, const String& name, const Color& background)
|
||||
HoverButton::HoverButton(Window* parent, int id, const String& name, const Color& background, bool accepts_focus)
|
||||
: wxControl(parent, id, wxDefaultPosition, wxDefaultSize, wxNO_BORDER )
|
||||
, hover(false), focus(false), mouse_down(false), key_down(false)
|
||||
, background(background)
|
||||
, accepts_focus(accepts_focus)
|
||||
, last_drawn(nullptr)
|
||||
{
|
||||
loadBitmaps(name);
|
||||
@@ -136,6 +137,9 @@ void HoverButton::onKeyUp(wxKeyEvent& ev) {
|
||||
wxSize HoverButton::DoGetBestSize() const {
|
||||
return wxSize(bg_normal.GetWidth(), bg_normal.GetHeight());
|
||||
}
|
||||
bool HoverButton::AcceptsFocus() const {
|
||||
return wxControl::AcceptsFocus() && accepts_focus;
|
||||
}
|
||||
|
||||
const Bitmap* HoverButton::toDraw() const {
|
||||
return (mouse_down && hover) || key_down ? &bg_down
|
||||
|
||||
Reference in New Issue
Block a user