]> git.saurik.com Git - wxWidgets.git/blobdiff - demos/dbbrowse/dbgrid.cpp
rebaked after changing the version number
[wxWidgets.git] / demos / dbbrowse / dbgrid.cpp
index 638c82c8bb30e65ccf3c3da35cf0b4a38611cf71..d7a3b76bbd390b93bb70c8b21bcfe567d068bfc3 100644 (file)
@@ -8,13 +8,7 @@
 // Licence:     wxWindows license
 // RCS-ID:      $Id$
 //----------------------------------------------------------------------------------------
 // Licence:     wxWindows license
 // RCS-ID:      $Id$
 //----------------------------------------------------------------------------------------
-//-- all #ifdefs that the whole Project needs. -------------------------------------------
-//----------------------------------------------------------------------------------------
-#ifdef __GNUG__
-#pragma implementation
-#pragma interface
-#endif
-//----------------------------------------------------------------------------------------
+
 // For compilers that support precompilation, includes "wx/wx.h".
 #include "wx/wxprec.h"
 //----------------------------------------------------------------------------------------
 // For compilers that support precompilation, includes "wx/wx.h".
 #include "wx/wxprec.h"
 //----------------------------------------------------------------------------------------
@@ -56,7 +50,7 @@ END_EVENT_TABLE()
 
 //----------------------------------------------------------------------------------------
 //           wxListCtrl(parent, id, pos, size, style)
 
 //----------------------------------------------------------------------------------------
 //           wxListCtrl(parent, id, pos, size, style)
-//           wxGrid(parent,-1,wxPoint( 0, 0 ), wxSize( 400, 300 ) );
+//           wxGrid(parent,wxID_ANY,wxPoint( 0, 0 ), wxSize( 400, 300 ) );
 //----------------------------------------------------------------------------------------
 // DBGrid
 //----------------------------------------------------------------------------------------
 //----------------------------------------------------------------------------------------
 // DBGrid
 //----------------------------------------------------------------------------------------
@@ -65,11 +59,11 @@ END_EVENT_TABLE()
 DBGrid::DBGrid(wxWindow *parent, const wxWindowID id,const wxPoint& pos,const wxSize& size, long style):
 wxGrid(parent, id, pos, size, style)
 {
 DBGrid::DBGrid(wxWindow *parent, const wxWindowID id,const wxPoint& pos,const wxSize& size, long style):
 wxGrid(parent, id, pos, size, style)
 {
-    b_EditModus = FALSE;
+    b_EditModus = false;
     //---------------------------------------------------------------------------------------
     //---------------------------------------------------------------------------------------
-    popupMenu1 = new wxMenu(_T(""));
+    popupMenu1 = new wxMenu;
     popupMenu1->Append(GRID_EDIT, _("Edit Modus"));
     popupMenu1->Append(GRID_EDIT, _("Edit Modus"));
-    popupMenu2 = new wxMenu(_T(""));
+    popupMenu2 = new wxMenu;
     popupMenu2->Append(GRID_BROWSE, _("Browse Modus"));
 }
 
     popupMenu2->Append(GRID_BROWSE, _("Browse Modus"));
 }
 
@@ -99,7 +93,7 @@ int  DBGrid::OnTableView(wxString Table)
             if (!wxStrcmp((ct_BrowserDB->pTableInf+x)->tableName,Table))      // is this our Table ?
             {    // Yes, the Data of this Table shall be put into the Grid
                 int ValidTable = x;                                              // Save the Tablenumber
             if (!wxStrcmp((ct_BrowserDB->pTableInf+x)->tableName,Table))      // is this our Table ?
             {    // Yes, the Data of this Table shall be put into the Grid
                 int ValidTable = x;                                              // Save the Tablenumber
-                (db_Br+i_Which)->OnSelect(Table,FALSE);                          // Select * from "table"
+                (db_Br+i_Which)->OnSelect(Table,false);                          // Select * from "table"
                 // Set the local Pointer to the Column Information we are going to use
                 (db_Br+i_Which)->cl_BrowserDB = (ct_BrowserDB->pTableInf+x)->pColInf;
                 if ((ct_BrowserDB->pTableInf+x)->pColInf)                        // Valid pointer (!= NULL) ?
                 // Set the local Pointer to the Column Information we are going to use
                 (db_Br+i_Which)->cl_BrowserDB = (ct_BrowserDB->pTableInf+x)->pColInf;
                 if ((ct_BrowserDB->pTableInf+x)->pColInf)                        // Valid pointer (!= NULL) ?
@@ -120,20 +114,24 @@ int  DBGrid::OnTableView(wxString Table)
                     for (z=0;z<(db_Br+i_Which)->i_Records;z++)                      // Loop through the Records
                     {
                         Temp0.Printf(_T("%06d"),z+1);  SetRowLabelValue(z,Temp0);          // Set Row Lable Value
                     for (z=0;z<(db_Br+i_Which)->i_Records;z++)                      // Loop through the Records
                     {
                         Temp0.Printf(_T("%06d"),z+1);  SetRowLabelValue(z,Temp0);          // Set Row Lable Value
-                        (db_Br+i_Which)->OnGetNext((ct_BrowserDB->pTableInf+ValidTable)->numCols,FALSE);
+                        (db_Br+i_Which)->OnGetNext((ct_BrowserDB->pTableInf+ValidTable)->numCols,false);
                         for (y=0;y<(ct_BrowserDB->pTableInf+ValidTable)->numCols;y++) // Loop through the Fields
                         { // BrowserDB::OnGetNext Formats the field Value into tablename
                             SetCellValue(z, y,((db_Br+i_Which)->cl_BrowserDB+y)->tableName);
                         }
                         for (y=0;y<(ct_BrowserDB->pTableInf+ValidTable)->numCols;y++) // Loop through the Fields
                         { // BrowserDB::OnGetNext Formats the field Value into tablename
                             SetCellValue(z, y,((db_Br+i_Which)->cl_BrowserDB+y)->tableName);
                         }
+#if wxUSE_STATUSBAR
                         if (z % 50 == 0)
                         {
                             Temp0.Printf(_("-I-> DBGrid::OnTableView(%s) - Record %6d (from %d) has been read."),Table.c_str(),z,(db_Br+i_Which)->i_Records);
                             pDoc->p_MainFrame->SetStatusText(Temp0, 0);
                         }
                         if (z % 50 == 0)
                         {
                             Temp0.Printf(_("-I-> DBGrid::OnTableView(%s) - Record %6d (from %d) has been read."),Table.c_str(),z,(db_Br+i_Which)->i_Records);
                             pDoc->p_MainFrame->SetStatusText(Temp0, 0);
                         }
+#endif // wxUSE_STATUSBAR
                     }  // for (z=0;z<(db_Br+i_Which)->i_Records;z++)
                     Temp0.Printf(_("-I-> DBGrid::OnTableView(%s) - %6d Records have been read. - Time needed : %ld ms"),Table.c_str(),z,sw.Time());
                     wxLogMessage(Temp0);
                     }  // for (z=0;z<(db_Br+i_Which)->i_Records;z++)
                     Temp0.Printf(_("-I-> DBGrid::OnTableView(%s) - %6d Records have been read. - Time needed : %ld ms"),Table.c_str(),z,sw.Time());
                     wxLogMessage(Temp0);
+#if wxUSE_STATUSBAR
                     pDoc->p_MainFrame->SetStatusText(Temp0, 0);
                     pDoc->p_MainFrame->SetStatusText(Temp0, 0);
+#endif // wxUSE_STATUSBAR
                     // The Grid has been filled, now leave
                     goto Weiter;
                 }   // if ((ct_BrowserDB->pTableInf+x)->pColInf)
                     // The Grid has been filled, now leave
                     goto Weiter;
                 }   // if ((ct_BrowserDB->pTableInf+x)->pColInf)
@@ -156,7 +154,7 @@ Weiter:
 //----------------------------------------------------------------------------------------
 void DBGrid::OnModusEdit(wxCommandEvent& WXUNUSED(event))
 {
 //----------------------------------------------------------------------------------------
 void DBGrid::OnModusEdit(wxCommandEvent& WXUNUSED(event))
 {
-    b_EditModus = TRUE;             // Needed by PopupMenu
+    b_EditModus = true;             // Needed by PopupMenu
     EnableEditing(b_EditModus);     // Activate in-place Editing
     UpdateDimensions();             // Redraw the Grid
     // wxLogMessage(_("-I-> DBGrid::OnModusEdit() - End"));
     EnableEditing(b_EditModus);     // Activate in-place Editing
     UpdateDimensions();             // Redraw the Grid
     // wxLogMessage(_("-I-> DBGrid::OnModusEdit() - End"));
@@ -165,7 +163,7 @@ void DBGrid::OnModusEdit(wxCommandEvent& WXUNUSED(event))
 //----------------------------------------------------------------------------------------
 void DBGrid::OnModusBrowse(wxCommandEvent& WXUNUSED(event))
 {
 //----------------------------------------------------------------------------------------
 void DBGrid::OnModusBrowse(wxCommandEvent& WXUNUSED(event))
 {
-    b_EditModus = FALSE;            // Needed by PopupMenu
+    b_EditModus = false;            // Needed by PopupMenu
     EnableEditing(b_EditModus);     // Deactivate in-place Editing
     UpdateDimensions();             // Redraw the Grid
     // wxLogMessage(_("-I-> DBGrid::OnModusBrowse() - End"));
     EnableEditing(b_EditModus);     // Deactivate in-place Editing
     UpdateDimensions();             // Redraw the Grid
     // wxLogMessage(_("-I-> DBGrid::OnModusBrowse() - End"));
@@ -188,7 +186,7 @@ void DBGrid::OnEditorHidden( wxGridEvent& ev )
 //----------------------------------------------------------------------------------------
 void DBGrid::OnSelectCell( wxGridEvent& ev )
 {
 //----------------------------------------------------------------------------------------
 void DBGrid::OnSelectCell( wxGridEvent& ev )
 {
-    logBuf = _T("");
+    logBuf = wxEmptyString;
     logBuf << _T("Selected cell at row ") << ev.GetRow()
         << _T(" col ") << ev.GetCol();
     wxLogMessage( _T("%s"), logBuf.c_str() );
     logBuf << _T("Selected cell at row ") << ev.GetRow()
         << _T(" col ") << ev.GetCol();
     wxLogMessage( _T("%s"), logBuf.c_str() );