Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

datamodel.h

Go to the documentation of this file.
00001 // -*- c++ -*-
00002 // Generated by gtkmmproc -- DO NOT MODIFY!
00003 #ifndef _LIBGDAMM_DATAMODEL_H
00004 #define _LIBGDAMM_DATAMODEL_H
00005 
00006 #include <glibmm.h>
00007 
00008 /* $Id: datamodel.hg,v 1.15 2004/06/06 16:32:45 murrayc Exp $ */
00009 // -*- C++ -*- // this is for the .hg, I realize gensig puts one in
00010 
00011 /* datamodel.h
00012  *
00013  * Copyright 2003 libgdamm Development Team
00014  *
00015  * This library is free software; you can redistribute it and/or
00016  * modify it under the terms of the GNU Library General Public
00017  * License as published by the Free Software Foundation; either
00018  * version 2 of the License, or (at your option) any later version.
00019  *
00020  * This library is distributed in the hope that it will be useful,
00021  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00022  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00023  * Library General Public License for more details.
00024  *
00025  * You should have received a copy of the GNU Library General Public
00026  * License along with this library; if not, write to the Free
00027  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
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 /* DOXYGEN_SHOULD_SKIP_THIS */
00041 
00042 
00043 namespace Gnome
00044 {
00045 
00046 namespace Gda
00047 { class DataModel_Class; } // namespace Gda
00048 
00049 } // namespace Gnome
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   // noncopyable
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 /* DOXYGEN_SHOULD_SKIP_THIS */
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   //TODO: Use C++ type:
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   //We use a custom conversion here, because we need to copy the value:
00140    
00141 
00142   Row get_row(int row) const;
00143 
00144   //We use a custom conversion here, because we need to copy the value:
00145   //#m4 __CONVERSION(`GdaValue*',`Value',`Glib::wrap($3, true /* take_copy=true */)')
00146    
00147 
00148   Value get_value_at(int col, int row) const;
00149 
00150 
00151   bool is_updatable() const;
00152 
00153   //TODO: Use C++ types:
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   //TODO: Wrap these if we want to depend on libxml++
00193   //_WRAP_METHOD(xmlNodePtr to_xml(const GLib::ustring& name), gda_data_model_to_xml_node)
00194   //_WRAP_METHOD(bool add_data(xmlNodePtr node), gda_data_model_add_data_from_xml_node)
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   //C++ methods used to invoke GTK+ virtual functions:
00219 
00220 protected:
00221   //GTK+ Virtual Functions (override these to change behaviour):
00222 
00223   //Default Signal Handlers::
00224   virtual void on_changed();
00225 
00226 
00227 };
00228 
00229 } // namespace Gda
00230 } // namespace Gnome
00231 
00232 
00233 namespace Glib
00234 {
00240   Glib::RefPtr<Gnome::Gda::DataModel> wrap(GdaDataModel* object, bool take_copy = false);
00241 }
00242 
00243 
00244 #endif /* _LIBGDAMM_DATAMODEL_H */
00245 

Generated on Mon Apr 18 18:56:38 2005 for libgdamm by  doxygen 1.4.2