- // menu
- wxMenu *file_menu = new wxMenu;
-
- file_menu->Append(Minimal_Delete, "&Delete", "Delete config file");
- file_menu->AppendSeparator();
- file_menu->Append(Minimal_About, "&About", "About this sample");
- file_menu->AppendSeparator();
- file_menu->Append(Minimal_Quit, "E&xit", "Exit the program");
- wxMenuBar *menu_bar = new wxMenuBar;
- menu_bar->Append(file_menu, "&File");
- SetMenuBar(menu_bar);
-
- CreateStatusBar();
-
- // child controls
- wxPanel *panel = new wxPanel(this);
- (void)new wxStaticText(panel, -1, "These controls remember their values!",
- wxPoint(10, 10), wxSize(300, 20));
- m_text = new wxTextCtrl(panel, -1, "", wxPoint(10, 40), wxSize(300, 20));
- m_check = new wxCheckBox(panel, -1, "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("/Controls");
-
- m_text->SetValue(pConfig->Read("Text", ""));
- m_check->SetValue(pConfig->Read("Check", 1l) != 0);
-
- // SetPath() understands ".."
- pConfig->SetPath("../MainFrame");
-
- // restore frame position and size
- int x = pConfig->Read("x", 50),
- y = pConfig->Read("y", 50),
- w = pConfig->Read("w", 350),
- h = pConfig->Read("h", 200);
- Move(x, y);
- SetClientSize(w, h);
+ 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"));
+ }