diff --git a/include/platform/wxwidgets/window_status.hpp b/include/platform/wxwidgets/window_status.hpp index effa36a0..285e5d67 100644 --- a/include/platform/wxwidgets/window_status.hpp +++ b/include/platform/wxwidgets/window_status.hpp @@ -10,11 +10,13 @@ public: class panel : public wxPanel { public: - panel(wxWindow* _parent, unsigned lines); + panel(wxWindow* _parent, wxWindow* tfocus, unsigned lines); bool AcceptsFocus () const; + void on_focus(wxFocusEvent& e); void on_paint(wxPaintEvent& e); bool dirty; wxWindow* parent; + wxWindow* tfocuswin; }; wxwin_status(); ~wxwin_status(); diff --git a/src/platform/wxwidgets/mainwindow.cpp b/src/platform/wxwidgets/mainwindow.cpp index 2b95dd75..49bdd8df 100644 --- a/src/platform/wxwidgets/mainwindow.cpp +++ b/src/platform/wxwidgets/mainwindow.cpp @@ -629,7 +629,7 @@ wxwin_mainwindow::wxwin_mainwindow() Centre(); toplevel = new wxFlexGridSizer(1, 2, 0, 0); toplevel->Add(gpanel = new panel(this), 1, wxGROW); - toplevel->Add(spanel = new wxwin_status::panel(this, 20), 1, wxGROW); + toplevel->Add(spanel = new wxwin_status::panel(this, gpanel, 20), 1, wxGROW); spanel_shown = true; toplevel->SetSizeHints(this); SetSizer(toplevel); diff --git a/src/platform/wxwidgets/status.cpp b/src/platform/wxwidgets/status.cpp index 09407063..9505d6c1 100644 --- a/src/platform/wxwidgets/status.cpp +++ b/src/platform/wxwidgets/status.cpp @@ -4,15 +4,17 @@ #define MAXSTATUS 30 -wxwin_status::panel::panel(wxWindow* _parent, unsigned lines) +wxwin_status::panel::panel(wxWindow* _parent, wxWindow* focuswin, unsigned lines) : wxPanel(_parent) { + tfocuswin = focuswin; parent = _parent; dirty = false; wxMemoryDC d; wxSize s = d.GetTextExtent(wxT("MMMMMM")); SetMinSize(wxSize(4 * s.x, lines * s.y)); this->Connect(wxEVT_PAINT, wxPaintEventHandler(wxwin_status::panel::on_paint), NULL, this); + this->Connect(wxEVT_SET_FOCUS, wxFocusEventHandler(wxwin_status::panel::on_focus), NULL, this); } bool wxwin_status::panel::AcceptsFocus () const @@ -20,12 +22,18 @@ bool wxwin_status::panel::AcceptsFocus () const return false; } +void wxwin_status::panel::on_focus(wxFocusEvent& e) +{ + if(tfocuswin) + tfocuswin->SetFocus(); +} + wxwin_status::wxwin_status() : wxFrame(NULL, wxID_ANY, wxT("lsnes: Status"), wxDefaultPosition, wxSize(-1, -1), wxMINIMIZE_BOX | wxSYSTEM_MENU | wxCAPTION | wxCLIP_CHILDREN) { wxFlexGridSizer* top_s = new wxFlexGridSizer(1, 1, 0, 0); - top_s->Add(spanel = new wxwin_status::panel(this, MAXSTATUS)); + top_s->Add(spanel = new wxwin_status::panel(this, NULL, MAXSTATUS)); top_s->SetSizeHints(this); SetSizer(top_s); Fit();