wxPg::Grid Class Reference

Grid for displaying a result of SQL query. More...

List of all members.

Public Member Functions

 Grid ()
 Create new grid.
 Grid (wxWindow *parent, wxWindowID id, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxWANTS_CHARS, const wxString &name=wxPanelNameStr)
 Create new grid.
virtual ~Grid ()
 Destructor.
void database (Database *db)
 Set database connection.
Databasedatabase ()
 Get database connection used by this object.
bool open (const wxString &sql)
 Open SQL statement.
const wxString last_err ()
 Get last error.
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.


Detailed Description

Grid for displaying a result of SQL query.


Constructor & Destructor Documentation

wxPg::Grid::Grid (  ) 

Create new grid.

Call Create() later and database(), to set database connection.

wxPg::Grid::Grid ( wxWindow *  parent,
wxWindowID  id,
const wxPoint &  pos = wxDefaultPosition,
const wxSize &  size = wxDefaultSize,
long  style = wxWANTS_CHARS,
const wxString &  name = wxPanelNameStr 
)

Create new grid.

For argument description see wxWidgets help.

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

Destructor.


Member Function Documentation

void wxPg::Grid::bind ( const std::map< int, wxString > &  col_bindings  )  [inline]

Bind grid columns to database fields.

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

void wxPg::Grid::bind ( const wxString &  field  )  [inline]

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::bind ( int  col_idx,
const wxString &  field 
) [inline]

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::bind_defs (  )  [inline]

Return current binding definitions.

Returns:
binding definitions.

void wxPg::Grid::bind_defs ( Grid_bind_def defs,
bool  delete_defs = true 
) [inline]

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::bindings (  )  const [inline]

Return current bindings for grid.

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

Returns:
current bindings.

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

Clear all bindings.

void wxPg::Grid::col_attr_define ( const wxString &  field,
wxGridCellAttr *  attr 
) [inline]

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::col_label ( const wxString &  field,
const wxString &  label 
) [inline]

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::col_labels (  )  [inline]

Returns currently specified labels for fields.

Keys in map are fied names, values are labels.

Returns:
current column labels.

void wxPg::Grid::col_labels ( const std::map< wxString, wxString > &  labels  )  [inline]

Set labels for grid columns.

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

void wxPg::Grid::col_labels_clear (  )  [inline]

Clears all specified labels for grid columns.

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

Get database connection used by this object.

Returns:
database connection.

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

Set database connection.

Parameters:
db - database connection.

const wxString wxPg::Grid::last_err (  )  [inline]

Get last error.

Call this if open() fails.

Returns:
last SQL error message.

bool wxPg::Grid::open ( const wxString &  sql  ) 

Open SQL statement.

Open SQL statement and refreshed grid to display data.

Returns:
true on success, false on error.

void wxPg::Grid::rem_col_label ( const wxString &  field  )  [inline]

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

Parameters:
field - database field.

void wxPg::Grid::unbind (  )  [inline]

Remove all binded columns from list.

void wxPg::Grid::unbind ( int  col_idx  )  [inline]

Remove column from current bindings.

Parameters:
col_idx - grid column index.


Generated on Sat Sep 5 23:00:41 2009 for wxPostgres by  doxygen 1.5.8