]> git.saurik.com Git - wxWidgets.git/blobdiff - demos/dbbrowse/dbbrowse.cpp
Fixes to allow compilation with no wchar_t (djgpp probably has a real wchar_t
[wxWidgets.git] / demos / dbbrowse / dbbrowse.cpp
index a2021652d872fee313b01988b0d45126bba085a1..17c7e75a559b93270081722b70ccf71cbca26896 100644 (file)
@@ -26,6 +26,8 @@
 #ifndef WX_PRECOMP
 #include "wx/wx.h"
 #endif
 #ifndef WX_PRECOMP
 #include "wx/wx.h"
 #endif
+
+#include "wx/stockitem.h"
 //----------------------------------------------------------------------------------------
 #ifndef __WXMSW__
 #include "bitmaps/logo.xpm"
 //----------------------------------------------------------------------------------------
 #ifndef __WXMSW__
 #include "bitmaps/logo.xpm"
@@ -39,9 +41,9 @@
 //-- Some Global Vars for this file ------------------------------------------------------
 //----------------------------------------------------------------------------------------
 BEGIN_EVENT_TABLE(MainFrame, wxFrame)
 //-- 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()
 
 //----------------------------------------------------------------------------------------
 END_EVENT_TABLE()
 
 //----------------------------------------------------------------------------------------
@@ -91,20 +93,21 @@ bool MainApp::OnInit(void)  // Does everything needed for a program start
         langid   = argv[1];         // cz, std, fr, de , pl
         break;
     case 1:
         langid   = argv[1];         // cz, std, fr, de , pl
         break;
     case 1:
+    case 0:
         break;
     };
     //---------------------------------------------------------------------------------------
     // Win-Registry : Workplace\HKEY_CURRENT_USERS\Software\%GetVendorName()\%GetAppName()
     //---------------------------------------------------------------------------------------
     SetVendorName(_T("mj10777"));           // Needed to get Configuration Information
         break;
     };
     //---------------------------------------------------------------------------------------
     // 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
     //---------------------------------------------------------------------------------------
     // 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
     // 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 +123,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
     {
         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;
             langid = _T("std");  // Standard language is "std" = english
         else
             langid = Temp0;
@@ -185,7 +188,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));
     //---------------------------------------------------------------------------------------
     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);
     frame->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BACKGROUND));
     // frame->SetBackgroundColour(wxColour(255, 255, 255));
     // frame->SetBackgroundColour(* wxWHITE);
@@ -206,24 +209,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;
     // 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->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);
     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);
     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);
     //---------------------------------------------------------------------------------------
     //---------------------------------------------------------------------------------------
     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;
     // p_Splitter->SetCursor(wxCursor(wxCURSOR_PENCIL));
     frame->pDoc                       = new MainDoc();
     frame->pDoc->p_MainFrame          = frame;
@@ -248,23 +253,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->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())
     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
     //---------------------------------------------------------------------------------------
     // 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):
 } // 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() --------------------------------------
 {
     p_Splitter = NULL; pDoc = NULL; p_Help = NULL;    // Keep the Pointers clean !
     //--- Everything else is done in MainApp::OnInit() --------------------------------------
@@ -275,7 +280,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
 {
     // 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
     delete p_Help;  // Memory Leak
     p_Help = NULL;
     // save the control's values to the config
@@ -294,7 +299,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);
     // 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)
     if (pDoc)                         // If we have a Valid Document
         delete pDoc;                     // Cleanup (MainDoc::~MainDoc)
 } // MainFrame::~MainFrame(void)
@@ -302,7 +307,7 @@ MainFrame::~MainFrame(void)
 //----------------------------------------------------------------------------------------
 void MainFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
 {
 //----------------------------------------------------------------------------------------
 void MainFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
 {
-    Close(TRUE);
+    Close(true);
 }
 
 //----------------------------------------------------------------------------------------
 }
 
 //----------------------------------------------------------------------------------------