[libgda-uimm] Add BasicForm class.



commit 86083a8017658a2742619b0cd51b0d123464de5d
Author: José Alburquerque <jaalburqu svn gnome org>
Date:   Wed Feb 24 18:42:17 2010 -0500

    	Add BasicForm class.
    
    	* libgda-ui/libgda-uimm.h:
    	* libgda-ui/src/filelist.am:
    	* libgda-ui/src/basicform.ccg:
    	* libgda-ui/src/basicform.hg: Add new BasicForm class.
    	* tools/m4/convert_libgda_uimm.m4: Added conversions for the BasicForm
    	class.
    
    	* libgda-ui/src/dataproxy.hg:
    	* libgda-ui/src/dataselector.hg:
    	* libgda-ui/src/providerselector.hg: Typos.

 ChangeLog                         |   15 ++++
 libgda-ui/libgda-uimm.h           |    1 +
 libgda-ui/src/basicform.ccg       |   32 +++++++
 libgda-ui/src/basicform.hg        |  165 +++++++++++++++++++++++++++++++++++++
 libgda-ui/src/dataproxy.hg        |    2 +-
 libgda-ui/src/dataselector.hg     |    2 +-
 libgda-ui/src/filelist.am         |    1 +
 libgda-ui/src/providerselector.hg |    1 -
 tools/m4/convert_libgda_uimm.m4   |   10 ++
 9 files changed, 226 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index eeee358..691be80 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,20 @@
 2010-02-24  José Alburquerque  <jaalburqu svn gnome org>
 
+	Add BasicForm class.
+
+	* libgda-ui/libgda-uimm.h:
+	* libgda-ui/src/filelist.am:
+	* libgda-ui/src/basicform.ccg:
+	* libgda-ui/src/basicform.hg: Add new BasicForm class.
+	* tools/m4/convert_libgda_uimm.m4: Added conversions for the BasicForm
+	class.
+
+	* libgda-ui/src/dataproxy.hg:
+	* libgda-ui/src/dataselector.hg:
+	* libgda-ui/src/providerselector.hg: Typos.
+
+2010-02-24  José Alburquerque  <jaalburqu svn gnome org>
+
 	Add DataProxy Interface.
 
 	* libgda-ui/libgda-uimm.h:
diff --git a/libgda-ui/libgda-uimm.h b/libgda-ui/libgda-uimm.h
index a96943b..b5f3237 100644
--- a/libgda-ui/libgda-uimm.h
+++ b/libgda-ui/libgda-uimm.h
@@ -20,6 +20,7 @@
 #ifndef _LIBGDA_UIMM_H
 #define _LIBGDA_UIMM_H
 
+#include <basicform.h>
 #include <combo.h>
 #include <dataproxy.h>
 #include <dataselector.h>
diff --git a/libgda-ui/src/basicform.ccg b/libgda-ui/src/basicform.ccg
new file mode 100644
index 0000000..1c503ac
--- /dev/null
+++ b/libgda-ui/src/basicform.ccg
@@ -0,0 +1,32 @@
+/* basicform.cc
+ * 
+ * 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-basic-form.h>
+#include <libgdamm/set.h>
+#include <gtkmm/window.h>
+
+namespace Gnome
+{
+
+namespace GdaUI
+{
+
+} /* namespace GdaUI */
+
+} /* namespace Gnome */
diff --git a/libgda-ui/src/basicform.hg b/libgda-ui/src/basicform.hg
new file mode 100644
index 0000000..fae6aa9
--- /dev/null
+++ b/libgda-ui/src/basicform.hg
@@ -0,0 +1,165 @@
+/* basicform.h
+ *
+ * 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>
+_PINCLUDE(gtkmm/private/box_p.h)
+_PINCLUDE(libgda/gda-holder.h)
+
+_DEFS(libgda-uimm,libgda_ui)
+
+// Gtk class forward declarations.
+namespace Gtk
+{
+
+class Widget;
+class Window;
+
+}
+
+namespace Gnome
+{
+
+// Gnome::Gda class forward declartions.
+namespace Gda
+{
+
+class Holder;
+class Set;
+
+}
+
+namespace GdaUI
+{
+
+/** BasicForm - Form widget mapping the values contained in a Gnome::Gda::Set.
+ * The BasicForm widget is a form containing an entry for each
+ * Gnome::Gda::Holder object contained in a Gnome::Gda::Set (specified when
+ * the form is created). A typical usage is when the user is requested to
+ * enter a value which will be used in a statement (without any error checking
+ * for clarity):
+ *
+ * - TODO: Translate and include example from C API docs.
+ *
+ * The default layout within a BasicForm  is a vertical column: all the data
+ * entry widgets are aligned in a single column. This behaviour can be
+ * changed using the set_layout_from_file() method or setting the xml-layout
+ * property.
+ *
+ * <H3>XML Layout Definitions</H3>
+ *
+ * The BasicForm class parses textual descriptions of XML layout which which
+ * can be described by the following DTD.
+ *
+ * @code
+ * <!ELEMENT gdaui_layouts (gdaui_form | gdaui_grid)>
+ * <!ELEMENT gdaui_form (gdaui_section | gdaui_column | gdaui_notebook)*>
+ * <!ATTLIST gdaui_form
+ *         name CDATA #REQUIRED
+ *         container (columns|rows|hpaned|vpaned) #IMPLIED>
+ * <!ELEMENT gdaui_section (gdaui_section | gdaui_column | gdaui_notebook)*>
+ * <!ATTLIST gdaui_section
+ *         title CDATA #IMPLIED >
+ * <!ELEMENT gdaui_notebook (gdaui_section | gdaui_column | gdaui_notebook)*>
+ * <!ELEMENT gdaui_column (gdaui_entry | gdaui_placeholder)*>
+ * <!ELEMENT gdaui_entry EMPTY>
+ * <!ATTLIST gdaui_entry
+ *         name CDATA #REQUIRED
+ *         editable (true|false) #IMPLIED
+ *         label CDATA #IMPLIED
+ *         plugin CDATA #IMPLIED>
+ * <!ELEMENT gdaui_placeholder EMPTY>
+ * <!ATTLIST gdaui_placeholder
+ *         id CDATA #REQUIRED
+ *         label CDATA #IMPLIED>
+ * @endcode
+ *
+ * <H3>Example 1. A BasicForm layout example</H3>
+ *
+ * @code
+ * <?xml version="1.0" encoding="UTF-8"?>
+ * <gdaui_layouts>
+ *   <gdaui_form name="customers" container="hpaned">
+ *     <gdaui_section title="Summary">
+ *       <gdaui_column>
+ *         <gdaui_entry name="id" editable="no"/>
+ *         <gdaui_entry name="name"/>
+ *         <gdaui_entry name="comments" plugin="text"/>
+ *         <gdaui_entry name="total_orders" label="Total ordered" plugin="number:NB_DECIMALS=2;CURRENCY=â?¬"/>
+ *       </gdaui_column>
+ *     </gdaui_section>
+ *     <gdaui_section title="Photo">
+ *       <gdaui_column>
+ *         <gdaui_entry name="photo" plugin="picture"/>
+ *       </gdaui_column>
+ *     </gdaui_section>
+ *   </gdaui_form>
+ * </gdaui_layouts>
+ * @endcode
+ */
+class BasicForm :
+  public Gtk::VBox
+{
+  _CLASS_GTKOBJECT(BasicForm, GdauiBasicForm, GDAUI_BASIC_FORM, Gtk::VBox, GtkVBox)
+
+public:
+  _WRAP_METHOD_DOCS_ONLY(gdaui_basic_form_new)
+  _WRAP_CTOR(BasicForm(const Glib::RefPtr<Gnome::Gda::Set>& data_set), gdaui_basic_form_new)
+
+  _WRAP_METHOD_DOCS_ONLY(gdaui_basic_form_new_in_dialog)
+  _WRAP_CTOR(BasicForm(const Glib::RefPtr<Gnome::Gda::Set>& data_set,
+    Gtk::Window* parent, const Glib::ustring& title,
+    const Glib::ustring& header), gdaui_basic_form_new_in_dialog)
+
+public:
+  _WRAP_METHOD(Glib::RefPtr<Gnome::Gda::Set> get_data_set(), gdaui_basic_form_get_data_set)
+  _WRAP_METHOD(Glib::RefPtr<const Gnome::Gda::Set> get_data_set() const, gdaui_basic_form_get_data_set, constversion)
+  _WRAP_METHOD(bool is_valid() const, gdaui_basic_form_is_valid)
+  _WRAP_METHOD(bool has_changed() const, gdaui_basic_form_has_changed)
+  _WRAP_METHOD(void reset(), gdaui_basic_form_reset)
+  _WRAP_METHOD(void set_as_reference(), gdaui_basic_form_set_as_reference)
+  _WRAP_METHOD(void entry_set_visible(const Glib::RefPtr<Gnome::Gda::Holder>& holder, bool show), gdaui_basic_form_entry_set_visible)
+  _WRAP_METHOD(void entry_grab_focus(const Glib::RefPtr<Gnome::Gda::Holder>& holder), gdaui_basic_form_entry_grab_focus)
+  _WRAP_METHOD(void entry_set_editable(const Glib::RefPtr<Gnome::Gda::Holder>& holder, bool editable), gdaui_basic_form_entry_set_editable)
+  _WRAP_METHOD(void set_entries_to_default(), gdaui_basic_form_set_entries_to_default)
+  _WRAP_METHOD(Gtk::Widget* get_entry_widget(const Glib::RefPtr<Gnome::Gda::Holder>& holder), gdaui_basic_form_get_entry_widget)
+  _WRAP_METHOD(const Gtk::Widget* get_entry_widget(const Glib::RefPtr<Gnome::Gda::Holder>& holder) const, gdaui_basic_form_get_entry_widget, constversion)
+  _WRAP_METHOD(Gtk::Widget* get_label_widget(const Glib::RefPtr<Gnome::Gda::Holder>& holder), gdaui_basic_form_get_label_widget)
+  _WRAP_METHOD(const Gtk::Widget* get_label_widget(const Glib::RefPtr<Gnome::Gda::Holder>& holder) const, gdaui_basic_form_get_label_widget, constversion)
+  _WRAP_METHOD(void set_layout_from_file(const std::string& file_name, const Glib::ustring& form_name), gdaui_basic_form_set_layout_from_file)
+  _WRAP_METHOD(Gtk::Widget* get_place_holder(const Glib::ustring& placeholder_id), gdaui_basic_form_get_place_holder)
+  _WRAP_METHOD(const Gtk::Widget* get_place_holder(const Glib::ustring& placeholder_id) const, gdaui_basic_form_get_place_holder)
+
+  _WRAP_SIGNAL(void activated(), "activated")
+
+#m4 _CONVERSION(`GdaHolder*', `const Glib::RefPtr<Gnome::Gda::Holder>&', `Glib::wrap($3, true)')
+  _WRAP_SIGNAL(void holder_changed(const Glib::RefPtr<Gnome::Gda::Holder>& holder, bool is_user_modified), "holder-changed")
+
+  _WRAP_SIGNAL(void layout_changed(), "layout-changed")
+
+  _WRAP_PROPERTY("can-expand", bool)
+  _WRAP_PROPERTY("entries-auto-default", bool)
+  _WRAP_PROPERTY("headers-sensitive", bool)
+  //TODO: _WRAP_PROPERTY("param-list", gpointer)
+  _WRAP_PROPERTY("show-actions", bool)
+  //TODO: _WRAP_PROPERTY("xml-layout", gpointer)
+};
+
+} // namespace GdaUI
+
+} // namespace Gnome
diff --git a/libgda-ui/src/dataproxy.hg b/libgda-ui/src/dataproxy.hg
index 91baf9f..be28ae1 100644
--- a/libgda-ui/src/dataproxy.hg
+++ b/libgda-ui/src/dataproxy.hg
@@ -33,7 +33,7 @@ class ActionGroup;
 namespace Gnome
 {
 
-// Gnome::Gda class declarations.
+// Gnome::Gda class forward declarations.
 namespace Gda
 {
 
diff --git a/libgda-ui/src/dataselector.hg b/libgda-ui/src/dataselector.hg
index c99ddd3..a63ab03 100644
--- a/libgda-ui/src/dataselector.hg
+++ b/libgda-ui/src/dataselector.hg
@@ -25,7 +25,7 @@ _DEFS(libgda-uimm,libgda_ui)
 namespace Gnome
 {
 
-// Gnome::Gda class declarations.
+// Gnome::Gda class forward declarations.
 namespace Gda
 {
 
diff --git a/libgda-ui/src/filelist.am b/libgda-ui/src/filelist.am
index 15b30bf..7a4a73f 100644
--- a/libgda-ui/src/filelist.am
+++ b/libgda-ui/src/filelist.am
@@ -9,6 +9,7 @@ files_defs =                            \
         libgda_ui_docs_override.xml
 
 files_hg =                              \
+        basicform.hg                    \
         combo.hg                        \
         dataproxy.hg                    \
         dataselector.hg                 \
diff --git a/libgda-ui/src/providerselector.hg b/libgda-ui/src/providerselector.hg
index ceb39d3..80ac717 100644
--- a/libgda-ui/src/providerselector.hg
+++ b/libgda-ui/src/providerselector.hg
@@ -43,7 +43,6 @@ class ProviderSelector :
   _CLASS_GTKOBJECT(ProviderSelector, GdauiProviderSelector, GDAUI_PROVIDER_SELECTOR, Combo, GdauiCombo)
 
 public:
-
   _WRAP_METHOD_DOCS_ONLY(gdaui_provider_selector_new)
   _WRAP_CTOR(ProviderSelector(), gdaui_provider_selector_new)
 
diff --git a/tools/m4/convert_libgda_uimm.m4 b/tools/m4/convert_libgda_uimm.m4
index 33e74c4..0da994d 100644
--- a/tools/m4/convert_libgda_uimm.m4
+++ b/tools/m4/convert_libgda_uimm.m4
@@ -23,7 +23,17 @@ dnl DataModelIter:
 _CONVERSION(`GdaDataModelIter*', `Glib::RefPtr<Gnome::Gda::DataModelIter>', `Glib::wrap($3)')
 _CONVERSION(`Glib::RefPtr<Gnome::Gda::DataModelIter>', `GdaDataModelIter*', `Glib::unwrap($3)')
 
+dnl Holder:
+_CONVERSION(`const Glib::RefPtr<Gnome::Gda::Holder>&', `GdaHolder*', `Glib::unwrap($3)')
+
 dnl ServerProvider:
 _CONVERSION(`GdaServerProvider*', `Glib::RefPtr<Gnome::Gda::ServerProvider>', `Glib::wrap($3)')
 
+dnl Set:
+_CONVERSION(`const Glib::RefPtr<Gnome::Gda::Set>&', `GdaSet*', `Glib::unwrap($3)')
+_CONVERSION(`GdaSet*', `Glib::RefPtr<Gnome::Gda::Set>', `Glib::wrap($3)')
+
+dnl Window:
+_CONVERSION(`Gtk::Window*', `GtkWindow*', `Glib::unwrap($3)')
+
 dnl General conversions:



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