// Purpose: Displays a wxDbTable in a wxGrid.
// Author: Roger Gammans, Paul Gammans
// Modified by:
-// Created:
+// Created:
// RCS-ID: $Id$
// Copyright: (c) 1999 The Computer Surgery (roger@computer-surgery.co.uk)
// Licence: wxWindows licence
#ifndef _WX_GENERIC_DBGRID_H_
#define _WX_GENERIC_DBGRID_H_
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma interface "dbgrid.h"
#endif
#if wxUSE_ODBC
-#if wxUSE_NEW_GRID
+#if wxUSE_GRID
#include "wx/log.h"
#include "wx/dbtable.h"
#define wxGRID_VALUE_DBAUTO _T("dbauto")
-WX_DECLARE_OBJARRAY(GenericKey,keyarray);
+WX_DECLARE_EXPORTED_OBJARRAY(GenericKey,keyarray);
static const int wxUSE_QUERY = -1;
-class wxDbGridColInfoBase
+class WXDLLIMPEXP_DBGRID wxDbGridColInfoBase
{
public:
//Default ctor
{
DbCol = ref.DbCol;
wxtypename = ref.wxtypename;
- Title = ref.Title;
+ Title = ref.Title;
}
//Empty destructor for member obj's
~wxDbGridColInfoBase() {}
-
+
int DbCol;
wxString wxtypename;
wxString Title;
};
-class wxDbGridColInfo
+class WXDLLIMPEXP_DBGRID wxDbGridColInfo
{
public:
wxDbGridColInfo(int colNo,
//Recurse to find length.
int Length() { return (m_next ? m_next->Length() +1 : 1); }
+ // Adds a new column info (2 step creation)
+ void AddColInfo (int colNo,
+ wxString type,
+ wxString title)
+ {
+ GetLast()->m_next = new wxDbGridColInfo (colNo, type, title, NULL);
+ }
+
+ // Searches last
+ wxDbGridColInfo *GetLast() { return (m_next ? m_next->GetLast() : this); }
+
+
protected:
wxDbGridColInfoBase m_data;
wxDbGridColInfo *m_next;
};
-class wxDbGridCellAttrProvider : public wxGridCellAttrProvider
+class WXDLLIMPEXP_DBGRID wxDbGridCellAttrProvider : public wxGridCellAttrProvider
{
public:
wxDbGridCellAttrProvider();
};
-class wxDbGridTableBase : public wxGridTableBase
+class WXDLLIMPEXP_DBGRID wxDbGridTableBase : public wxGridTableBase
{
public:
wxDbGridTableBase(wxDbTable *tab, wxDbGridColInfo *ColInfo,
- int count = wxUSE_QUERY, bool takeOwnership = true);
+ int count = wxUSE_QUERY, bool takeOwnership = TRUE);
~wxDbGridTableBase();
virtual int GetNumberRows()
{
wxLogDebug(" GetNumberRows() = %i",m_rowtotal);
- return m_rowtotal;
+ return m_rowtotal;
}
virtual int GetNumberCols()
- {
+ {
wxLogDebug(" GetNumberCols() = %i",m_nocols);
- return m_nocols;
+ return m_nocols;
}
virtual bool IsEmptyCell(int row, int col) ;
virtual wxString GetValue(int row, int col) ;
virtual void SetValueAsCustom(int row, int col, const wxString& typeName, void* value);
- virtual wxString wxDbGridTableBase::GetColLabelValue(int col);
+ virtual wxString GetColLabelValue(int col);
- virtual bool AssignDbTable(wxDbTable *tab, int count = wxUSE_QUERY, bool takeOwnership=true);
+ virtual bool AssignDbTable(wxDbTable *tab, int count = wxUSE_QUERY, bool takeOwnership=TRUE);
virtual void ValidateRow(int row);
virtual bool UpdateRow(int row) const
{
if (m_row != row)
- return true;
- else
+ return TRUE;
+ else
return Writeback();
}
-
+
private:
//Operates on the current row
bool Writeback() const;
bool m_rowmodified;
};
-#endif // #if wxUSE_NEW_GRID
+#endif // #if wxUSE_GRID
#endif // #if wxUSE_ODBC
-#endif _WX_GENERIC_DBGRID_H_
+#endif // _WX_GENERIC_DBGRID_H_