| |
---|
| | #include "wx/wx.h" |
---|
| | |
---|
| | using namespace std; |
---|
| | |
---|
| | #define std2wx(x) wxString((wxChar*)x.c_str(), strlen(x.c_str())) |
---|
| | |
---|
| | class wxmsgApp: public wxApp { |
---|
| | public: |
---|
| | wxmsgApp(const wxString& message, vector<string>& buttons, const wxString& default_label, int center, int nearmouse, int timeout); |
---|
| | virtual bool OnInit(); |
---|
| |
---|
| | wxPanel *m_panel; |
---|
| | vector<wxButton*> buttons; |
---|
| | }; |
---|
| | |
---|
| | wxmsgApp::wxmsgApp ( const wxString& _message, vector<string>& _buttons ) |
---|
| | wxmsgApp::wxmsgApp(const wxString& _message, vector<string>& _buttons, const wxString& default_label, int center, int nearmouse, int timeout) |
---|
| | : wxApp ( ) |
---|
| | { |
---|
| | // TODO: handle other parameters |
---|
| | message = _message; |
---|
| | buttons = _buttons; |
---|
| | } |
---|
| | |
---|
| |
---|
| | sizerMain->Add(sizerBtns); |
---|
| | |
---|
| | buttons = vector<wxButton*>(); |
---|
| | for ( i = 0; i < str_buttons.size(); i++ ) { |
---|
| | buttons.push_back(new wxButton(m_panel, wxmsg_BUTTON_BASE_ID + i, wxString(str_buttons[i].c_str(), wxConvUTF8))); |
---|
| | buttons.push_back(new wxButton(m_panel, wxmsg_BUTTON_BASE_ID + i, std2wx(str_buttons[i]))); |
---|
| | sizerBtns->Add(buttons[i]); |
---|
| | } |
---|
| | |
---|
| | m_panel->SetSizer(sizerMain); |
---|
| |
---|
| | } |
---|
| | fd.close(); |
---|
| | } |
---|
| | |
---|
| | wxmsgApp* app = new wxmsgApp(message, buttons, default_label, center, nearmouse, timeout); |
---|
| | wxmsgApp* app = new wxmsgApp(std2wx(message), buttons, std2wx(default_label), center, nearmouse, timeout); |
---|
| | |
---|
| | /* TODO: add wxWidgets interface here (instead of this cruft) */ |
---|
| | |
---|
| | cout << "message:" << endl << message << endl; |
---|
| |
---|
| | |