Public Member Functions | |
Grid_binding () | |
Creates new object. | |
Grid_binding (wxGrid *grid) | |
Creates new object and binds grid to it. | |
Grid_binding (Result_data_provider *data) | |
Create new object with data as source. | |
Grid_binding (wxGrid *grid, Result_data_provider *data) | |
Create new object and initialize it with grid and data. | |
virtual | ~Grid_binding () |
Destroy object. | |
void | grid (wxGrid *grid) |
Set grid in wich data will be displayed. | |
wxGrid * | grid () |
Return currenly binded grid. | |
void | data (Result_data_provider *data) |
Set data to be displayed in grid. | |
Result_data_provider * | data () |
Return data, currently used by this object. | |
void | bind_defs (Grid_bind_def *bind_defs, bool delete_defs=true) |
Set binding definitions to be used. | |
Grid_bind_def * | bind_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 () |
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. | |
virtual void | update_UI () |
Update binded grid. | |
Protected Attributes | |
wxGrid * | grid_ |
Result_data_provider * | data_ |
wxPg::Grid_binding::Grid_binding | ( | ) |
wxPg::Grid_binding::Grid_binding | ( | wxGrid * | grid | ) | [explicit] |
Creates new object and binds grid to it.
Call data() to complete initialization.
grid | - grid to bind. |
wxPg::Grid_binding::Grid_binding | ( | Result_data_provider * | data | ) | [explicit] |
Create new object with data as source.
Call grid() to complete initialization.
data | - query result to display in grid. |
wxPg::Grid_binding::Grid_binding | ( | wxGrid * | grid, | |
Result_data_provider * | data | |||
) |
Create new object and initialize it with grid and data.
grid | - grid to bind. | |
data | - query result to display in grid. |
virtual wxPg::Grid_binding::~Grid_binding | ( | ) | [virtual] |
Destroy object.
void wxPg::Grid_binding::bind | ( | const std::map< int, wxString > & | col_bindings | ) |
Bind grid columns to database fields.
Actual update occurs when update_UI() is called.
col_bindings | - keys are column indices, values are database fields binded to them. |
void wxPg::Grid_binding::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. Actual update occurs when update_UI() is called.
void wxPg::Grid_binding::bind | ( | int | col_idx, | |
const wxString & | field | |||
) |
Bind grid column to database field.
Actual update occurs when update_UI() is called.
col_idx | - grid columns index. If grid does not have column with index col_idx, enouth columns will be created, when update_UI() is called. | |
field | - database field. Grid column will contain values from this field. |
Grid_bind_def* wxPg::Grid_binding::bind_defs | ( | ) | [inline] |
Return current binding definitions.
void wxPg::Grid_binding::bind_defs | ( | Grid_bind_def * | bind_defs, | |
bool | delete_defs = true | |||
) |
Set binding definitions to be used.
It is optional to set them. If not set, will be created automatically.
bind_defs | - binding definitions to be used by this object. | |
delete_defs | - shoud this object delete definitions. |
const std::map<int, wxString>& wxPg::Grid_binding::bindings | ( | ) |
Return current bindings for grid.
Keys in map are column indices, values are database fields binded to them.
void wxPg::Grid_binding::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. Labels are assigned when update_UI() is called.
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_binding::col_labels | ( | ) |
Returns currently specified labels for fields.
Keys in map are fied names, values are labels.
void wxPg::Grid_binding::col_labels | ( | const std::map< wxString, wxString > & | labels | ) |
Set labels for grid columns.
Labels are assigned when update_UI() is called.
labels | - keys are fied names, values are labels for grid columns. |
void wxPg::Grid_binding::col_labels_clear | ( | ) |
Clears all specified labels for grid columns.
Labels are assigned when update_UI() is called.
Result_data_provider* wxPg::Grid_binding::data | ( | ) | [inline] |
Return data, currently used by this object.
void wxPg::Grid_binding::data | ( | Result_data_provider * | data | ) | [inline] |
Set data to be displayed in grid.
data | - query result to display in grid. |
wxGrid* wxPg::Grid_binding::grid | ( | ) | [inline] |
Return currenly binded grid.
void wxPg::Grid_binding::grid | ( | wxGrid * | grid | ) | [inline] |
Set grid in wich data will be displayed.
grid | - grid to bind. |
void wxPg::Grid_binding::rem_col_label | ( | const wxString & | field | ) |
Remove assigned label from column, displaying values of database field.
Labels are assigned when update_UI() is called.
field | - database field. |
void wxPg::Grid_binding::unbind | ( | ) |
Remove all binded columns from list.
Actual update occurs when update_UI() is called.
void wxPg::Grid_binding::unbind | ( | int | col_idx | ) |
Remove column from current bindings.
Actual update occurs when update_UI() is called.
col_idx | - grid column index. |
virtual void wxPg::Grid_binding::update_UI | ( | ) | [virtual] |
Update binded grid.
If there are binded columns, columns are created or deleted in grid, so that last column in grid woud have index, equal to highest binded index. Binded columns will be filled with data from from result data, grid will contain as much rows as there are them in result data.
Columns, that have no binding are unchanged.
If there are no binded columns, grid will display entire result data, columns and rows will be created or deleted to match those of result data.
Column labels are set to specified labels for field, or to field names, if there are no specied labels for some of fields.
Implements wxPg::UI_updater.