/* $Id: datamodel.hg,v 1.15 2004/06/06 16:32:45 murrayc Exp $ */ // -*- C++ -*- // this is for the .hg, I realize gensig puts one in /* datamodel.h * * Copyright 2003 libgdamm Development Team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include #include #include _DEFS(libgdamm,libgda) _PINCLUDE(glibmm/private/object_p.h) namespace Gnome { namespace Gda { class Row; class DataModel : public Glib::Object { _CLASS_GOBJECT(DataModel, GdaDataModel, GDA_DATA_MODEL, Glib::Object, GObject) public: _WRAP_METHOD(void changed(), gda_data_model_changed) _WRAP_METHOD(void row_inserted(int row), gda_data_model_row_inserted) _WRAP_METHOD(void row_updated(int row), gda_data_model_row_updated) _WRAP_METHOD(void row_removed(int row), gda_data_model_row_removed) _WRAP_METHOD(void column_inserted(int col), gda_data_model_column_inserted) _WRAP_METHOD(void column_updated(int col), gda_data_model_column_updated) _WRAP_METHOD(void column_removed(int col), gda_data_model_column_removed) _WRAP_METHOD(void freeze(), gda_data_model_freeze) _WRAP_METHOD(void thaw(), gda_data_model_thaw) _WRAP_METHOD(int get_n_rows() const, gda_data_model_get_n_rows) _WRAP_METHOD(int get_n_columns() const, gda_data_model_get_n_columns) //TODO: Use C++ type: _WRAP_METHOD(FieldAttributes describe_column(int col), gda_data_model_describe_column) _WRAP_METHOD(Glib::ustring get_column_title(int col) const, gda_data_model_get_column_title) _WRAP_METHOD(void set_column_title(int col, const Glib::ustring& title), gda_data_model_set_column_title) _WRAP_METHOD(int get_column_position(const Glib::ustring& title) const, gda_data_model_get_column_position) //We use a custom conversion here, because we need to copy the value: #m4 _CONVERSION(`const GdaRow*',`Row',`Glib::wrap(const_cast($3), true)') _WRAP_METHOD(Row get_row(int row) const, gda_data_model_get_row) //We use a custom conversion here, because we need to copy the value: //#m4 _CONVERSION(`GdaValue*',`Value',`Glib::wrap($3, true /* take_copy=true */)') #m4 _CONVERSION(`const GdaValue*',`Value',`Glib::wrap(const_cast($3), true /* take_copy */)') _WRAP_METHOD(Value get_value_at(int col, int row) const, gda_data_model_get_value_at) _WRAP_METHOD(bool is_updatable() const, gda_data_model_is_updatable) //TODO: Use C++ types: _WRAP_METHOD(const GdaRow* append_row(const GList *values), gda_data_model_append_row) _WRAP_METHOD(bool remove_row(const Row& row), gda_data_model_remove_row) _WRAP_METHOD(bool update_row(const Row& row), gda_data_model_update_row) _WRAP_METHOD(bool append_column(const FieldAttributes& col), gda_data_model_append_column) _WRAP_METHOD(bool update_column(int col, const FieldAttributes& attrs), gda_data_model_update_column) _WRAP_METHOD(bool remove_column(int col), gda_data_model_remove_column) /** For example, * void on_foreach(const Row& row); */ typedef sigc::slot SlotForEach; void foreach(const SlotForEach& slot); _IGNORE(gda_data_model_foreach) _WRAP_METHOD(bool has_changed() const, gda_data_model_has_changed) _WRAP_METHOD(bool begin_update(), gda_data_model_begin_update) _WRAP_METHOD(bool cancel_update(), gda_data_model_cancel_update) _WRAP_METHOD(bool end_update(), gda_data_model_end_update) _WRAP_METHOD(Glib::ustring to_comma_separated() const, gda_data_model_to_comma_separated) _WRAP_METHOD(Glib::ustring to_tab_separated() const, gda_data_model_to_tab_separated) _WRAP_METHOD(Glib::ustring to_xml(bool standalone) const, gda_data_model_to_xml) //TODO: Wrap these if we want to depend on libxml++ //_WRAP_METHOD(xmlNodePtr to_xml(const GLib::ustring& name), gda_data_model_to_xml_node) //_WRAP_METHOD(bool add_data(xmlNodePtr node), gda_data_model_add_data_from_xml_node) _WRAP_METHOD(Glib::ustring get_command_text() const, gda_data_model_get_command_text) _WRAP_METHOD(void set_command_text(const Glib::ustring& txt), gda_data_model_set_command_text) _WRAP_METHOD(CommandType get_command_type() const, gda_data_model_get_command_type) _WRAP_METHOD(void set_command_type(CommandType type), gda_data_model_set_command_type) _WRAP_SIGNAL(void changed(), "changed") _WRAP_VFUNC(int get_n_rows(), get_n_rows) _WRAP_VFUNC(int get_n_columns(), get_n_columns) _WRAP_VFUNC(GdaFieldAttributes* describe_column(int col), describe_column) _WRAP_VFUNC(const GdaValue* get_value_at(int col, int row), get_value_at) }; } // namespace Gda } // namespace Gnome