1 #include "status_window.hpp"
8 class wx_status_panel
: public wxPanel
11 wx_status_panel(unsigned lines
);
12 void on_paint(wxPaintEvent
& e
);
16 wx_status_window
* wx_status_window::ptr
;
18 wx_status_panel::wx_status_panel(unsigned lines
)
19 : wxPanel(wx_status_window::ptr
)
23 wxSize s
= d
.GetTextExtent(wxT("MMMMMM"));
24 SetMinSize(wxSize(6 * s
.x
, lines
* s
.y
));
25 this->Connect(wxEVT_PAINT
, wxPaintEventHandler(wx_status_panel::on_paint
), NULL
, this);
30 wx_status_panel
* spanel
;
33 wx_status_window::wx_status_window()
34 : wxFrame(NULL
, wxID_ANY
, wxT("lsnes: Status"), wxDefaultPosition
, wxSize(-1, -1), secondary_window_style
)
37 wxFlexGridSizer
* top_s
= new wxFlexGridSizer(1, 1, 0, 0);
38 top_s
->Add(spanel
= new wx_status_panel(MAXSTATUS
));
39 top_s
->SetSizeHints(this);
44 wx_status_window::~wx_status_window()
49 void wx_status_panel::on_paint(wxPaintEvent
& e
)
54 auto& status
= window::get_emustatus();
55 for(auto i
: status
) {
56 std::string pstr
= i
.first
+ ": " + i
.second
;
57 wxSize s
= dc
.GetTextExtent(towxstring(pstr
));
58 dc
.DrawText(towxstring(pstr
), 0, y
);
64 void wx_status_window::notify_status_change()
66 if(!spanel
|| spanel
->dirty
)
72 bool wx_status_window::ShouldPreventAppExit() const