00001
00002
00003 #ifndef _LIBGDAMM_DATAPROXY_H
00004 #define _LIBGDAMM_DATAPROXY_H
00005
00006
00007 #include <glibmm.h>
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/object.h>
00032 #include <libgdamm/datamodel.h>
00033
00034
00035 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00036 typedef struct _GdaDataProxy GdaDataProxy;
00037 typedef struct _GdaDataProxyClass GdaDataProxyClass;
00038 #endif
00039
00040
00041 namespace Gnome
00042 {
00043
00044 namespace Gda
00045 { class DataProxy_Class; }
00046
00047 }
00048 namespace Gnome
00049 {
00050
00051 namespace Gda
00052 {
00053
00073 class DataProxy
00074 : public Object,
00075 public DataModel
00076 {
00077
00078 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00079
00080 public:
00081 typedef DataProxy CppObjectType;
00082 typedef DataProxy_Class CppClassType;
00083 typedef GdaDataProxy BaseObjectType;
00084 typedef GdaDataProxyClass BaseClassType;
00085
00086 private: friend class DataProxy_Class;
00087 static CppClassType dataproxy_class_;
00088
00089 private:
00090
00091 DataProxy(const DataProxy&);
00092 DataProxy& operator=(const DataProxy&);
00093
00094 protected:
00095 explicit DataProxy(const Glib::ConstructParams& construct_params);
00096 explicit DataProxy(GdaDataProxy* castitem);
00097
00098 #endif
00099
00100 public:
00101 virtual ~DataProxy();
00102
00103 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00104 static GType get_type() G_GNUC_CONST;
00105 static GType get_base_type() G_GNUC_CONST;
00106 #endif
00107
00109 GdaDataProxy* gobj() { return reinterpret_cast<GdaDataProxy*>(gobject_); }
00110
00112 const GdaDataProxy* gobj() const { return reinterpret_cast<GdaDataProxy*>(gobject_); }
00113
00115 GdaDataProxy* gobj_copy();
00116
00117 private:
00118
00119
00120 protected:
00121 explicit DataProxy(const Glib::RefPtr<DataModel>& model);
00122
00123 public:
00124
00125 static Glib::RefPtr<DataProxy> create(const Glib::RefPtr<DataModel>& model);
00126
00127
00131 Glib::RefPtr<DataModel> get_proxied_model();
00132
00136 Glib::RefPtr<const DataModel> get_proxied_model() const;
00137
00141 int get_proxied_model_n_cols() const;
00142
00146 int get_proxied_model_n_rows() const;
00147
00151 bool is_read_only() const;
00152
00153 ValueSList get_values(int proxy_row, const Glib::ArrayHandle<int>& cols_index) const;
00154
00155
00156
00157
00164 ValueAttribute get_value_attributes(int proxy_row, int col) const;
00165
00173 void alter_value_attributes(int proxy_row, int col, ValueAttribute alter_flags);
00174
00175
00180 int get_proxied_model_row(int proxy_row) const;
00181
00182
00183
00187 void erase(int proxy_row);
00188
00192 void unerase(int proxy_row);
00193
00198 bool row_is_deleted(int proxy_row) const;
00199
00205 bool row_is_inserted(int proxy_row) const;
00206
00207
00216 int find_row_from_values(const ValueSList& values, const Glib::ArrayHandle<int>& cols_index) const;
00217
00222 void cancel_row_changes(int proxy_row, int col);
00223
00229 #ifdef GLIBMM_EXCEPTIONS_ENABLED
00230 void apply_row_changes(int proxy_row);
00231 #else
00232 void apply_row_changes(int proxy_row, std::auto_ptr<Glib::Error>& error);
00233 #endif //GLIBMM_EXCEPTIONS_ENABLED
00234
00235
00239 bool has_changed() const;
00240
00244 bool row_has_changed(int proxy_row) const;
00245
00250 int get_n_new_rows() const;
00251
00264 void set_sample_size(int sample_size);
00265
00269 int get_sample_size() const;
00270
00274 void set_sample_start(int sample_start);
00275
00279 int get_sample_start() const;
00280
00284 int get_sample_end() const;
00285
00292 #ifdef GLIBMM_EXCEPTIONS_ENABLED
00293 bool apply_all_changes();
00294 #else
00295 bool apply_all_changes(std::auto_ptr<Glib::Error>& error);
00296 #endif //GLIBMM_EXCEPTIONS_ENABLED
00297
00298
00303 bool cancel_all_changes();
00304
00305 #ifdef GLIBMM_PROPERTIES_ENABLED
00306
00312 Glib::PropertyProxy_ReadOnly< Glib::RefPtr<DataModel> > property_model() const;
00313 #endif //#GLIBMM_PROPERTIES_ENABLED
00314
00315
00316 #ifdef GLIBMM_PROPERTIES_ENABLED
00317
00323 Glib::PropertyProxy<bool> property_prepend_null_entry() ;
00324 #endif //#GLIBMM_PROPERTIES_ENABLED
00325
00326 #ifdef GLIBMM_PROPERTIES_ENABLED
00327
00333 Glib::PropertyProxy_ReadOnly<bool> property_prepend_null_entry() const;
00334 #endif //#GLIBMM_PROPERTIES_ENABLED
00335
00336
00342 Glib::SignalProxy2< void,int,bool > signal_row_delete_changed();
00343
00344
00350 Glib::SignalProxy2< void,int,int > signal_sample_changed();
00351
00352
00358 Glib::SignalProxy1< void,int > signal_sample_size_changed();
00359
00360
00361 public:
00362
00363 public:
00364
00365 #ifdef GLIBMM_VFUNCS_ENABLED
00366 #endif //GLIBMM_VFUNCS_ENABLED
00367
00368 protected:
00369
00370 #ifdef GLIBMM_VFUNCS_ENABLED
00371 #endif //GLIBMM_VFUNCS_ENABLED
00372
00373
00374 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00375 virtual void on_row_delete_changed(int row, bool to_be_deleted);
00376 virtual void on_sample_changed(int sample_start, int sample_end);
00377 virtual void on_sample_size_changed(int sample_size);
00378 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00379
00380
00381 };
00382
00383 }
00384 }
00385
00386
00387 namespace Glib
00388 {
00394 Glib::RefPtr<Gnome::Gda::DataProxy> wrap(GdaDataProxy* object, bool take_copy = false);
00395 }
00396
00397
00398 #endif
00399