Advertisement
Falseclock

Untitled

May 4th, 2021
880
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.80 KB | None | 0 0
  1. // wxWidgets "Hello World" Program
  2. // For compilers that support precompilation, includes "wx/wx.h".
  3. #include <wx/wxprec.h>
  4. #include <wx/stc/stc.h>
  5.  
  6. #ifndef WX_PRECOMP
  7. #include <wx/wx.h>
  8. #endif
  9. class MyApp : public wxApp
  10. {
  11. public:
  12.     virtual bool OnInit();
  13. };
  14. class MyFrame : public wxFrame
  15. {
  16. public:
  17.     MyFrame();
  18. private:
  19.     void OnHello(wxCommandEvent& event);
  20.     void OnExit(wxCommandEvent& event);
  21.     void OnAbout(wxCommandEvent& event);
  22. };
  23. enum
  24. {
  25.     ID_Hello = 1
  26. };
  27. wxIMPLEMENT_APP(MyApp);
  28. bool MyApp::OnInit()
  29. {
  30.     MyFrame* frame = new MyFrame();
  31.     frame->Show(true);
  32.     return true;
  33. }
  34. MyFrame::MyFrame()
  35.     : wxFrame(NULL, wxID_ANY, "Hello World")
  36. {
  37.     wxMenu* menuFile = new wxMenu;
  38.     menuFile->Append(ID_Hello, "&Hello...\tCtrl-H",
  39.         "Help string shown in status bar for this menu item");
  40.     menuFile->AppendSeparator();
  41.     menuFile->Append(wxID_EXIT);
  42.     wxMenu* menuHelp = new wxMenu;
  43.     menuHelp->Append(wxID_ABOUT);
  44.     wxMenuBar* menuBar = new wxMenuBar;
  45.     menuBar->Append(menuFile, "&File");
  46.     menuBar->Append(menuHelp, "&Help");
  47.     SetMenuBar(menuBar);
  48.     CreateStatusBar();
  49.     SetStatusText("Welcome to wxWidgets!");
  50.     Bind(wxEVT_MENU, &MyFrame::OnHello, this, ID_Hello);
  51.     Bind(wxEVT_MENU, &MyFrame::OnAbout, this, wxID_ABOUT);
  52.     Bind(wxEVT_MENU, &MyFrame::OnExit, this, wxID_EXIT);
  53.  
  54.    wxStyledTextCtrl* sqlPane = new wxStyledTextCtrl(this, wxID_ANY);
  55.    sqlPane->SetText("simple text");
  56.  
  57.  
  58. }
  59. void MyFrame::OnExit(wxCommandEvent& event)
  60. {
  61.     Close(true);
  62. }
  63. void MyFrame::OnAbout(wxCommandEvent& event)
  64. {
  65.     wxMessageBox("This is a wxWidgets Hello World example",
  66.         "About Hello World", wxOK | wxICON_INFORMATION);
  67. }
  68. void MyFrame::OnHello(wxCommandEvent& event)
  69. {
  70.     wxLogMessage("Hello world from wxWidgets!");
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement