[libgda-uimm] Add DataFilter, DataStore and ServerOperation classes.



commit 9b37ae69d48164e04a8b1bea3870dd081f2c3cbf
Author: José Alburquerque <jaalburqu svn gnome org>
Date:   Thu Apr 1 18:08:30 2010 -0400

    	Add DataFilter, DataStore and ServerOperation classes.
    
    	* libgda-ui/libgda-uimm.h:
    	* libgda-ui/src/filelist.am:
    	* libgda-ui/src/datafilter.ccg:
    	* libgda-ui/src/datafilter.hg:
    	* libgda-ui/src/datastore.ccg:
    	* libgda-ui/src/datastore.hg:
    	* libgda-ui/src/serveroperation.ccg:
    	* libgda-ui/src/serveroperation.hg: Add the DataFilter and
    	ServerOperation widgets and the DataStore class which implements the
    	Gtk::TreeModel interface.
    	* tools/m4/convert_libgda_uimm.m4: Added conversions for added
    	classes.
    
    	* libgda-ui/src/dataproxyinfo.hg:
    	* libgda-ui/src/login.hg: Add class forward declaration sections for
    	Gnome::Gda classes (though no classes have been declared) so that
    	adding forward declarations is easier when creating new source files
    	using existing copies of existing ones.
    	* libgda-ui/src/combo.hg: Typo.

 ChangeLog                         |   24 +++++++++
 libgda-ui/libgda-uimm.h           |    3 +
 libgda-ui/src/combo.hg            |    2 +-
 libgda-ui/src/datafilter.ccg      |   31 +++++++++++
 libgda-ui/src/datafilter.hg       |   58 +++++++++++++++++++++
 libgda-ui/src/dataproxyinfo.hg    |    6 ++
 libgda-ui/src/datastore.ccg       |   38 ++++++++++++++
 libgda-ui/src/datastore.hg        |  103 +++++++++++++++++++++++++++++++++++++
 libgda-ui/src/filelist.am         |    5 ++-
 libgda-ui/src/login.hg            |    6 ++
 libgda-ui/src/serveroperation.ccg |   32 +++++++++++
 libgda-ui/src/serveroperation.hg  |   66 +++++++++++++++++++++++
 tools/m4/convert_libgda_uimm.m4   |    7 +++
 13 files changed, 379 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 24a695f..9e4b3b2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@
+2010-04-01  José Alburquerque  <jaalburqu svn gnome org>
+
+	Add DataFilter, DataStore and ServerOperation classes.
+
+	* libgda-ui/libgda-uimm.h:
+	* libgda-ui/src/filelist.am:
+	* libgda-ui/src/datafilter.ccg:
+	* libgda-ui/src/datafilter.hg:
+	* libgda-ui/src/datastore.ccg:
+	* libgda-ui/src/datastore.hg:
+	* libgda-ui/src/serveroperation.ccg:
+	* libgda-ui/src/serveroperation.hg: Add the DataFilter and
+	ServerOperation widgets and the DataStore class which implements the
+	Gtk::TreeModel interface.
+	* tools/m4/convert_libgda_uimm.m4: Added conversions for added
+	classes.
+
+	* libgda-ui/src/dataproxyinfo.hg:
+	* libgda-ui/src/login.hg: Add class forward declaration sections for
+	Gnome::Gda classes (though no classes have been declared) so that
+	adding forward declarations is easier when creating new source files
+	using existing copies of existing ones.
+	* libgda-ui/src/combo.hg: Typo.
+
 2010-03-10  José Alburquerque  <jaalburqu svn gnome org>
 
 	Add DataEntry interface.
diff --git a/libgda-ui/libgda-uimm.h b/libgda-ui/libgda-uimm.h
index b95dc0e..f42c17b 100644
--- a/libgda-ui/libgda-uimm.h
+++ b/libgda-ui/libgda-uimm.h
@@ -24,14 +24,17 @@
 #include <cloud.h>
 #include <combo.h>
 #include <dataentry.h>
+#include <datafilter.h>
 #include <dataproxy.h>
 #include <dataproxyinfo.h>
 #include <dataselector.h>
+#include <datastore.h>
 #include <form.h>
 #include <grid.h>
 #include <login.h>
 #include <providerselector.h>
 #include <rawform.h>
 #include <rawgrid.h>
+#include <serveroperation.h>
 
 #endif /* _LIBGDA_UIMM_H */
diff --git a/libgda-ui/src/combo.hg b/libgda-ui/src/combo.hg
index 7341890..15b45a6 100644
--- a/libgda-ui/src/combo.hg
+++ b/libgda-ui/src/combo.hg
@@ -26,7 +26,7 @@ _PINCLUDE(gtkmm/private/combobox_p.h)
 namespace Gnome
 {
 
-// Gnome::Gda class declartions.
+// Gnome::Gda class forward declartions.
 namespace Gda
 {
 
diff --git a/libgda-ui/src/datafilter.ccg b/libgda-ui/src/datafilter.ccg
new file mode 100644
index 0000000..9eb1e58
--- /dev/null
+++ b/libgda-ui/src/datafilter.ccg
@@ -0,0 +1,31 @@
+/* libgda-uimm - a C++ wrapper for libgda-ui
+ * 
+ * Copyright (c) 2010 libgda-uimm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <libgda-ui/gdaui-data-filter.h>
+#include <libgda-uimm/dataproxy.h>
+
+namespace Gnome
+{
+
+namespace GdaUI
+{
+
+} /* namespace GdaUI */
+
+} /* namespace Gnome */
diff --git a/libgda-ui/src/datafilter.hg b/libgda-ui/src/datafilter.hg
new file mode 100644
index 0000000..0c46de7
--- /dev/null
+++ b/libgda-ui/src/datafilter.hg
@@ -0,0 +1,58 @@
+/* libgda-uimm - a C++ wrapper for libgda-ui
+ *
+ * Copyright (c) 2010 libgda-uimm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <gtkmm/box.h>
+
+_DEFS(libgda-uimm,libgda_ui)
+_PINCLUDE(gtkmm/private/box_p.h)
+
+namespace Gnome
+{
+
+// Gnome::Gda class forward declarations.
+namespace Gda
+{
+
+}
+
+namespace GdaUI
+{
+
+class DataProxy;
+
+/** DataFilter - Entrer rules to filter the rows in a DataProxy.  The
+ * DataFilter widget can be used as a standalone widget, but is also used
+ * internally by the DataProxyInfo widget for its search option.
+ */
+class DataFilter :
+  public Gtk::VBox
+{
+  _CLASS_GTKOBJECT(DataFilter, GdauiDataFilter, GDAUI_DATA_FILTER, Gtk::VBox, GtkVBox)
+
+public:
+  _WRAP_METHOD_DOCS_ONLY(gdaui_data_filter_new)
+  _WRAP_CTOR(DataFilter(const Glib::RefPtr<DataProxy>& data_widget), gdaui_data_filter_new)
+
+public:
+  _WRAP_PROPERTY("data-widget", Glib::RefPtr<DataProxy>)
+};
+
+} // namespace GdaUI
+
+} // namespace Gnome
diff --git a/libgda-ui/src/dataproxyinfo.hg b/libgda-ui/src/dataproxyinfo.hg
index 4e0df07..0564e48 100644
--- a/libgda-ui/src/dataproxyinfo.hg
+++ b/libgda-ui/src/dataproxyinfo.hg
@@ -25,6 +25,12 @@ _PINCLUDE(gtkmm/private/box_p.h)
 namespace Gnome
 {
 
+// Gnome::Gda class forward declartions.
+namespace Gda
+{
+
+}
+
 namespace GdaUI
 {
 
diff --git a/libgda-ui/src/datastore.ccg b/libgda-ui/src/datastore.ccg
new file mode 100644
index 0000000..f54d4ac
--- /dev/null
+++ b/libgda-ui/src/datastore.ccg
@@ -0,0 +1,38 @@
+/* libgda-uimm - a C++ wrapper for libgda-ui
+ * 
+ * Copyright (c) 2010 libgda-uimm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <libgda-ui/gdaui-data-store.h>
+#include <libgdamm/datamodel.h>
+#include <libgdamm/dataproxy.h>
+#include <gtkmm/treeiter.h>
+
+namespace
+{
+
+} // anonymous namespace
+
+namespace Gnome
+{
+
+namespace GdaUI
+{
+
+} /* namespace GdaUI */
+
+} /* namespace Gnome */
diff --git a/libgda-ui/src/datastore.hg b/libgda-ui/src/datastore.hg
new file mode 100644
index 0000000..d06a8dd
--- /dev/null
+++ b/libgda-ui/src/datastore.hg
@@ -0,0 +1,103 @@
+/* libgda-uimm - a C++ wrapper for libgda-ui
+ *
+ * Copyright (c) 2010 libgda-uimm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <glibmm/object.h>
+#include <gtkmm/treemodel.h>
+
+_DEFS(libgda-uimm,libgda_ui)
+_PINCLUDE(glibmm/private/object_p.h)
+
+namespace Gnome
+{
+
+// Gnome::Gda class forward declarations.
+namespace Gda
+{
+
+class DataModel;
+class DataProxy;
+
+}
+
+namespace GdaUI
+{
+
+/** DataStore - Bridge between a Gnome::Gda::DataModel  and a Gtk::TreeModel.
+ * The DataStore  object implements the Gtk::TreeModel interface on top of a
+ * Gnome::Gda::DataModel  to be able to display its contents in a GtkTreeView.
+ */
+class DataStore :
+  public Glib::Object,
+  public Gtk::TreeModel
+{
+  _CLASS_GOBJECT(DataStore, GdauiDataStore, GDAUI_DATA_STORE, Glib::Object, GObject)
+  _IMPLEMENTS_INTERFACE(Gtk::TreeModel)
+
+public:
+  _WRAP_METHOD_DOCS_ONLY(gdaui_data_store_new)
+  _WRAP_CTOR(DataStore(const Glib::RefPtr<Gnome::Gda::DataModel>& model), gdaui_data_store_new)
+
+public:
+  _WRAP_METHOD(Glib::RefPtr<Gnome::Gda::DataProxy> get_proxy(), gdaui_data_store_get_proxy)
+  _WRAP_METHOD(Glib::RefPtr<const Gnome::Gda::DataProxy> get_proxy() const, gdaui_data_store_get_proxy, constversion)
+  _WRAP_METHOD(int get_row_from_iter(const Gtk::TreeModel::const_iterator& iter) const, gdaui_data_store_get_row_from_iter)
+  //TODO: _WRAP_METHOD(bool get_iter_from_values(Gtk::TreeModel::iterator& iter, const Glib::SListHandle<Glib::ValueBase>& values, const Glib::ArrayHandle<int>& cols_index), gdaui_data_store_get_iter_from_values)
+  _WRAP_METHOD(bool set_value(const Gtk::TreeModel::iterator& iter, int col, const Glib::ValueBase& value), gdaui_data_store_set_value)
+
+  /** Stores a value in the store data model.
+   * @param iter The considered row.
+   * @param col The column.
+   * @param value The value to store.
+   * @return true on success, false otherwise.
+   */
+  template <class DataType>
+  bool set_value(const Gtk::TreeModel::iterator& iter, int col, const DataType& value);
+
+  _WRAP_METHOD(void remove(const Gtk::TreeModel::iterator& iter), gdaui_data_store_delete)
+  _WRAP_METHOD(void restore(const Gtk::TreeModel::iterator& iter), gdaui_data_store_undelete)
+  _WRAP_METHOD(bool append(const Gtk::TreeModel::iterator& iter), gdaui_data_store_append)
+
+  _WRAP_PROPERTY("model", Glib::RefPtr<Gnome::Gda::DataModel>)
+  _WRAP_PROPERTY("prepend-null-entry", bool)
+  _WRAP_PROPERTY("proxy", Glib::RefPtr<Gnome::Gda::DataProxy>)
+};
+
+/***************************** DataStore *****************************/
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+
+template <class DataType>
+bool DataStore::set_value(const Gtk::TreeModel::iterator& iter, int col,
+  const DataType& value)
+{
+  typedef Glib::Value<DataType> ValueType;
+
+  ValueType temp;
+  temp.init(ValueType::value_type());
+  temp.set(value);
+  return this->set_value(iter, col, temp);
+}
+
+#endif /* DOXYGEN_SHOULD_SKIP_THIS */
+
+
+
+} // namespace GdaUI
+
+} // namespace Gnome
diff --git a/libgda-ui/src/filelist.am b/libgda-ui/src/filelist.am
index bf79a17..a03c49e 100644
--- a/libgda-ui/src/filelist.am
+++ b/libgda-ui/src/filelist.am
@@ -13,15 +13,18 @@ files_hg =                              \
         cloud.hg                        \
         combo.hg                        \
         dataentry.hg                    \
+        datafilter.hg                   \
         dataproxy.hg                    \
         dataproxyinfo.hg                \
         dataselector.hg                 \
+        datastore.hg                    \
         form.hg                         \
         grid.hg                         \
         login.hg                        \
         providerselector.hg             \
         rawform.hg                      \
-        rawgrid.hg
+        rawgrid.hg                      \
+        serveroperation.hg
 
 
 files_ccg = $(files_hg:.hg=.ccg)
diff --git a/libgda-ui/src/login.hg b/libgda-ui/src/login.hg
index ed1a2c7..0e0939a 100644
--- a/libgda-ui/src/login.hg
+++ b/libgda-ui/src/login.hg
@@ -27,6 +27,12 @@ _PINCLUDE(gtkmm/private/box_p.h)
 namespace Gnome
 {
 
+// Gnome::Gda class forward declartions.
+namespace Gda
+{
+
+}
+
 namespace GdaUI
 {
 
diff --git a/libgda-ui/src/serveroperation.ccg b/libgda-ui/src/serveroperation.ccg
new file mode 100644
index 0000000..e9429fc
--- /dev/null
+++ b/libgda-ui/src/serveroperation.ccg
@@ -0,0 +1,32 @@
+/* libgda-uimm - a C++ wrapper for libgda-ui
+ * 
+ * Copyright (c) 2010 libgda-uimm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <libgda-ui/gdaui-server-operation.h>
+#include <libgdamm/serveroperation.h>
+#include <gtkmm/window.h>
+
+namespace Gnome
+{
+
+namespace GdaUI
+{
+
+} /* namespace GdaUI */
+
+} /* namespace Gnome */
diff --git a/libgda-ui/src/serveroperation.hg b/libgda-ui/src/serveroperation.hg
new file mode 100644
index 0000000..d09430e
--- /dev/null
+++ b/libgda-ui/src/serveroperation.hg
@@ -0,0 +1,66 @@
+/* libgda-uimm - a C++ wrapper for libgda-ui
+ *
+ * Copyright (c) 2010 libgda-uimm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <gtkmm/box.h>
+
+_DEFS(libgda-uimm,libgda_ui)
+_PINCLUDE(gtkmm/private/box_p.h)
+
+namespace Gnome
+{
+
+// Gnome::Gda class forward declarations.
+namespace Gda
+{
+
+class ServerOperation;
+
+}
+
+namespace GdaUI
+{
+
+class DataProxy;
+
+/** ServerOperation - Entrer information to perform a DDL query.
+ * The ServerOperation widget allows the user to enter information to perform
+ * Data Definition queries (all queries which are not SELECT, INSERT, UPDATE
+ * or DELETE). For example the figure shows a ServerOperation widget set to
+ * create an index in an SQLite database.
+ */
+class ServerOperation :
+  public Gtk::VBox
+{
+  _CLASS_GTKOBJECT(ServerOperation, GdauiServerOperation, GDAUI_SERVER_OPERATION, Gtk::VBox, GtkVBox)
+
+public:
+  _WRAP_METHOD_DOCS_ONLY(gdaui_server_operation_new)
+  _WRAP_CTOR(ServerOperation(const Glib::RefPtr<Gnome::Gda::ServerOperation>& op), gdaui_server_operation_new)
+
+  _WRAP_METHOD_DOCS_ONLY(gdaui_server_operation_new_in_dialog)
+  _WRAP_CTOR(ServerOperation(const Glib::RefPtr<Gnome::Gda::ServerOperation>& op, Gtk::Window* parent, const Glib::ustring& title, const Glib::ustring& header), gdaui_server_operation_new_in_dialog)
+
+public:
+  _WRAP_PROPERTY("hide-single-header", bool)
+  _WRAP_PROPERTY("server-operation", Glib::RefPtr<Gnome::Gda::ServerOperation>)
+};
+
+} // namespace GdaUI
+
+} // namespace Gnome
diff --git a/tools/m4/convert_libgda_uimm.m4 b/tools/m4/convert_libgda_uimm.m4
index fd6e4ca..903dbd1 100644
--- a/tools/m4/convert_libgda_uimm.m4
+++ b/tools/m4/convert_libgda_uimm.m4
@@ -41,6 +41,9 @@ dnl Menu:
 _CONVERSION(`GtkMenu*', `Gtk::Menu*', `Glib::wrap($3)')
 _CONVERSION(`Gtk::Menu*', `GtkMenu*', `Glib::unwrap($3)')
 
+dnl ServerOperation:
+_CONVERSION(`const Glib::RefPtr<Gnome::Gda::ServerOperation>&', `GdaServerOperation*', `Glib::unwrap($3)')
+
 dnl ServerProvider:
 _CONVERSION(`GdaServerProvider*', `Glib::RefPtr<Gnome::Gda::ServerProvider>', `Glib::wrap($3)')
 
@@ -48,6 +51,10 @@ dnl Set:
 _CONVERSION(`const Glib::RefPtr<Gnome::Gda::Set>&', `GdaSet*', `Glib::unwrap($3)')
 _CONVERSION(`GdaSet*', `Glib::RefPtr<Gnome::Gda::Set>', `Glib::wrap($3)')
 
+dnl Gtk::TreeModel::iterator:
+_CONVERSION(`const Gtk::TreeModel::const_iterator&', `GtkTreeIter*', `const_cast<GtkTreeIter*>($3->gobj())')
+_CONVERSION(`const Gtk::TreeModel::iterator&', `GtkTreeIter*', `const_cast<GtkTreeIter*>($3->gobj())')
+
 dnl Window:
 _CONVERSION(`Gtk::Window*', `GtkWindow*', `Glib::unwrap($3)')
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]