X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/daf06bb8bc05003007ad47eddcce8e33183cb6d4..26f60eb6a4944750bc45ace8873545a98b5b6f06:/demos/dbbrowse/dbbrowse.cpp diff --git a/demos/dbbrowse/dbbrowse.cpp b/demos/dbbrowse/dbbrowse.cpp index a2021652d8..dba13513bb 100644 --- a/demos/dbbrowse/dbbrowse.cpp +++ b/demos/dbbrowse/dbbrowse.cpp @@ -26,6 +26,8 @@ #ifndef WX_PRECOMP #include "wx/wx.h" #endif + +#include "wx/stockitem.h" //---------------------------------------------------------------------------------------- #ifndef __WXMSW__ #include "bitmaps/logo.xpm" @@ -39,9 +41,9 @@ //-- Some Global Vars for this file ------------------------------------------------------ //---------------------------------------------------------------------------------------- BEGIN_EVENT_TABLE(MainFrame, wxFrame) - EVT_MENU(QUIT, MainFrame::OnQuit) // Program End - EVT_MENU(ABOUT, MainFrame::OnAbout) // Program Discription - EVT_MENU(HELP, MainFrame::OnHelp) // Program Help + EVT_MENU(wxID_EXIT, MainFrame::OnQuit) // Program End + EVT_MENU(wxID_ABOUT, MainFrame::OnAbout) // Program Discription + EVT_MENU(wxID_HELP, MainFrame::OnHelp) // Program Help END_EVENT_TABLE() //---------------------------------------------------------------------------------------- @@ -97,14 +99,14 @@ bool MainApp::OnInit(void) // Does everything needed for a program start // Win-Registry : Workplace\HKEY_CURRENT_USERS\Software\%GetVendorName()\%GetAppName() //--------------------------------------------------------------------------------------- SetVendorName(_T("mj10777")); // Needed to get Configuration Information - SetAppName(_T("DBBrowse")); // "" , also needed for s_LangHelp + SetAppName(_T("DBBrowse")); // "" , also needed for s_LangHelp //--------------------------------------------------------------------------------------- // we're using wxConfig's "create-on-demand" feature: it will create the // config object when it's used for the first time. It has a number of // advantages compared with explicitly creating our wxConfig: // 1) we don't pay for it if we don't use it // 2) there is no danger to create it twice - + // application and vendor name are used by wxConfig to construct the name // of the config file/registry key and must be set before the first call // to Get() if you want to override the default values (the application @@ -120,7 +122,7 @@ bool MainApp::OnInit(void) // Does everything needed for a program start { Temp0.Empty(); p_ProgramCfg->Read(_T("/Local/langid"),&Temp0); // >const char *langid< can't be used here - if (Temp0 == _T("")) + if (Temp0.empty()) langid = _T("std"); // Standard language is "std" = english else langid = Temp0; @@ -185,7 +187,7 @@ bool MainApp::OnInit(void) // Does everything needed for a program start Temp0.Printf(_T("%s - %s"),GetAppName().c_str(),GetVendorName().c_str()); frame = new MainFrame((wxFrame *) NULL,(wxChar *) Temp0.c_str(),wxPoint(x,y),wxSize(w,h)); //--------------------------------------------------------------------------------------- - // Set the Backgroundcolour (only need if your are NOT using wxSYS_COLOUR_BACKGROUND) + // Set the Backgroundcolour (only needed if you are NOT using wxSYS_COLOUR_BACKGROUND) frame->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BACKGROUND)); // frame->SetBackgroundColour(wxColour(255, 255, 255)); // frame->SetBackgroundColour(* wxWHITE); @@ -206,24 +208,26 @@ bool MainApp::OnInit(void) // Does everything needed for a program start // Make a menubar wxMenu *file_menu = new wxMenu; wxMenu *help_menu = new wxMenu; - - help_menu->Append(HELP, _("&Help")); + + help_menu->Append(wxID_HELP, wxGetStockLabel(wxID_HELP)); help_menu->AppendSeparator(); - help_menu->Append(ABOUT, _("&About")); - file_menu->Append(QUIT, _("E&xit")); - + help_menu->Append(wxID_ABOUT, _("&About")); + file_menu->Append(wxID_EXIT, wxGetStockLabel(wxID_EXIT)); + wxMenuBar *menu_bar = new wxMenuBar; menu_bar->Append(file_menu, _("&File")); menu_bar->Append(help_menu, _("&Help")); frame->SetMenuBar(menu_bar); +#if wxUSE_STATUSBAR frame->CreateStatusBar(1); Temp0.Printf(_("%s has started !"),p_ProgramCfg->GetAppName().c_str()); frame->SetStatusText(Temp0, 0); +#endif // wxUSE_STATUSBAR //--------------------------------------------------------------------------------------- int width, height; frame->GetClientSize(&width, &height); //--------------------------------------------------------------------------------------- - frame->p_Splitter = new DocSplitterWindow(frame,-1); + frame->p_Splitter = new DocSplitterWindow(frame,wxID_ANY); // p_Splitter->SetCursor(wxCursor(wxCURSOR_PENCIL)); frame->pDoc = new MainDoc(); frame->pDoc->p_MainFrame = frame; @@ -248,23 +252,23 @@ bool MainApp::OnInit(void) // Does everything needed for a program start } frame->pDoc->p_Help = frame->p_Help; // Save the information to the document //--------------------------------------------------------------------------------------- - frame->Show(TRUE); // Show the frame + frame->Show(true); // Show the frame SetTopWindow(frame); // At this point the frame can be seen //--------------------------------------------------------------------------------------- // If you need a "Splash Screen" because of a long OnNewDocument, do it here if (!frame->pDoc->OnNewDocument()) - frame->Close(TRUE); + frame->Close(true); // Kill a "Splash Screen" because OnNewDocument, if you have one //--------------------------------------------------------------------------------------- - p_ProgramCfg->Flush(TRUE); // save the configuration - return TRUE; + p_ProgramCfg->Flush(true); // save the configuration + return true; } // bool MainApp::OnInit(void) //---------------------------------------------------------------------------------------- // My frame constructor //---------------------------------------------------------------------------------------- MainFrame::MainFrame(wxFrame *frame, wxChar *title, const wxPoint& pos, const wxSize& size): -wxFrame(frame, -1, title, pos, size) +wxFrame(frame, wxID_ANY, title, pos, size) { p_Splitter = NULL; pDoc = NULL; p_Help = NULL; // Keep the Pointers clean ! //--- Everything else is done in MainApp::OnInit() -------------------------------------- @@ -275,7 +279,7 @@ MainFrame::~MainFrame(void) { // Close the help frame; this will cause the config data to get written. if (p_Help->GetFrame()) // returns NULL if no help frame active - p_Help->GetFrame()->Close(TRUE); + p_Help->GetFrame()->Close(true); delete p_Help; // Memory Leak p_Help = NULL; // save the control's values to the config @@ -294,7 +298,7 @@ MainFrame::~MainFrame(void) // Get() it doesn't try to create one if there is none (definitely not what // we want here!) // delete wxConfigBase::Set((wxConfigBase *) NULL); - p_ProgramCfg->Flush(TRUE); // saves Objekt + p_ProgramCfg->Flush(true); // saves Objekt if (pDoc) // If we have a Valid Document delete pDoc; // Cleanup (MainDoc::~MainDoc) } // MainFrame::~MainFrame(void) @@ -302,7 +306,7 @@ MainFrame::~MainFrame(void) //---------------------------------------------------------------------------------------- void MainFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) { - Close(TRUE); + Close(true); } //----------------------------------------------------------------------------------------