wxPg::Grid_table Class Reference

A table for wxGrid. More...

List of all members.

Public Member Functions

 Grid_table ()
 Create new object.
 Grid_table (Database *db)
 Create new object.
virtual ~Grid_table ()
 Destructor.
void database (Database *db)
 Set database connection for this object.
Databasedatabase ()
 Get database, used by this object.
Query_browserquery ()
 Get internally used wxPg::Query_browser.
void use_midle_fetch (bool use)
 Fetch buffer so, that neccessairy record is in the midle.
bool use_midle_fetch () const
 Return current fetch strategy.
void bind_defs (Grid_bind_def *defs, bool delete_defs=true)
 Set binding definitions for this object.
Grid_bind_defbind_defs ()
 Return current binding definitions.
void bind (int col_idx, const wxString &field)
 Bind grid column to database field.
void bind (const wxString &field)
 Bind next grid column to database field.
void bind (const std::map< int, wxString > &col_bindings)
 Bind grid columns to database fields.
const std::map< int, wxString > bindings () const
 Return current bindings for grid.
void unbind (int col_idx)
 Remove column from current bindings.
void unbind ()
 Remove all binded columns from list.
void col_label (const wxString &field, const wxString &label)
 Set label for grid column, binded to database field.
void rem_col_label (const wxString &field)
 Remove assigned label from column, displaying values of database field.
void col_labels (const std::map< wxString, wxString > &labels)
 Set labels for grid columns.
const std::map< wxString,
wxString > & 
col_labels ()
 Returns currently specified labels for fields.
void col_labels_clear ()
 Clears all specified labels for grid columns.
void clear ()
 Clear all bindings.
void col_attr_define (const wxString &field, wxGridCellAttr *attr)
 Define attribute for field.
virtual int GetNumberRows ()
virtual int GetNumberCols ()
virtual bool CanHaveAttributes ()
virtual bool IsEmptyCell (int row, int col)
virtual wxString GetValue (int row, int col)
virtual void SetValue (int row, int col, const wxString &value)
virtual wxString GetTypeName (int row, int col)
virtual bool CanGetValueAs (int row, int col, const wxString &typeName)
virtual long GetValueAsLong (int row, int col)
virtual double GetValueAsDouble (int row, int col)
virtual bool GetValueAsBool (int row, int col)
virtual wxString GetColLabelValue (int col)


Detailed Description

A table for wxGrid.

Pass it as argument to wxGrid::SetTable(). Internally uses wxPg::Query_browser.


Constructor & Destructor Documentation

wxPg::Grid_table::Grid_table (  ) 

Create new object.

Call database() later to set database for this object.

wxPg::Grid_table::Grid_table ( Database db  ) 

Create new object.

Parameters:
db - database connection.

virtual wxPg::Grid_table::~Grid_table (  )  [virtual]

Destructor.


Member Function Documentation

void wxPg::Grid_table::bind ( const std::map< int, wxString > &  col_bindings  ) 

Bind grid columns to database fields.

Parameters:
col_bindings - keys are column indices, values are database fields binded to them.

void wxPg::Grid_table::bind ( const wxString &  field  ) 

Bind next grid column to database field.

The newly binded column has index, that is bigger by 1 than currenly binded column with highest index. It's not recomended to mix this method with other binding methods.

void wxPg::Grid_table::bind ( int  col_idx,
const wxString &  field 
)

Bind grid column to database field.

Parameters:
col_idx - grid columns index.
field - database field. Grid column will contain values from this field.

Grid_bind_def* wxPg::Grid_table::bind_defs (  ) 

Return current binding definitions.

Returns:
binding definitions.

void wxPg::Grid_table::bind_defs ( Grid_bind_def defs,
bool  delete_defs = true 
)

Set binding definitions for this object.

If no definitions are set, all columns are displayed.

Parameters:
defs - binding definitions to be used.
delete_defs - this object is responsible for deleting definitions.

const std::map<int, wxString> wxPg::Grid_table::bindings (  )  const

Return current bindings for grid.

Keys in map are column indices, values are database fields binded to them.

Returns:
current bindings.

void wxPg::Grid_table::clear (  )  [inline]

Clear all bindings.

void wxPg::Grid_table::col_attr_define ( const wxString &  field,
wxGridCellAttr *  attr 
)

Define attribute for field.

This attribute will be set for column, which will values of that field.

Parameters:
field - field name.
attr - attribute. Takes ownership.

void wxPg::Grid_table::col_label ( const wxString &  field,
const wxString &  label 
)

Set label for grid column, binded to database field.

For columns, that don't have specified labels, field name is used instead. If no field is binded to column, label of that column is not changed.

Parameters:
field - database field. Grid column, that is binded to this field will have specified label.
label - label for column.

const std::map<wxString, wxString>& wxPg::Grid_table::col_labels (  ) 

Returns currently specified labels for fields.

Keys in map are fied names, values are labels.

Returns:
current column labels.

void wxPg::Grid_table::col_labels ( const std::map< wxString, wxString > &  labels  ) 

Set labels for grid columns.

Parameters:
labels - keys are fied names, values are labels for grid columns.

void wxPg::Grid_table::col_labels_clear (  ) 

Clears all specified labels for grid columns.

Database* wxPg::Grid_table::database (  )  [inline]

Get database, used by this object.

Returns:
database connection.

void wxPg::Grid_table::database ( Database db  )  [inline]

Set database connection for this object.

Parameters:
db - database connection.

Query_browser& wxPg::Grid_table::query (  )  [inline]

Get internally used wxPg::Query_browser.

Returns:
query browser, used internally.

void wxPg::Grid_table::rem_col_label ( const wxString &  field  ) 

Remove assigned label from column, displaying values of database field.

Parameters:
field - database field.

void wxPg::Grid_table::unbind (  ) 

Remove all binded columns from list.

void wxPg::Grid_table::unbind ( int  col_idx  ) 

Remove column from current bindings.

Parameters:
col_idx - grid column index.

bool wxPg::Grid_table::use_midle_fetch (  )  const [inline]

Return current fetch strategy.

See setter use_midle_fetch() for more details.

void wxPg::Grid_table::use_midle_fetch ( bool  use  )  [inline]

Fetch buffer so, that neccessairy record is in the midle.

If passed false, that neccessairy record is at the end.

Parameters:
use - true to use midle fetch strategy.


Generated on Wed Oct 7 23:14:40 2009 for wxPostgres by  doxygen 1.5.8