datamodel.h
Go to the documentation of this file.00001
00002
00003 #ifndef _LIBGDAMM_DATAMODEL_H
00004 #define _LIBGDAMM_DATAMODEL_H
00005
00006 #include <glibmm.h>
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #include <glibmm/object.h>
00031 #include <libgdamm/command.h>
00032 #include <libgdamm/row.h>
00033 #include <libgdamm/fieldattributes.h>
00034 #include <libgda/gda-data-model.h>
00035
00036
00037 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00038 typedef struct _GdaDataModel GdaDataModel;
00039 typedef struct _GdaDataModelClass GdaDataModelClass;
00040 #endif
00041
00042
00043 namespace Gnome
00044 {
00045
00046 namespace Gda
00047 { class DataModel_Class; }
00048
00049 }
00050 namespace Gnome
00051 {
00052
00053 namespace Gda
00054 {
00055
00056 class Row;
00057
00058
00059 class DataModel : public Glib::Object
00060 {
00061
00062 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00063
00064 public:
00065 typedef DataModel CppObjectType;
00066 typedef DataModel_Class CppClassType;
00067 typedef GdaDataModel BaseObjectType;
00068 typedef GdaDataModelClass BaseClassType;
00069
00070 private: friend class DataModel_Class;
00071 static CppClassType datamodel_class_;
00072
00073 private:
00074
00075 DataModel(const DataModel&);
00076 DataModel& operator=(const DataModel&);
00077
00078 protected:
00079 explicit DataModel(const Glib::ConstructParams& construct_params);
00080 explicit DataModel(GdaDataModel* castitem);
00081
00082 #endif
00083
00084 public:
00085 virtual ~DataModel();
00086
00087 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00088 static GType get_type() G_GNUC_CONST;
00089 static GType get_base_type() G_GNUC_CONST;
00090 #endif
00091
00093 GdaDataModel* gobj() { return reinterpret_cast<GdaDataModel*>(gobject_); }
00094
00096 const GdaDataModel* gobj() const { return reinterpret_cast<GdaDataModel*>(gobject_); }
00097
00099 GdaDataModel* gobj_copy();
00100
00101 private:
00102
00103 public:
00104
00105
00106 void changed();
00107
00108 void row_inserted(int row);
00109
00110 void row_updated(int row);
00111
00112 void row_removed(int row);
00113
00114 void column_inserted(int col);
00115
00116 void column_updated(int col);
00117
00118 void column_removed(int col);
00119
00120 void freeze();
00121
00122 void thaw();
00123
00124
00125 int get_n_rows() const;
00126
00127 int get_n_columns() const;
00128
00129
00130
00131 FieldAttributes describe_column(int col);
00132
00133 Glib::ustring get_column_title(int col) const;
00134
00135 void set_column_title(int col, const Glib::ustring& title);
00136
00137 int get_column_position(const Glib::ustring& title) const;
00138
00139
00140
00141
00142 Row get_row(int row) const;
00143
00144
00145
00146
00147
00148 Value get_value_at(int col, int row) const;
00149
00150
00151 bool is_updatable() const;
00152
00153
00154
00155 const GdaRow* append_row(const GList *values);
00156
00157 bool remove_row(const Row& row);
00158
00159 bool update_row(const Row& row);
00160
00161
00162 bool append_column(const FieldAttributes& col);
00163
00164 bool update_column(int col, const FieldAttributes& attrs);
00165
00166 bool remove_column(int col);
00167
00171 typedef sigc::slot<bool, const Row&> SlotForEach;
00172
00173 void foreach(const SlotForEach& slot);
00174
00175
00176 bool has_changed() const;
00177
00178 bool begin_update();
00179
00180 bool cancel_update();
00181
00182 bool end_update();
00183
00184
00185 Glib::ustring to_comma_separated() const;
00186
00187 Glib::ustring to_tab_separated() const;
00188
00189 Glib::ustring to_xml(bool standalone) const;
00190
00191
00192
00193
00194
00195
00196
00197 Glib::ustring get_command_text() const;
00198
00199 void set_command_text(const Glib::ustring& txt);
00200
00201 CommandType get_command_type() const;
00202
00203 void set_command_type(CommandType type);
00204
00205
00206 Glib::SignalProxy0< void > signal_changed();
00207
00208
00209 virtual int get_n_rows_vfunc();
00210 virtual int get_n_columns_vfunc();
00211 virtual GdaFieldAttributes* describe_column_vfunc(int col);
00212 virtual const GdaValue* get_value_at_vfunc(int col, int row);
00213
00214
00215 public:
00216
00217 public:
00218
00219
00220 protected:
00221
00222
00223
00224 virtual void on_changed();
00225
00226
00227 };
00228
00229 }
00230 }
00231
00232
00233 namespace Glib
00234 {
00240 Glib::RefPtr<Gnome::Gda::DataModel> wrap(GdaDataModel* object, bool take_copy = false);
00241 }
00242
00243
00244 #endif
00245