Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <wx/wx.h>
- class NonWxObject
- {
- public:
- void say_hello();
- };
- class Button : public wxFrame
- {
- private:
- NonWxObject thing;
- public:
- Button(const wxString& title);
- void OnQuit(wxCommandEvent& event);
- };
- /////////////////////////////////////////////
- #include "button.h"
- void NonWxObject::say_hello()
- {
- wxLogMessage("Hello");
- }
- Button::Button(const wxString& title)
- : wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(270, 150))
- {
- wxPanel* panel = new wxPanel(this, wxID_ANY);
- wxButton* button = new wxButton(panel, wxID_EXIT, wxT("Quit"),
- wxPoint(20, 20));
- Connect(wxID_EXIT, wxEVT_COMMAND_BUTTON_CLICKED,
- wxCommandEventHandler(Button::OnQuit));
- button->SetFocus();
- Centre();
- }
- void Button::OnQuit(wxCommandEvent& WXUNUSED(event))
- {
- thing.say_hello(); // Close(true);
- }
- //////////////////////////////////////////////////////////////////////////////////
- #include <wx/wx.h>
- class MyApp : public wxApp
- {
- public:
- virtual bool OnInit();
- };
- /////////////////////////////////////////////
- #include "main.h"
- #include "button.h"
- IMPLEMENT_APP(MyApp)
- bool MyApp::OnInit()
- {
- Button* btnapp = new Button(wxT("Button"));
- btnapp->Show(true);
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement