- // menu
- wxMenu *file_menu = new wxMenu;
-
- file_menu->Append(ConfTest_Delete, _T("&Delete"), _T("Delete config file"));
- file_menu->AppendSeparator();
- file_menu->Append(ConfTest_About, _T("&About\tF1"), _T("About this sample"));
- file_menu->AppendSeparator();
- file_menu->Append(ConfTest_Quit, _T("E&xit\tAlt-X"), _T("Exit the program"));
- wxMenuBar *menu_bar = new wxMenuBar;
- menu_bar->Append(file_menu, _T("&File"));
- SetMenuBar(menu_bar);
-
- CreateStatusBar();
-
- // child controls
- wxPanel *panel = new wxPanel(this);
- (void)new wxStaticText(panel, wxID_ANY, _T("These controls remember their values!"),
- wxPoint(10, 10), wxSize(300, 20));
- m_text = new wxTextCtrl(panel, wxID_ANY, _T(""), wxPoint(10, 40), wxSize(300, 20));
- m_check = new wxCheckBox(panel, wxID_ANY, _T("show welcome message box at startup"),
- wxPoint(10, 70), wxSize(300, 20));
-
- // restore the control's values from the config
-
- // NB: in this program, the config object is already created at this moment
- // because we had called Get() from MyApp::OnInit(). However, if you later
- // change the code and don't create it before this line, it won't break
- // anything - unlike if you manually create wxConfig object with Create()
- // or in any other way (then you must be sure to create it before using it!).
- wxConfigBase *pConfig = wxConfigBase::Get();
-
- // we could write Read("/Controls/Text") as well, it's just to show SetPath()
- pConfig->SetPath(_T("/Controls"));
-
- m_text->SetValue(pConfig->Read(_T("Text"), _T("")));
- m_check->SetValue(pConfig->Read(_T("Check"), 1l) != 0);
-
- // SetPath() understands ".."
- pConfig->SetPath(_T("../MainFrame"));
-
- // restore frame position and size
- int x = pConfig->Read(_T("x"), 50),
- y = pConfig->Read(_T("y"), 50),
- w = pConfig->Read(_T("w"), 350),
- h = pConfig->Read(_T("h"), 200);
- Move(x, y);
- SetClientSize(w, h);
-
- pConfig->SetPath(_T("/"));
- wxString s;
- if ( pConfig->Read(_T("TestValue"), &s) )
- {
- wxLogStatus(this, wxT("TestValue from config is '%s'"), s.c_str());
- }
- else
- {
- wxLogStatus(this, wxT("TestValue not found in the config"));
- }
+ SetIcon(wxICON(sample));
+
+ // menu
+ wxMenu *file_menu = new wxMenu;
+
+ file_menu->Append(wxID_DELETE, wxT("&Delete"), wxT("Delete config file"));
+ file_menu->AppendSeparator();
+ file_menu->Append(wxID_ABOUT, wxT("&About\tF1"), wxT("About this sample"));
+ file_menu->AppendSeparator();
+ file_menu->Append(wxID_EXIT, wxT("E&xit\tAlt-X"), wxT("Exit the program"));
+ wxMenuBar *menu_bar = new wxMenuBar;
+ menu_bar->Append(file_menu, wxT("&File"));
+ SetMenuBar(menu_bar);
+
+#if wxUSE_STATUSBAR
+ CreateStatusBar();
+#endif // wxUSE_STATUSBAR
+
+ // child controls
+ wxPanel *panel = new wxPanel(this);
+ (void)new wxStaticText(panel, wxID_ANY, wxT("These controls remember their values!"),
+ wxPoint(10, 10), wxSize(300, 20));
+ m_text = new wxTextCtrl(panel, wxID_ANY, wxT(""), wxPoint(10, 40), wxSize(300, 20));
+ m_check = new wxCheckBox(panel, wxID_ANY, wxT("show welcome message box at startup"),
+ wxPoint(10, 70), wxSize(300, 20));
+
+ // restore the control's values from the config
+
+ // NB: in this program, the config object is already created at this moment
+ // because we had called Get() from MyApp::OnInit(). However, if you later
+ // change the code and don't create it before this line, it won't break
+ // anything - unlike if you manually create wxConfig object with Create()
+ // or in any other way (then you must be sure to create it before using it!).
+ wxConfigBase *pConfig = wxConfigBase::Get();
+
+ // we could write Read("/Controls/Text") as well, it's just to show SetPath()
+ pConfig->SetPath(wxT("/Controls"));
+
+ m_text->SetValue(pConfig->Read(wxT("Text"), wxT("")));
+ m_check->SetValue(pConfig->Read(wxT("Check"), 1l) != 0);
+
+ // SetPath() understands ".."
+ pConfig->SetPath(wxT("../MainFrame"));
+
+ // restore frame position and size
+ int x = pConfig->Read(wxT("x"), 50),
+ y = pConfig->Read(wxT("y"), 50),
+ w = pConfig->Read(wxT("w"), 350),
+ h = pConfig->Read(wxT("h"), 200);
+ Move(x, y);
+ SetClientSize(w, h);
+
+ pConfig->SetPath(wxT("/"));
+ wxString s;
+ if ( pConfig->Read(wxT("TestValue"), &s) )
+ {
+ wxLogStatus(this, wxT("TestValue from config is '%s'"), s.c_str());
+ }
+ else
+ {
+ wxLogStatus(this, wxT("TestValue not found in the config"));
+ }