]> saetta.ns0.it Git - libgtkform/commitdiff
Initial import
authorAndrea Zagli <azagli@libero.it>
Sun, 10 Dec 2006 07:40:08 +0000 (07:40 +0000)
committerAndrea Zagli <azagli@libero.it>
Sun, 10 Dec 2006 07:40:08 +0000 (07:40 +0000)
65 files changed:
AUTHORS [new file with mode: 0644]
ChangeLog [new file with mode: 0644]
Makefile.am [new file with mode: 0644]
NEWS [new file with mode: 0644]
README [new file with mode: 0644]
config.h.in [new file with mode: 0644]
configure.ac [new file with mode: 0644]
docs/Makefile.am [new file with mode: 0644]
docs/reference/Makefile.am [new file with mode: 0644]
docs/reference/libform-docs.sgml [new file with mode: 0644]
docs/reference/libform-overrides.txt [new file with mode: 0644]
docs/reference/libform-sections.txt [new file with mode: 0644]
docs/reference/libform-undocumented.txt [new file with mode: 0644]
docs/reference/libform.types [new file with mode: 0644]
docs/reference/tmpl/libform-unused.sgml [new file with mode: 0644]
docs/reference/tmpl/libform.sgml [new file with mode: 0644]
docs/reference/tmpl/libformfield.sgml [new file with mode: 0644]
docs/reference/tmpl/libformfieldboolean.sgml [new file with mode: 0644]
docs/reference/tmpl/libformfielddatetime.sgml [new file with mode: 0644]
docs/reference/tmpl/libformfieldfloat.sgml [new file with mode: 0644]
docs/reference/tmpl/libformfieldinteger.sgml [new file with mode: 0644]
docs/reference/tmpl/libformfieldtext.sgml [new file with mode: 0644]
docs/reference/tmpl/libformkey.sgml [new file with mode: 0644]
docs/reference/tmpl/libformwidget.sgml [new file with mode: 0644]
docs/reference/tmpl/libformwidgetcheck.sgml [new file with mode: 0644]
docs/reference/tmpl/libformwidgetentry.sgml [new file with mode: 0644]
docs/reference/tmpl/libformwidgetlabel.sgml [new file with mode: 0644]
docs/reference/tmpl/libformwidgetspin.sgml [new file with mode: 0644]
docs/reference/tmpl/libformwidgettextview.sgml [new file with mode: 0644]
docs/reference/version.xml.in [new file with mode: 0644]
libform.pc.in [new file with mode: 0644]
src/Makefile.am [new file with mode: 0644]
src/field.c [new file with mode: 0644]
src/fieldboolean.c [new file with mode: 0644]
src/fielddatetime.c [new file with mode: 0644]
src/fieldfloat.c [new file with mode: 0644]
src/fieldinteger.c [new file with mode: 0644]
src/fieldtext.c [new file with mode: 0644]
src/form.c [new file with mode: 0644]
src/formkey.c [new file with mode: 0644]
src/libform.h [new file with mode: 0644]
src/libformfield.h [new file with mode: 0644]
src/libformfieldboolean.h [new file with mode: 0644]
src/libformfielddatetime.h [new file with mode: 0644]
src/libformfieldfloat.h [new file with mode: 0644]
src/libformfieldinteger.h [new file with mode: 0644]
src/libformfieldtext.h [new file with mode: 0644]
src/libformkey.h [new file with mode: 0644]
src/libformwidget.h [new file with mode: 0644]
src/libformwidgetcheck.h [new file with mode: 0644]
src/libformwidgetentry.h [new file with mode: 0644]
src/libformwidgetlabel.h [new file with mode: 0644]
src/libformwidgetspin.h [new file with mode: 0644]
src/libformwidgettextview.h [new file with mode: 0644]
src/old/form.c [new file with mode: 0644]
src/old/libform.h [new file with mode: 0644]
src/widget.c [new file with mode: 0644]
src/widgetcheck.c [new file with mode: 0644]
src/widgetentry.c [new file with mode: 0644]
src/widgetlabel.c [new file with mode: 0644]
src/widgetspin.c [new file with mode: 0644]
src/widgettextview.c [new file with mode: 0644]
test/Makefile.am [new file with mode: 0644]
test/main.c [new file with mode: 0644]
test/test.glade [new file with mode: 0644]

diff --git a/AUTHORS b/AUTHORS
new file mode 100644 (file)
index 0000000..948556f
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1 @@
+Andrea Zagli <azagli@inwind.it>
diff --git a/ChangeLog b/ChangeLog
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/Makefile.am b/Makefile.am
new file mode 100644 (file)
index 0000000..a6e25de
--- /dev/null
@@ -0,0 +1,8 @@
+DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc
+
+SUBDIRS = src test docs
+
+EXTRA_DIST = libform.pc.in
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = libform.pc
diff --git a/NEWS b/NEWS
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/README b/README
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/config.h.in b/config.h.in
new file mode 100644 (file)
index 0000000..6928c1b
--- /dev/null
@@ -0,0 +1,64 @@
+/* config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the `localeconv' function. */
+#undef HAVE_LOCALECONV
+
+/* Define to 1 if you have the <locale.h> header file. */
+#undef HAVE_LOCALE_H
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Version number of package */
+#undef VERSION
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#undef const
diff --git a/configure.ac b/configure.ac
new file mode 100644 (file)
index 0000000..80384f0
--- /dev/null
@@ -0,0 +1,56 @@
+#                                               -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ(2.59)
+AC_INIT([libform], [0.0.1], [azagli@inwind.it])
+AC_CONFIG_SRCDIR([src/form.c])
+AC_CONFIG_HEADER([config.h])
+
+AM_INIT_AUTOMAKE
+AM_MAINTAINER_MODE
+
+AC_CANONICAL_SYSTEM
+
+AC_LIBTOOL_WIN32_DLL
+
+# Checks for programs.
+AC_PROG_CXX
+AC_PROG_CC
+AC_PROG_CPP
+AC_PROG_INSTALL
+AC_PROG_LN_S
+AC_PROG_MAKE_SET
+AC_PROG_LIBTOOL
+
+GTK_DOC_CHECK
+
+# Checks for libraries.
+PKG_CHECK_MODULES(FORM, [gtk+-2.0 >= 2.6.0
+                         libglade-2.0 >= 2.0.0
+                         libgdaobj >= 0.0.2])
+
+AC_SUBST(FORM_CFLAGS)
+AC_SUBST(FORM_LIBS)
+
+# Checks for header files.
+AC_HEADER_STDC
+AC_CHECK_HEADERS([locale.h string.h stdlib.h])
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+
+# Checks for library functions.
+AC_CHECK_FUNCS([localeconv])
+AC_FUNC_STRTOD
+
+# Checks for library functions.
+AC_CONFIG_FILES([
+  libform.pc
+  Makefile
+  src/Makefile
+  test/Makefile
+  docs/Makefile
+  docs/reference/Makefile
+  docs/reference/version.xml
+])
+AC_OUTPUT
diff --git a/docs/Makefile.am b/docs/Makefile.am
new file mode 100644 (file)
index 0000000..f3ddc22
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS = reference
diff --git a/docs/reference/Makefile.am b/docs/reference/Makefile.am
new file mode 100644 (file)
index 0000000..094ba4c
--- /dev/null
@@ -0,0 +1,78 @@
+## Process this file with automake to produce Makefile.in
+
+# We require automake 1.6 at least.
+AUTOMAKE_OPTIONS = 1.6
+
+# This is a blank Makefile.am for using gtk-doc.
+# Copy this to your project's API docs directory and modify the variables to
+# suit your project. See the GTK+ Makefiles in gtk+/docs/reference for examples
+# of using the various options.
+
+# The name of the module, e.g. 'glib'.
+DOC_MODULE=libform
+
+# The top-level SGML file. You can change this if you want to.
+DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.sgml
+
+# The directory containing the source code. Relative to $(srcdir).
+# gtk-doc will search all .c & .h files beneath here for inline comments
+# documenting the functions and macros.
+# e.g. DOC_SOURCE_DIR=../../../gtk
+DOC_SOURCE_DIR=../../src
+
+# Extra options to pass to gtkdoc-scangobj. Not normally needed.
+SCANGOBJ_OPTIONS=
+
+# Extra options to supply to gtkdoc-scan.
+# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED" 
+SCAN_OPTIONS=
+
+# Extra options to supply to gtkdoc-mkdb.
+# e.g. MKDB_OPTIONS=--sgml-mode --output-format=xml
+MKDB_OPTIONS=--sgml-mode --output-format=xml
+
+# Extra options to supply to gtkdoc-mktmpl
+# e.g. MKTMPL_OPTIONS=--only-section-tmpl
+MKTMPL_OPTIONS=
+
+# Extra options to supply to gtkdoc-fixref. Not normally needed.
+# e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html
+FIXXREF_OPTIONS=
+
+# Used for dependencies. The docs will be rebuilt if any of these change.
+# e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h
+# e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c
+HFILE_GLOB=$(top_srcdir)/src/*.h
+CFILE_GLOB=$(top_srcdir)/src/*.c
+
+# Header files to ignore when scanning.
+# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h
+IGNORE_HFILES=
+
+# Images to copy into HTML directory.
+# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png
+HTML_IMAGES=
+
+# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE).
+# e.g. content_files=running.sgml building.sgml changes-2.0.sgml
+content_files=
+
+# SGML files where gtk-doc abbrevations (#GtkWidget) are expanded
+# These files must be listed here *and* in content_files
+# e.g. expand_content_files=running.sgml
+expand_content_files=
+
+# CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library.
+# Only needed if you are using gtkdoc-scangobj to dynamically query widget
+# signals and properties.
+# e.g. INCLUDES=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS)
+# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib)
+INCLUDES=-I$(top_srcdir)/src $(FORM_CFLAGS)
+GTKDOC_LIBS=$(top_builddir)/src/libform.la $(FORM_LIBS)
+
+# This includes the standard gtk-doc make rules, copied by gtkdocize.
+include $(top_srcdir)/gtk-doc.make
+
+# Other files to distribute
+# e.g. EXTRA_DIST += version.xml.in
+EXTRA_DIST += version.xml.in
diff --git a/docs/reference/libform-docs.sgml b/docs/reference/libform-docs.sgml
new file mode 100644 (file)
index 0000000..19501bb
--- /dev/null
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" 
+               "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
+<!ENTITY version SYSTEM "version.xml">
+]>
+<book id="index" xmlns:xi="http://www.w3.org/2003/XInclude">
+  <bookinfo>
+    <title>LibForm Reference Manual</title>
+    <releaseinfo>for LibForm &version;</releaseinfo>
+  </bookinfo>
+
+  <chapter>
+    <title>LibForm API Reference</title>
+    <xi:include href="xml/libform.xml"/>
+    <xi:include href="xml/libformfield.xml"/>
+    <xi:include href="xml/libformwidget.xml"/>
+    <xi:include href="xml/libformwidgetlabel.xml"/>
+    <xi:include href="xml/libformfieldtext.xml"/>
+    <xi:include href="xml/libformkey.xml"/>
+    <xi:include href="xml/libformfielddatetime.xml"/>
+    <xi:include href="xml/libformfieldinteger.xml"/>
+    <xi:include href="xml/libformwidgetentry.xml"/>
+    <xi:include href="xml/libformwidgetspin.xml"/>
+    <xi:include href="xml/libformfieldboolean.xml"/>
+    <xi:include href="xml/libformfieldfloat.xml"/>
+    <xi:include href="xml/libformwidgetcheck.xml"/>
+    <xi:include href="xml/libformwidgettextview.xml"/>
+    <xi:include href="xml/libform.xml"/>
+  </chapter>
+</book>
diff --git a/docs/reference/libform-overrides.txt b/docs/reference/libform-overrides.txt
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/docs/reference/libform-sections.txt b/docs/reference/libform-sections.txt
new file mode 100644 (file)
index 0000000..badafd9
--- /dev/null
@@ -0,0 +1,259 @@
+<SECTION>
+<FILE>libform</FILE>
+TYPE_FORM
+FORM
+FORM_CLASS
+IS_FORM
+IS_FORM_CLASS
+FORM_GET_CLASS
+<TITLE>Form</TITLE>
+Form
+form_get_type
+form_new
+form_add_field
+form_remove_field
+form_clear
+form_check
+FormSqlType
+form_get_sql
+form_fill_from_datamodel
+</SECTION>
+
+<SECTION>
+<FILE>libformfield</FILE>
+TYPE_FORM_FIELD
+FORM_FIELD
+FORM_FIELD_CLASS
+IS_FORM_FIELD
+IS_FORM_FIELD_CLASS
+FORM_FIELD_GET_CLASS
+<TITLE>FormField</TITLE>
+FormField
+form_field_get_type
+form_field_new
+form_field_new_from_form_widget
+form_field_get_field_name
+form_field_get_value_stringify
+form_field_get_value
+form_field_get_value_sql
+form_field_clear
+form_field_is_empty
+form_field_set_from_datamodel
+</SECTION>
+
+<SECTION>
+<FILE>libformwidget</FILE>
+TYPE_FORM_WIDGET
+FORM_WIDGET
+FORM_WIDGET_CLASS
+IS_FORM_WIDGET
+IS_FORM_WIDGET_CLASS
+FORM_WIDGET_GET_CLASS
+<TITLE>FormWidget</TITLE>
+FormWidget
+form_widget_get_type
+form_widget_new
+form_widget_set_from_glade
+form_widget_get_widget
+form_widget_get_value_stringify
+form_widget_set_value_stringify
+</SECTION>
+
+<SECTION>
+<FILE>libformwidgetlabel</FILE>
+TYPE_FORM_WIDGET_LABEL
+FORM_WIDGET_LABEL
+FORM_WIDGET_LABEL_CLASS
+IS_FORM_WIDGET_LABEL
+IS_FORM_WIDGET_LABEL_CLASS
+FORM_WIDGET_LABEL_GET_CLASS
+<TITLE>FormWidgetLabel</TITLE>
+FormWidgetLabel
+form_widget_label_get_type
+form_widget_label_new
+form_widget_label_get_value_stringify
+form_widget_label_set_value_stringify
+</SECTION>
+
+<SECTION>
+<FILE>libformfieldtext</FILE>
+TYPE_FORM_FIELD_TEXT
+FORM_FIELD_TEXT
+FORM_FIELD_TEXT_CLASS
+IS_FORM_FIELD_TEXT
+IS_FORM_FIELD_TEXT_CLASS
+FORM_FIELD_TEXT_GET_CLASS
+<TITLE>FormFieldText</TITLE>
+FormFieldText
+form_field_text_get_type
+form_field_text_new
+form_field_text_get_value_stringify
+form_field_text_get_value
+form_field_text_get_value_sql
+form_field_text_clear
+form_field_text_is_empty
+form_field_text_set_from_datamodel
+</SECTION>
+
+<SECTION>
+<FILE>libformkey</FILE>
+TYPE_FORM_KEY
+FORM_KEY
+FORM_KEY_CLASS
+IS_FORM_KEY
+IS_FORM_KEY_CLASS
+FORM_KEY_GET_CLASS
+<TITLE>FormKey</TITLE>
+FormKey
+form_key_get_type
+form_key_new
+form_key_add_field
+form_key_remove_field
+form_key_check
+form_key_get_sql
+form_key_field_is_key
+</SECTION>
+
+<SECTION>
+<FILE>libformfielddatetime</FILE>
+TYPE_FORM_FIELD_DATETIME
+FORM_FIELD_DATETIME
+FORM_FIELD_DATETIME_CLASS
+IS_FORM_FIELD_DATETIME
+IS_FORM_FIELD_DATETIME_CLASS
+FORM_FIELD_DATETIME_GET_CLASS
+<TITLE>FormFieldDateTime</TITLE>
+FormFieldDateTime
+form_field_datetime_get_type
+form_field_datetime_new
+form_field_datetime_get_value_stringify
+form_field_datetime_get_value
+form_field_datetime_get_value_sql
+form_field_datetime_clear
+form_field_datetime_is_empty
+form_field_datetime_set_from_datamodel
+</SECTION>
+
+<SECTION>
+<FILE>libformfieldinteger</FILE>
+TYPE_FORM_FIELD_INTEGER
+FORM_FIELD_INTEGER
+FORM_FIELD_INTEGER_CLASS
+IS_FORM_FIELD_INTEGER
+IS_FORM_FIELD_INTEGER_CLASS
+FORM_FIELD_INTEGER_GET_CLASS
+<TITLE>FormFieldInteger</TITLE>
+FormFieldInteger
+form_field_integer_get_type
+form_field_integer_new
+form_field_integer_get_value_stringify
+form_field_integer_get_value
+form_field_integer_get_value_sql
+form_field_integer_clear
+form_field_integer_is_empty
+form_field_integer_set_from_datamodel
+</SECTION>
+
+<SECTION>
+<FILE>libformwidgetentry</FILE>
+TYPE_FORM_WIDGET_ENTRY
+FORM_WIDGET_ENTRY
+FORM_WIDGET_ENTRY_CLASS
+IS_FORM_WIDGET_ENTRY
+IS_FORM_WIDGET_ENTRY_CLASS
+FORM_WIDGET_ENTRY_GET_CLASS
+<TITLE>FormWidgetEntry</TITLE>
+FormWidgetEntry
+form_widget_entry_get_type
+form_widget_entry_new
+form_widget_entry_get_value_stringify
+form_widget_entry_set_value_stringify
+</SECTION>
+
+<SECTION>
+<FILE>libformwidgetspin</FILE>
+TYPE_FORM_WIDGET_SPIN
+FORM_WIDGET_SPIN
+FORM_WIDGET_SPIN_CLASS
+IS_FORM_WIDGET_SPIN
+IS_FORM_WIDGET_SPIN_CLASS
+FORM_WIDGET_SPIN_GET_CLASS
+<TITLE>FormWidgetSpin</TITLE>
+FormWidgetSpin
+form_widget_spin_get_type
+form_widget_spin_new
+form_widget_spin_get_value_stringify
+form_widget_spin_set_value_stringify
+</SECTION>
+
+<SECTION>
+<FILE>libformfieldboolean</FILE>
+TYPE_FORM_FIELD_BOOLEAN
+FORM_FIELD_BOOLEAN
+FORM_FIELD_BOOLEAN_CLASS
+IS_FORM_FIELD_BOOLEAN
+IS_FORM_FIELD_BOOLEAN_CLASS
+FORM_FIELD_BOOLEAN_GET_CLASS
+<TITLE>FormFieldBoolean</TITLE>
+FormFieldBoolean
+form_field_boolean_get_type
+form_field_boolean_new
+form_field_boolean_get_value_stringify
+form_field_boolean_get_value
+form_field_boolean_get_value_sql
+form_field_boolean_clear
+form_field_boolean_is_empty
+form_field_boolean_set_from_datamodel
+</SECTION>
+
+<SECTION>
+<FILE>libformfieldfloat</FILE>
+TYPE_FORM_FIELD_FLOAT
+FORM_FIELD_FLOAT
+FORM_FIELD_FLOAT_CLASS
+IS_FORM_FIELD_FLOAT
+IS_FORM_FIELD_FLOAT_CLASS
+FORM_FIELD_FLOAT_GET_CLASS
+<TITLE>FormFieldFloat</TITLE>
+FormFieldFloat
+form_field_float_get_type
+form_field_float_new
+form_field_float_get_value_stringify
+form_field_float_get_value
+form_field_float_get_value_sql
+form_field_float_clear
+form_field_float_is_empty
+form_field_float_set_from_datamodel
+</SECTION>
+
+<SECTION>
+<FILE>libformwidgetcheck</FILE>
+TYPE_FORM_WIDGET_CHECK
+FORM_WIDGET_CHECK
+FORM_WIDGET_CHECK_CLASS
+IS_FORM_WIDGET_CHECK
+IS_FORM_WIDGET_CHECK_CLASS
+FORM_WIDGET_CHECK_GET_CLASS
+<TITLE>FormWidgetCheck</TITLE>
+FormWidgetCheck
+form_widget_check_get_type
+form_widget_check_new
+form_widget_check_get_value_stringify
+form_widget_check_set_value_stringify
+</SECTION>
+
+<SECTION>
+<FILE>libformwidgettextview</FILE>
+TYPE_FORM_WIDGET_TEXTVIEW
+FORM_WIDGET_TEXTVIEW
+FORM_WIDGET_TEXTVIEW_CLASS
+IS_FORM_WIDGET_TEXTVIEW
+IS_FORM_WIDGET_TEXTVIEW_CLASS
+FORM_WIDGET_TEXTVIEW_GET_CLASS
+<TITLE>FormWidgetTextview</TITLE>
+FormWidgetTextview
+form_widget_textview_get_type
+form_widget_textview_new
+form_widget_textview_get_value_stringify
+form_widget_textview_set_value_stringify
+</SECTION>
diff --git a/docs/reference/libform-undocumented.txt b/docs/reference/libform-undocumented.txt
new file mode 100644 (file)
index 0000000..432c88b
--- /dev/null
@@ -0,0 +1,225 @@
+6% symbol docs coverage.
+13 symbols documented.
+1 symbols incomplete.
+216 not documented.
+
+
+FORM
+FORM_CLASS
+FORM_FIELD
+FORM_FIELD_BOOLEAN
+FORM_FIELD_BOOLEAN_CLASS
+FORM_FIELD_BOOLEAN_GET_CLASS
+FORM_FIELD_CLASS
+FORM_FIELD_DATETIME
+FORM_FIELD_DATETIME_CLASS
+FORM_FIELD_DATETIME_GET_CLASS
+FORM_FIELD_FLOAT
+FORM_FIELD_FLOAT_CLASS
+FORM_FIELD_FLOAT_GET_CLASS
+FORM_FIELD_GET_CLASS
+FORM_FIELD_INTEGER
+FORM_FIELD_INTEGER_CLASS
+FORM_FIELD_INTEGER_GET_CLASS
+FORM_FIELD_TEXT
+FORM_FIELD_TEXT_CLASS
+FORM_FIELD_TEXT_GET_CLASS
+FORM_GET_CLASS
+FORM_KEY
+FORM_KEY_CLASS
+FORM_KEY_GET_CLASS
+FORM_WIDGET
+FORM_WIDGET_CHECK
+FORM_WIDGET_CHECK_CLASS
+FORM_WIDGET_CHECK_GET_CLASS
+FORM_WIDGET_CLASS
+FORM_WIDGET_ENTRY
+FORM_WIDGET_ENTRY_CLASS
+FORM_WIDGET_ENTRY_GET_CLASS
+FORM_WIDGET_GET_CLASS
+FORM_WIDGET_LABEL
+FORM_WIDGET_LABEL_CLASS
+FORM_WIDGET_LABEL_GET_CLASS
+FORM_WIDGET_SPIN
+FORM_WIDGET_SPIN_CLASS
+FORM_WIDGET_SPIN_GET_CLASS
+FORM_WIDGET_TEXTVIEW
+FORM_WIDGET_TEXTVIEW_CLASS
+FORM_WIDGET_TEXTVIEW_GET_CLASS
+Form
+FormField
+FormFieldBoolean
+FormFieldDateTime
+FormFieldFloat
+FormFieldInteger
+FormFieldText
+FormKey
+FormSqlType
+FormWidget
+FormWidgetCheck
+FormWidgetEntry
+FormWidgetLabel
+FormWidgetSpin
+FormWidgetTextview
+IS_FORM
+IS_FORM_CLASS
+IS_FORM_FIELD
+IS_FORM_FIELD_BOOLEAN
+IS_FORM_FIELD_BOOLEAN_CLASS
+IS_FORM_FIELD_CLASS
+IS_FORM_FIELD_DATETIME
+IS_FORM_FIELD_DATETIME_CLASS
+IS_FORM_FIELD_FLOAT
+IS_FORM_FIELD_FLOAT_CLASS
+IS_FORM_FIELD_INTEGER
+IS_FORM_FIELD_INTEGER_CLASS
+IS_FORM_FIELD_TEXT
+IS_FORM_FIELD_TEXT_CLASS
+IS_FORM_KEY
+IS_FORM_KEY_CLASS
+IS_FORM_WIDGET
+IS_FORM_WIDGET_CHECK
+IS_FORM_WIDGET_CHECK_CLASS
+IS_FORM_WIDGET_CLASS
+IS_FORM_WIDGET_ENTRY
+IS_FORM_WIDGET_ENTRY_CLASS
+IS_FORM_WIDGET_LABEL
+IS_FORM_WIDGET_LABEL_CLASS
+IS_FORM_WIDGET_SPIN
+IS_FORM_WIDGET_SPIN_CLASS
+IS_FORM_WIDGET_TEXTVIEW
+IS_FORM_WIDGET_TEXTVIEW_CLASS
+TYPE_FORM
+TYPE_FORM_FIELD
+TYPE_FORM_FIELD_BOOLEAN
+TYPE_FORM_FIELD_DATETIME
+TYPE_FORM_FIELD_FLOAT
+TYPE_FORM_FIELD_INTEGER
+TYPE_FORM_FIELD_TEXT
+TYPE_FORM_KEY
+TYPE_FORM_WIDGET
+TYPE_FORM_WIDGET_CHECK
+TYPE_FORM_WIDGET_ENTRY
+TYPE_FORM_WIDGET_LABEL
+TYPE_FORM_WIDGET_SPIN
+TYPE_FORM_WIDGET_TEXTVIEW
+form_add_field
+form_check
+form_clear (Returns)
+form_field_boolean_clear
+form_field_boolean_get_type
+form_field_boolean_get_value
+form_field_boolean_get_value_sql
+form_field_boolean_get_value_stringify
+form_field_boolean_is_empty
+form_field_boolean_new
+form_field_boolean_set_from_datamodel
+form_field_clear
+form_field_datetime_clear
+form_field_datetime_get_type
+form_field_datetime_get_value
+form_field_datetime_get_value_sql
+form_field_datetime_get_value_stringify
+form_field_datetime_is_empty
+form_field_datetime_new
+form_field_datetime_set_from_datamodel
+form_field_float_clear
+form_field_float_get_type
+form_field_float_get_value
+form_field_float_get_value_sql
+form_field_float_get_value_stringify
+form_field_float_is_empty
+form_field_float_new
+form_field_float_set_from_datamodel
+form_field_get_field_name
+form_field_get_type
+form_field_get_value
+form_field_get_value_sql
+form_field_get_value_stringify
+form_field_integer_clear
+form_field_integer_get_type
+form_field_integer_get_value
+form_field_integer_get_value_sql
+form_field_integer_get_value_stringify
+form_field_integer_is_empty
+form_field_integer_new
+form_field_integer_set_from_datamodel
+form_field_is_empty
+form_field_new
+form_field_new_from_form_widget
+form_field_set_from_datamodel
+form_field_text_clear
+form_field_text_get_type
+form_field_text_get_value
+form_field_text_get_value_sql
+form_field_text_get_value_stringify
+form_field_text_is_empty
+form_field_text_new
+form_field_text_set_from_datamodel
+form_fill_from_datamodel
+form_get_sql
+form_get_type
+form_key_add_field
+form_key_check
+form_key_field_is_key
+form_key_get_sql
+form_key_get_type
+form_key_new
+form_key_remove_field
+form_new
+form_remove_field
+form_widget_check_get_type
+form_widget_check_get_value_stringify
+form_widget_check_new
+form_widget_check_set_value_stringify
+form_widget_entry_get_type
+form_widget_entry_get_value_stringify
+form_widget_entry_new
+form_widget_entry_set_value_stringify
+form_widget_get_type
+form_widget_get_value_stringify
+form_widget_get_widget
+form_widget_label_get_type
+form_widget_label_get_value_stringify
+form_widget_label_new
+form_widget_label_set_value_stringify
+form_widget_new
+form_widget_set_from_glade
+form_widget_set_value_stringify
+form_widget_spin_get_type
+form_widget_spin_get_value_stringify
+form_widget_spin_new
+form_widget_spin_set_value_stringify
+form_widget_textview_get_type
+form_widget_textview_get_value_stringify
+form_widget_textview_new
+form_widget_textview_set_value_stringify
+
+
+libform:Long_Description
+libform:Short_Description
+libformfield:Long_Description
+libformfield:Short_Description
+libformfieldboolean:Long_Description
+libformfieldboolean:Short_Description
+libformfielddatetime:Long_Description
+libformfielddatetime:Short_Description
+libformfieldfloat:Long_Description
+libformfieldfloat:Short_Description
+libformfieldinteger:Long_Description
+libformfieldinteger:Short_Description
+libformfieldtext:Long_Description
+libformfieldtext:Short_Description
+libformkey:Long_Description
+libformkey:Short_Description
+libformwidget:Long_Description
+libformwidget:Short_Description
+libformwidgetcheck:Long_Description
+libformwidgetcheck:Short_Description
+libformwidgetentry:Long_Description
+libformwidgetentry:Short_Description
+libformwidgetlabel:Long_Description
+libformwidgetlabel:Short_Description
+libformwidgetspin:Long_Description
+libformwidgetspin:Short_Description
+libformwidgettextview:Short_Description
diff --git a/docs/reference/libform.types b/docs/reference/libform.types
new file mode 100644 (file)
index 0000000..ee162b1
--- /dev/null
@@ -0,0 +1,27 @@
+#include <libform.h>
+#include <libformfield.h>
+#include <libformfieldboolean.h>
+#include <libformfieldfloat.h>
+#include <libformfieldinteger.h>
+#include <libformfieldtext.h>
+#include <libformkey.h>
+#include <libformwidget.h>
+#include <libformwidgetcheck.h>
+#include <libformwidgetentry.h>
+#include <libformwidgetlabel.h>
+#include <libformwidgetspin.h>
+#include <libformwidgettextview.h>
+
+form_get_type
+form_field_get_type
+form_field_boolean_get_type
+form_field_float_get_type
+form_field_integer_get_type
+form_field_text_get_type
+form_key_get_type
+form_widget_get_type
+form_widget_check_get_type
+form_widget_entry_get_type
+form_widget_label_get_type
+form_widget_spin_get_type
+form_widget_textview_get_type
diff --git a/docs/reference/tmpl/libform-unused.sgml b/docs/reference/tmpl/libform-unused.sgml
new file mode 100644 (file)
index 0000000..ba4290b
--- /dev/null
@@ -0,0 +1,19 @@
+<!-- ##### FUNCTION form_field_get ##### -->
+<para>
+
+</para>
+
+@form: 
+@field: 
+@value: 
+@Returns: 
+
+<!-- ##### FUNCTION form_set_glade ##### -->
+<para>
+
+</para>
+
+@form: 
+@glade: 
+@Returns: 
+
diff --git a/docs/reference/tmpl/libform.sgml b/docs/reference/tmpl/libform.sgml
new file mode 100644 (file)
index 0000000..bcdedbb
--- /dev/null
@@ -0,0 +1,167 @@
+<!-- ##### SECTION Title ##### -->
+Form
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### MACRO TYPE_FORM ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO FORM ##### -->
+<para>
+
+</para>
+
+@obj: 
+
+
+<!-- ##### MACRO FORM_CLASS ##### -->
+<para>
+
+</para>
+
+@klass: 
+
+
+<!-- ##### MACRO IS_FORM ##### -->
+<para>
+
+</para>
+
+@obj: 
+
+
+<!-- ##### MACRO IS_FORM_CLASS ##### -->
+<para>
+
+</para>
+
+@klass: 
+
+
+<!-- ##### MACRO FORM_GET_CLASS ##### -->
+<para>
+
+</para>
+
+@obj: 
+
+
+<!-- ##### STRUCT Form ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### ARG Form:key ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG Form:table ##### -->
+<para>
+
+</para>
+
+<!-- ##### FUNCTION form_get_type ##### -->
+<para>
+
+</para>
+
+@Returns: 
+
+
+<!-- ##### FUNCTION form_new ##### -->
+<para>
+
+</para>
+
+@Returns: 
+
+
+<!-- ##### FUNCTION form_add_field ##### -->
+<para>
+
+</para>
+
+@form: 
+@field: 
+@Returns: 
+
+
+<!-- ##### FUNCTION form_remove_field ##### -->
+<para>
+
+</para>
+
+@form: 
+@field: 
+@Returns: 
+
+
+<!-- ##### FUNCTION form_clear ##### -->
+<para>
+
+</para>
+
+@form: 
+@Returns: 
+
+
+<!-- ##### FUNCTION form_check ##### -->
+<para>
+
+</para>
+
+@form: 
+@Returns: 
+
+
+<!-- ##### ENUM FormSqlType ##### -->
+<para>
+
+</para>
+
+@FORM_SQL_SELECT: 
+@FORM_SQL_INSERT: 
+@FORM_SQL_UPDATE: 
+@FORM_SQL_DELETE: 
+
+<!-- ##### FUNCTION form_get_sql ##### -->
+<para>
+
+</para>
+
+@form: 
+@type: 
+@Returns: 
+
+
+<!-- ##### FUNCTION form_fill_from_datamodel ##### -->
+<para>
+
+</para>
+
+@form: 
+@dm: 
+@row: 
+@Returns: 
+
+
diff --git a/docs/reference/tmpl/libformfield.sgml b/docs/reference/tmpl/libformfield.sgml
new file mode 100644 (file)
index 0000000..4845e18
--- /dev/null
@@ -0,0 +1,177 @@
+<!-- ##### SECTION Title ##### -->
+FormField
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### MACRO TYPE_FORM_FIELD ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO FORM_FIELD ##### -->
+<para>
+
+</para>
+
+@obj: 
+
+
+<!-- ##### MACRO FORM_FIELD_CLASS ##### -->
+<para>
+
+</para>
+
+@klass: 
+
+
+<!-- ##### MACRO IS_FORM_FIELD ##### -->
+<para>
+
+</para>
+
+@obj: 
+
+
+<!-- ##### MACRO IS_FORM_FIELD_CLASS ##### -->
+<para>
+
+</para>
+
+@klass: 
+
+
+<!-- ##### MACRO FORM_FIELD_GET_CLASS ##### -->
+<para>
+
+</para>
+
+@obj: 
+
+
+<!-- ##### STRUCT FormField ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### ARG FormField:field ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG FormField:form-widget ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG FormField:obligatory ##### -->
+<para>
+
+</para>
+
+<!-- ##### FUNCTION form_field_get_type ##### -->
+<para>
+
+</para>
+
+@Returns: 
+
+
+<!-- ##### FUNCTION form_field_new ##### -->
+<para>
+
+</para>
+
+@Returns: 
+
+
+<!-- ##### FUNCTION form_field_new_from_form_widget ##### -->
+<para>
+
+</para>
+
+@fwidget: 
+@Returns: 
+
+
+<!-- ##### FUNCTION form_field_get_field_name ##### -->
+<para>
+
+</para>
+
+@field: 
+@Returns: 
+
+
+<!-- ##### FUNCTION form_field_get_value_stringify ##### -->
+<para>
+
+</para>
+
+@field: 
+@Returns: 
+
+
+<!-- ##### FUNCTION form_field_get_value ##### -->
+<para>
+
+</para>
+
+@field: 
+@Returns: 
+
+
+<!-- ##### FUNCTION form_field_get_value_sql ##### -->
+<para>
+
+</para>
+
+@field: 
+@Returns: 
+
+
+<!-- ##### FUNCTION form_field_clear ##### -->
+<para>
+
+</para>
+
+@field: 
+@Returns: 
+
+
+<!-- ##### FUNCTION form_field_is_empty ##### -->
+<para>
+
+</para>
+
+@field: 
+@Returns: 
+
+
+<!-- ##### FUNCTION form_field_set_from_datamodel ##### -->
+<para>
+
+</para>
+
+@field: 
+@dm: 
+@row: 
+@Returns: 
+
+
diff --git a/docs/reference/tmpl/libformfieldboolean.sgml b/docs/reference/tmpl/libformfieldboolean.sgml
new file mode 100644 (file)
index 0000000..96a81c4
--- /dev/null
@@ -0,0 +1,149 @@
+<!-- ##### SECTION Title ##### -->
+FormFieldBoolean
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### MACRO TYPE_FORM_FIELD_BOOLEAN ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO FORM_FIELD_BOOLEAN ##### -->
+<para>
+
+</para>
+
+@obj: 
+
+
+<!-- ##### MACRO FORM_FIELD_BOOLEAN_CLASS ##### -->
+<para>
+
+</para>
+
+@klass: 
+
+
+<!-- ##### MACRO IS_FORM_FIELD_BOOLEAN ##### -->
+<para>
+
+</para>
+
+@obj: 
+
+
+<!-- ##### MACRO IS_FORM_FIELD_BOOLEAN_CLASS ##### -->
+<para>
+
+</para>
+
+@klass: 
+
+
+<!-- ##### MACRO FORM_FIELD_BOOLEAN_GET_CLASS ##### -->
+<para>
+
+</para>
+
+@obj: 
+
+
+<!-- ##### STRUCT FormFieldBoolean ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### ARG FormFieldBoolean:default ##### -->
+<para>
+
+</para>
+
+<!-- ##### FUNCTION form_field_boolean_get_type ##### -->
+<para>
+
+</para>
+
+@Returns: 
+
+
+<!-- ##### FUNCTION form_field_boolean_new ##### -->
+<para>
+
+</para>
+
+@Returns: 
+
+
+<!-- ##### FUNCTION form_field_boolean_get_value_stringify ##### -->
+<para>
+
+</para>
+
+@field: 
+@Returns: 
+
+
+<!-- ##### FUNCTION form_field_boolean_get_value ##### -->
+<para>
+
+</para>
+
+@field: 
+@Returns: 
+
+
+<!-- ##### FUNCTION form_field_boolean_get_value_sql ##### -->
+<para>
+
+</para>
+
+@field: 
+@Returns: 
+
+
+<!-- ##### FUNCTION form_field_boolean_clear ##### -->
+<para>
+
+</para>
+
+@field: 
+@Returns: 
+
+
+<!-- ##### FUNCTION form_field_boolean_is_empty ##### -->
+<para>
+
+</para>
+
+@field: 
+@Returns: 
+
+
+<!-- ##### FUNCTION form_field_boolean_set_from_datamodel ##### -->
+<para>
+
+</para>
+
+@field: 
+@dm: 
+@row: 
+@Returns: 
+
+
diff --git a/docs/reference/tmpl/libformfielddatetime.sgml b/docs/reference/tmpl/libformfielddatetime.sgml
new file mode 100644 (file)
index 0000000..4d96d18
--- /dev/null
@@ -0,0 +1,145 @@
+<!-- ##### SECTION Title ##### -->
+FormFieldDateTime
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### MACRO TYPE_FORM_FIELD_DATETIME ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO FORM_FIELD_DATETIME ##### -->
+<para>
+
+</para>
+
+@obj: 
+
+
+<!-- ##### MACRO FORM_FIELD_DATETIME_CLASS ##### -->
+<para>
+
+</para>
+
+@klass: 
+
+
+<!-- ##### MACRO IS_FORM_FIELD_DATETIME ##### -->
+<para>
+
+</para>
+
+@obj: 
+
+
+<!-- ##### MACRO IS_FORM_FIELD_DATETIME_CLASS ##### -->
+<para>
+
+</para>
+
+@klass: 
+
+
+<!-- ##### MACRO FORM_FIELD_DATETIME_GET_CLASS ##### -->
+<para>
+
+</para>
+
+@obj: 
+
+
+<!-- ##### STRUCT FormFieldDateTime ##### -->
+<para>
+
+</para>
+
+@parent: 
+
+<!-- ##### FUNCTION form_field_datetime_get_type ##### -->
+<para>
+
+</para>
+
+@Returns: 
+
+
+<!-- ##### FUNCTION form_field_datetime_new ##### -->
+<para>
+
+</para>
+
+@Returns: 
+
+
+<!-- ##### FUNCTION form_field_datetime_get_value_stringify ##### -->
+<para>
+
+</para>
+
+@field: 
+@Returns: 
+
+
+<!-- ##### FUNCTION form_field_datetime_get_value ##### -->
+<para>
+
+</para>
+
+@field: 
+@Returns: 
+
+
+<!-- ##### FUNCTION form_field_datetime_get_value_sql ##### -->
+<para>
+
+</para>
+
+@field: 
+@Returns: 
+
+
+<!-- ##### FUNCTION form_field_datetime_clear ##### -->
+<para>
+
+</para>
+
+@field: 
+@Returns: 
+
+
+<!-- ##### FUNCTION form_field_datetime_is_empty ##### -->
+<para>
+
+</para>
+
+@field: 
+@Returns: 
+
+
+<!-- ##### FUNCTION form_field_datetime_set_from_datamodel ##### -->
+<para>
+
+</para>
+
+@field: 
+@dm: 
+@row: 
+@Returns: 
+
+
diff --git a/docs/reference/tmpl/libformfieldfloat.sgml b/docs/reference/tmpl/libformfieldfloat.sgml
new file mode 100644 (file)
index 0000000..3016dc1
--- /dev/null
@@ -0,0 +1,149 @@
+<!-- ##### SECTION Title ##### -->
+FormFieldFloat
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### MACRO TYPE_FORM_FIELD_FLOAT ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO FORM_FIELD_FLOAT ##### -->
+<para>
+
+</para>
+
+@obj: 
+
+
+<!-- ##### MACRO FORM_FIELD_FLOAT_CLASS ##### -->
+<para>
+
+</para>
+
+@klass: 
+
+
+<!-- ##### MACRO IS_FORM_FIELD_FLOAT ##### -->
+<para>
+
+</para>
+
+@obj: 
+
+
+<!-- ##### MACRO IS_FORM_FIELD_FLOAT_CLASS ##### -->
+<para>
+
+</para>
+
+@klass: 
+
+
+<!-- ##### MACRO FORM_FIELD_FLOAT_GET_CLASS ##### -->
+<para>
+
+</para>
+
+@obj: 
+
+
+<!-- ##### STRUCT FormFieldFloat ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### ARG FormFieldFloat:default ##### -->
+<para>
+
+</para>
+
+<!-- ##### FUNCTION form_field_float_get_type ##### -->
+<para>
+
+</para>
+
+@Returns: 
+
+
+<!-- ##### FUNCTION form_field_float_new ##### -->
+<para>
+
+</para>
+
+@Returns: 
+
+
+<!-- ##### FUNCTION form_field_float_get_value_stringify ##### -->
+<para>
+
+</para>
+
+@field: 
+@Returns: 
+
+
+<!-- ##### FUNCTION form_field_float_get_value ##### -->
+<para>
+
+</para>
+
+@field: 
+@Returns: 
+
+
+<!-- ##### FUNCTION form_field_float_get_value_sql ##### -->
+<para>
+
+</para>
+
+@field: 
+@Returns: 
+
+
+<!-- ##### FUNCTION form_field_float_clear ##### -->
+<para>
+
+</para>
+
+@field: 
+@Returns: 
+
+
+<!-- ##### FUNCTION form_field_float_is_empty ##### -->
+<para>
+
+</para>
+
+@field: 
+@Returns: 
+
+
+<!-- ##### FUNCTION form_field_float_set_from_datamodel ##### -->
+<para>
+
+</para>
+
+@field: 
+@dm: 
+@row: 
+@Returns: 
+
+
diff --git a/docs/reference/tmpl/libformfieldinteger.sgml b/docs/reference/tmpl/libformfieldinteger.sgml
new file mode 100644 (file)
index 0000000..1e91a9f
--- /dev/null
@@ -0,0 +1,149 @@
+<!-- ##### SECTION Title ##### -->
+FormFieldInteger
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### MACRO TYPE_FORM_FIELD_INTEGER ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO FORM_FIELD_INTEGER ##### -->
+<para>
+
+</para>
+
+@obj: 
+
+
+<!-- ##### MACRO FORM_FIELD_INTEGER_CLASS ##### -->
+<para>
+
+</para>
+
+@klass: 
+
+
+<!-- ##### MACRO IS_FORM_FIELD_INTEGER ##### -->
+<para>
+
+</para>
+
+@obj: 
+
+
+<!-- ##### MACRO IS_FORM_FIELD_INTEGER_CLASS ##### -->
+<para>
+
+</para>
+
+@klass: 
+
+
+<!-- ##### MACRO FORM_FIELD_INTEGER_GET_CLASS ##### -->
+<para>
+
+</para>
+
+@obj: 
+
+
+<!-- ##### STRUCT FormFieldInteger ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### ARG FormFieldInteger:default ##### -->
+<para>
+
+</para>
+
+<!-- ##### FUNCTION form_field_integer_get_type ##### -->
+<para>
+
+</para>
+
+@Returns: 
+
+
+<!-- ##### FUNCTION form_field_integer_new ##### -->
+<para>
+
+</para>
+
+@Returns: 
+
+
+<!-- ##### FUNCTION form_field_integer_get_value_stringify ##### -->
+<para>
+
+</para>
+
+@field: 
+@Returns: 
+
+
+<!-- ##### FUNCTION form_field_integer_get_value ##### -->
+<para>
+
+</para>
+
+@field: 
+@Returns: 
+
+
+<!-- ##### FUNCTION form_field_integer_get_value_sql ##### -->
+<para>
+
+</para>
+
+@field: 
+@Returns: 
+
+
+<!-- ##### FUNCTION form_field_integer_clear ##### -->
+<para>
+
+</para>
+
+@field: 
+@Returns: 
+
+
+<!-- ##### FUNCTION form_field_integer_is_empty ##### -->
+<para>
+
+</para>
+
+@field: 
+@Returns: 
+
+
+<!-- ##### FUNCTION form_field_integer_set_from_datamodel ##### -->
+<para>
+
+</para>
+
+@field: 
+@dm: 
+@row: 
+@Returns: 
+
+
diff --git a/docs/reference/tmpl/libformfieldtext.sgml b/docs/reference/tmpl/libformfieldtext.sgml
new file mode 100644 (file)
index 0000000..c4d8965
--- /dev/null
@@ -0,0 +1,149 @@
+<!-- ##### SECTION Title ##### -->
+FormFieldText
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### MACRO TYPE_FORM_FIELD_TEXT ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO FORM_FIELD_TEXT ##### -->
+<para>
+
+</para>
+
+@obj: 
+
+
+<!-- ##### MACRO FORM_FIELD_TEXT_CLASS ##### -->
+<para>
+
+</para>
+
+@klass: 
+
+
+<!-- ##### MACRO IS_FORM_FIELD_TEXT ##### -->
+<para>
+
+</para>
+
+@obj: 
+
+
+<!-- ##### MACRO IS_FORM_FIELD_TEXT_CLASS ##### -->
+<para>
+
+</para>
+
+@klass: 
+
+
+<!-- ##### MACRO FORM_FIELD_TEXT_GET_CLASS ##### -->
+<para>
+
+</para>
+
+@obj: 
+
+
+<!-- ##### STRUCT FormFieldText ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### ARG FormFieldText:default ##### -->
+<para>
+
+</para>
+
+<!-- ##### FUNCTION form_field_text_get_type ##### -->
+<para>
+
+</para>
+
+@Returns: 
+
+
+<!-- ##### FUNCTION form_field_text_new ##### -->
+<para>
+
+</para>
+
+@Returns: 
+
+
+<!-- ##### FUNCTION form_field_text_get_value_stringify ##### -->
+<para>
+
+</para>
+
+@field: 
+@Returns: 
+
+
+<!-- ##### FUNCTION form_field_text_get_value ##### -->
+<para>
+
+</para>
+
+@field: 
+@Returns: 
+
+
+<!-- ##### FUNCTION form_field_text_get_value_sql ##### -->
+<para>
+
+</para>
+
+@field: 
+@Returns: 
+
+
+<!-- ##### FUNCTION form_field_text_clear ##### -->
+<para>
+
+</para>
+
+@field: 
+@Returns: 
+
+
+<!-- ##### FUNCTION form_field_text_is_empty ##### -->
+<para>
+
+</para>
+
+@field: 
+@Returns: 
+
+
+<!-- ##### FUNCTION form_field_text_set_from_datamodel ##### -->
+<para>
+
+</para>
+
+@field: 
+@dm: 
+@row: 
+@Returns: 
+
+
diff --git a/docs/reference/tmpl/libformkey.sgml b/docs/reference/tmpl/libformkey.sgml
new file mode 100644 (file)
index 0000000..2683c34
--- /dev/null
@@ -0,0 +1,136 @@
+<!-- ##### SECTION Title ##### -->
+FormKey
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### MACRO TYPE_FORM_KEY ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO FORM_KEY ##### -->
+<para>
+
+</para>
+
+@obj: 
+
+
+<!-- ##### MACRO FORM_KEY_CLASS ##### -->
+<para>
+
+</para>
+
+@klass: 
+
+
+<!-- ##### MACRO IS_FORM_KEY ##### -->
+<para>
+
+</para>
+
+@obj: 
+
+
+<!-- ##### MACRO IS_FORM_KEY_CLASS ##### -->
+<para>
+
+</para>
+
+@klass: 
+
+
+<!-- ##### MACRO FORM_KEY_GET_CLASS ##### -->
+<para>
+
+</para>
+
+@obj: 
+
+
+<!-- ##### STRUCT FormKey ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### FUNCTION form_key_get_type ##### -->
+<para>
+
+</para>
+
+@Returns: 
+
+
+<!-- ##### FUNCTION form_key_new ##### -->
+<para>
+
+</para>
+
+@Returns: 
+
+
+<!-- ##### FUNCTION form_key_add_field ##### -->
+<para>
+
+</para>
+
+@form_key: 
+@field: 
+@Returns: 
+
+
+<!-- ##### FUNCTION form_key_remove_field ##### -->
+<para>
+
+</para>
+
+@form_key: 
+@field: 
+@Returns: 
+
+
+<!-- ##### FUNCTION form_key_check ##### -->
+<para>
+
+</para>
+
+@form_key: 
+@Returns: 
+
+
+<!-- ##### FUNCTION form_key_get_sql ##### -->
+<para>
+
+</para>
+
+@form_key: 
+@Returns: 
+
+
+<!-- ##### FUNCTION form_key_field_is_key ##### -->
+<para>
+
+</para>
+
+@form_key: 
+@field: 
+@Returns: 
+
+
diff --git a/docs/reference/tmpl/libformwidget.sgml b/docs/reference/tmpl/libformwidget.sgml
new file mode 100644 (file)
index 0000000..0aa68ab
--- /dev/null
@@ -0,0 +1,137 @@
+<!-- ##### SECTION Title ##### -->
+FormWidget
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### MACRO TYPE_FORM_WIDGET ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO FORM_WIDGET ##### -->
+<para>
+
+</para>
+
+@obj: 
+
+
+<!-- ##### MACRO FORM_WIDGET_CLASS ##### -->
+<para>
+
+</para>
+
+@klass: 
+
+
+<!-- ##### MACRO IS_FORM_WIDGET ##### -->
+<para>
+
+</para>
+
+@obj: 
+
+
+<!-- ##### MACRO IS_FORM_WIDGET_CLASS ##### -->
+<para>
+
+</para>
+
+@klass: 
+
+
+<!-- ##### MACRO FORM_WIDGET_GET_CLASS ##### -->
+<para>
+
+</para>
+
+@obj: 
+
+
+<!-- ##### STRUCT FormWidget ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### ARG FormWidget:widget ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG FormWidget:widget-name ##### -->
+<para>
+
+</para>
+
+<!-- ##### FUNCTION form_widget_get_type ##### -->
+<para>
+
+</para>
+
+@Returns: 
+
+
+<!-- ##### FUNCTION form_widget_new ##### -->
+<para>
+
+</para>
+
+@Returns: 
+
+
+<!-- ##### FUNCTION form_widget_set_from_glade ##### -->
+<para>
+
+</para>
+
+@fwidget: 
+@glade: 
+@widget_name: 
+@Returns: 
+
+
+<!-- ##### FUNCTION form_widget_get_widget ##### -->
+<para>
+
+</para>
+
+@fwidget: 
+@Returns: 
+
+
+<!-- ##### FUNCTION form_widget_get_value_stringify ##### -->
+<para>
+
+</para>
+
+@fwidget: 
+@Returns: 
+
+
+<!-- ##### FUNCTION form_widget_set_value_stringify ##### -->
+<para>
+
+</para>
+
+@fwidget: 
+@value: 
+@Returns: 
+
+
diff --git a/docs/reference/tmpl/libformwidgetcheck.sgml b/docs/reference/tmpl/libformwidgetcheck.sgml
new file mode 100644 (file)
index 0000000..2f31241
--- /dev/null
@@ -0,0 +1,107 @@
+<!-- ##### SECTION Title ##### -->
+FormWidgetCheck
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### MACRO TYPE_FORM_WIDGET_CHECK ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO FORM_WIDGET_CHECK ##### -->
+<para>
+
+</para>
+
+@obj: 
+
+
+<!-- ##### MACRO FORM_WIDGET_CHECK_CLASS ##### -->
+<para>
+
+</para>
+
+@klass: 
+
+
+<!-- ##### MACRO IS_FORM_WIDGET_CHECK ##### -->
+<para>
+
+</para>
+
+@obj: 
+
+
+<!-- ##### MACRO IS_FORM_WIDGET_CHECK_CLASS ##### -->
+<para>
+
+</para>
+
+@klass: 
+
+
+<!-- ##### MACRO FORM_WIDGET_CHECK_GET_CLASS ##### -->
+<para>
+
+</para>
+
+@obj: 
+
+
+<!-- ##### STRUCT FormWidgetCheck ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### FUNCTION form_widget_check_get_type ##### -->
+<para>
+
+</para>
+
+@Returns: 
+
+
+<!-- ##### FUNCTION form_widget_check_new ##### -->
+<para>
+
+</para>
+
+@Returns: 
+
+
+<!-- ##### FUNCTION form_widget_check_get_value_stringify ##### -->
+<para>
+
+</para>
+
+@widget: 
+@Returns: 
+
+
+<!-- ##### FUNCTION form_widget_check_set_value_stringify ##### -->
+<para>
+
+</para>
+
+@fwidget: 
+@value: 
+@Returns: 
+
+
diff --git a/docs/reference/tmpl/libformwidgetentry.sgml b/docs/reference/tmpl/libformwidgetentry.sgml
new file mode 100644 (file)
index 0000000..8ddb267
--- /dev/null
@@ -0,0 +1,107 @@
+<!-- ##### SECTION Title ##### -->
+FormWidgetEntry
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### MACRO TYPE_FORM_WIDGET_ENTRY ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO FORM_WIDGET_ENTRY ##### -->
+<para>
+
+</para>
+
+@obj: 
+
+
+<!-- ##### MACRO FORM_WIDGET_ENTRY_CLASS ##### -->
+<para>
+
+</para>
+
+@klass: 
+
+
+<!-- ##### MACRO IS_FORM_WIDGET_ENTRY ##### -->
+<para>
+
+</para>
+
+@obj: 
+
+
+<!-- ##### MACRO IS_FORM_WIDGET_ENTRY_CLASS ##### -->
+<para>
+
+</para>
+
+@klass: 
+
+
+<!-- ##### MACRO FORM_WIDGET_ENTRY_GET_CLASS ##### -->
+<para>
+
+</para>
+
+@obj: 
+
+
+<!-- ##### STRUCT FormWidgetEntry ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### FUNCTION form_widget_entry_get_type ##### -->
+<para>
+
+</para>
+
+@Returns: 
+
+
+<!-- ##### FUNCTION form_widget_entry_new ##### -->
+<para>
+
+</para>
+
+@Returns: 
+
+
+<!-- ##### FUNCTION form_widget_entry_get_value_stringify ##### -->
+<para>
+
+</para>
+
+@widget: 
+@Returns: 
+
+
+<!-- ##### FUNCTION form_widget_entry_set_value_stringify ##### -->
+<para>
+
+</para>
+
+@fwidget: 
+@value: 
+@Returns: 
+
+
diff --git a/docs/reference/tmpl/libformwidgetlabel.sgml b/docs/reference/tmpl/libformwidgetlabel.sgml
new file mode 100644 (file)
index 0000000..a9dfbfc
--- /dev/null
@@ -0,0 +1,107 @@
+<!-- ##### SECTION Title ##### -->
+FormWidgetLabel
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### MACRO TYPE_FORM_WIDGET_LABEL ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO FORM_WIDGET_LABEL ##### -->
+<para>
+
+</para>
+
+@obj: 
+
+
+<!-- ##### MACRO FORM_WIDGET_LABEL_CLASS ##### -->
+<para>
+
+</para>
+
+@klass: 
+
+
+<!-- ##### MACRO IS_FORM_WIDGET_LABEL ##### -->
+<para>
+
+</para>
+
+@obj: 
+
+
+<!-- ##### MACRO IS_FORM_WIDGET_LABEL_CLASS ##### -->
+<para>
+
+</para>
+
+@klass: 
+
+
+<!-- ##### MACRO FORM_WIDGET_LABEL_GET_CLASS ##### -->
+<para>
+
+</para>
+
+@obj: 
+
+
+<!-- ##### STRUCT FormWidgetLabel ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### FUNCTION form_widget_label_get_type ##### -->
+<para>
+
+</para>
+
+@Returns: 
+
+
+<!-- ##### FUNCTION form_widget_label_new ##### -->
+<para>
+
+</para>
+
+@Returns: 
+
+
+<!-- ##### FUNCTION form_widget_label_get_value_stringify ##### -->
+<para>
+
+</para>
+
+@widget: 
+@Returns: 
+
+
+<!-- ##### FUNCTION form_widget_label_set_value_stringify ##### -->
+<para>
+
+</para>
+
+@fwidget: 
+@value: 
+@Returns: 
+
+
diff --git a/docs/reference/tmpl/libformwidgetspin.sgml b/docs/reference/tmpl/libformwidgetspin.sgml
new file mode 100644 (file)
index 0000000..4327007
--- /dev/null
@@ -0,0 +1,107 @@
+<!-- ##### SECTION Title ##### -->
+FormWidgetSpin
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### MACRO TYPE_FORM_WIDGET_SPIN ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO FORM_WIDGET_SPIN ##### -->
+<para>
+
+</para>
+
+@obj: 
+
+
+<!-- ##### MACRO FORM_WIDGET_SPIN_CLASS ##### -->
+<para>
+
+</para>
+
+@klass: 
+
+
+<!-- ##### MACRO IS_FORM_WIDGET_SPIN ##### -->
+<para>
+
+</para>
+
+@obj: 
+
+
+<!-- ##### MACRO IS_FORM_WIDGET_SPIN_CLASS ##### -->
+<para>
+
+</para>
+
+@klass: 
+
+
+<!-- ##### MACRO FORM_WIDGET_SPIN_GET_CLASS ##### -->
+<para>
+
+</para>
+
+@obj: 
+
+
+<!-- ##### STRUCT FormWidgetSpin ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### FUNCTION form_widget_spin_get_type ##### -->
+<para>
+
+</para>
+
+@Returns: 
+
+
+<!-- ##### FUNCTION form_widget_spin_new ##### -->
+<para>
+
+</para>
+
+@Returns: 
+
+
+<!-- ##### FUNCTION form_widget_spin_get_value_stringify ##### -->
+<para>
+
+</para>
+
+@widget: 
+@Returns: 
+
+
+<!-- ##### FUNCTION form_widget_spin_set_value_stringify ##### -->
+<para>
+
+</para>
+
+@fwidget: 
+@value: 
+@Returns: 
+
+
diff --git a/docs/reference/tmpl/libformwidgettextview.sgml b/docs/reference/tmpl/libformwidgettextview.sgml
new file mode 100644 (file)
index 0000000..a743b74
--- /dev/null
@@ -0,0 +1,107 @@
+<!-- ##### SECTION Title ##### -->
+FormWidgetTextview
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### MACRO TYPE_FORM_WIDGET_TEXTVIEW ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO FORM_WIDGET_TEXTVIEW ##### -->
+<para>
+
+</para>
+
+@obj: 
+
+
+<!-- ##### MACRO FORM_WIDGET_TEXTVIEW_CLASS ##### -->
+<para>
+
+</para>
+
+@klass: 
+
+
+<!-- ##### MACRO IS_FORM_WIDGET_TEXTVIEW ##### -->
+<para>
+
+</para>
+
+@obj: 
+
+
+<!-- ##### MACRO IS_FORM_WIDGET_TEXTVIEW_CLASS ##### -->
+<para>
+
+</para>
+
+@klass: 
+
+
+<!-- ##### MACRO FORM_WIDGET_TEXTVIEW_GET_CLASS ##### -->
+<para>
+
+</para>
+
+@obj: 
+
+
+<!-- ##### STRUCT FormWidgetTextview ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### FUNCTION form_widget_textview_get_type ##### -->
+<para>
+
+</para>
+
+@Returns: 
+
+
+<!-- ##### FUNCTION form_widget_textview_new ##### -->
+<para>
+
+</para>
+
+@Returns: 
+
+
+<!-- ##### FUNCTION form_widget_textview_get_value_stringify ##### -->
+<para>
+
+</para>
+
+@widget: 
+@Returns: 
+
+
+<!-- ##### FUNCTION form_widget_textview_set_value_stringify ##### -->
+<para>
+
+</para>
+
+@fwidget: 
+@value: 
+@Returns: 
+
+
diff --git a/docs/reference/version.xml.in b/docs/reference/version.xml.in
new file mode 100644 (file)
index 0000000..a24f987
--- /dev/null
@@ -0,0 +1 @@
+@PACKAGE_VERSION@
diff --git a/libform.pc.in b/libform.pc.in
new file mode 100644 (file)
index 0000000..a001c56
--- /dev/null
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: @PACKAGE_NAME@
+Description: Class for forms
+Version: @PACKAGE_VERSION@
+Requires: gtk+-2.0, libglade-2.0, libgdaobj
+Libs: -L${libdir} -lform
+Cflags: -I${includedir}/libform
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644 (file)
index 0000000..b2a4d67
--- /dev/null
@@ -0,0 +1,39 @@
+LIBS = $(FORM_LIBS)
+
+AM_CPPFLAGS = $(FORM_CFLAGS)
+
+lib_LTLIBRARIES = libform.la
+
+libform_la_SOURCES = form.c \
+                     formkey.c \
+                     field.c \
+                     fieldtext.c \
+                     fieldinteger.c \
+                     fieldfloat.c \
+                     fieldboolean.c \
+                     fielddatetime.c \
+                     widget.c \
+                     widgetlabel.c \
+                     widgetentry.c \
+                     widgettextview.c \
+                     widgetspin.c \
+                     widgetcheck.c
+
+libform_la_LDFLAGS = -no-undefined
+
+libform_include_HEADERS = libform.h \
+                  libformkey.h \
+                  libformfield.h \
+                  libformfieldtext.h \
+                  libformfieldinteger.h \
+                  libformfieldfloat.h \
+                  libformfieldboolean.h \
+                  libformfielddatetime.h \
+                  libformwidget.h \
+                  libformwidgetlabel.h \
+                  libformwidgetentry.h \
+                  libformwidgettextview.h \
+                  libformwidgetspin.h \
+                  libformwidgetcheck.h
+
+libform_includedir = $(includedir)/libform
diff --git a/src/field.c b/src/field.c
new file mode 100644 (file)
index 0000000..08ecb7b
--- /dev/null
@@ -0,0 +1,311 @@
+/*
+ * Copyright (C) 2005-2006 Andrea Zagli <azagli@inwind.it>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <gtk/gtk.h>
+
+#include "libformwidget.h"
+#include "libformfield.h"
+
+enum
+{
+       PROP_0,
+       PROP_FIELD,
+       PROP_OBLIGATORY,
+       PROP_DATAMODEL,
+       PROP_WIDGET
+};
+
+static void form_field_class_init (FormFieldClass *klass);
+static void form_field_init (FormField *form_field);
+
+static void form_field_set_property (GObject *object,
+                                     guint property_id,
+                                     const GValue *value,
+                                     GParamSpec *pspec);
+static void form_field_get_property (GObject *object,
+                                     guint property_id,
+                                     GValue *value,
+                                     GParamSpec *pspec);
+
+#define FORM_FIELD_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_FORM_FIELD, FormFieldPrivate))
+
+typedef struct _FormFieldPrivate FormFieldPrivate;
+struct _FormFieldPrivate
+       {
+               gchar *field;
+               gboolean is_key;
+               gboolean obligatory;
+
+               GdaDataModel *dm;
+
+               FormWidget *widget;
+       };
+
+
+GType
+form_field_get_type (void)
+{
+       static GType form_field_type = 0;
+
+       if (!form_field_type)
+               {
+                       static const GTypeInfo form_field_info =
+                       {
+                               sizeof (FormFieldClass),
+                               NULL,           /* base_init */
+                               NULL,           /* base_finalize */
+                               (GClassInitFunc) form_field_class_init,
+                               NULL,           /* class_finalize */
+                               NULL,           /* class_data */
+                               sizeof (FormField),
+                               0,              /* n_preallocs */
+                               (GInstanceInitFunc) form_field_init,
+                               NULL
+                       };
+
+                       form_field_type = g_type_register_static (G_TYPE_OBJECT, "FormField",
+                                                                 &form_field_info, 0);
+    }
+
+       return form_field_type;
+}
+
+static void
+form_field_class_init (FormFieldClass *klass)
+{
+       GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+       object_class->set_property = form_field_set_property;
+       object_class->get_property = form_field_get_property;
+
+       klass->get_value_stringify = NULL;
+       klass->get_value = NULL;
+       klass->get_value_sql = NULL;
+
+       g_object_class_install_property (object_class, PROP_FIELD,
+                                        g_param_spec_string ("field",
+                                                             "Field",
+                                                             "Field's name",
+                                                             "",
+                                                             G_PARAM_READWRITE));
+
+       g_object_class_install_property (object_class, PROP_OBLIGATORY,
+                                        g_param_spec_boolean ("obligatory",
+                                                              "Obligatory",
+                                                              "Whether the field could be empty",
+                                                              FALSE,
+                                                              G_PARAM_READWRITE));
+
+       g_object_class_install_property (object_class, PROP_WIDGET,
+                                        g_param_spec_object ("form-widget",
+                                                             "FormWidget",
+                                                             "The FormWidget",
+                                                                                                                                                                                                                               TYPE_FORM_WIDGET,
+                                                             G_PARAM_READWRITE));
+
+       g_type_class_add_private (object_class, sizeof (FormFieldPrivate));
+}
+
+static void
+form_field_init (FormField *form_field)
+{
+}
+
+/**
+ * form_field_new:
+ *
+ * Returns: the newly created #FormField.
+ */
+FormField
+*form_field_new ()
+{
+       return g_object_new (TYPE_FORM_FIELD, NULL);
+}
+
+/**
+ * form_field_new_from_form_widget:
+ * @fwidget:
+ *
+ * Returns: the newly created #FormField.
+ */
+FormField
+*form_field_new_from_form_widget (FormWidget *fwidget)
+{
+       FormField *f = form_field_new ();
+
+       g_object_set (G_OBJECT (f),
+                     "form-widget", fwidget,
+                     NULL);
+
+       return f;
+}
+
+/**
+ * form_field_get_field_name:
+ * @field:
+ *
+ */
+const gchar
+*form_field_get_field_name (FormField *field)
+{
+       FormFieldPrivate *priv = FORM_FIELD_GET_PRIVATE (field);
+
+       return (const gchar *)g_strdup (priv->field);
+}
+
+/**
+ * form_field_get_value_stringify:
+ * @field:
+ *
+ */
+const gchar
+*form_field_get_value_stringify (FormField *field)
+{
+       FORM_FIELD_GET_CLASS (field)->get_value_stringify (field);
+}
+
+/**
+ * form_field_get_value:
+ * @field:
+ *
+ */
+const GValue
+*form_field_get_value (FormField *field)
+{
+       FORM_FIELD_GET_CLASS (field)->get_value (field);
+}
+
+/**
+ * form_field_get_value_sql:
+ * @field:
+ *
+ */
+const gchar
+*form_field_get_value_sql (FormField *field)
+{
+       FORM_FIELD_GET_CLASS (field)->get_value_sql (field);
+}
+
+/**
+ * form_field_clear:
+ * @field:
+ *
+ */
+gboolean
+form_field_clear (FormField *field)
+{
+       FORM_FIELD_GET_CLASS (field)->clear (field);
+}
+
+/**
+ * form_field_is_empty:
+ * @field:
+ *
+ */
+gboolean
+form_field_is_empty (FormField *field)
+{
+       FORM_FIELD_GET_CLASS (field)->is_empty (field);
+}
+
+/**
+ * form_field_set_from_datamodel:
+ * @field:
+ * @dm:
+ * @row:
+ *
+ */
+gboolean
+form_field_set_from_datamodel (FormField *field, GdaDataModel *dm, gint row)
+{
+       FormFieldPrivate *priv = FORM_FIELD_GET_PRIVATE (field);
+
+       if (priv->field != NULL && strcmp (priv->field, "") != 0)
+               {
+                       FORM_FIELD_GET_CLASS (field)->set_from_datamodel (field, dm, row);
+               }
+}
+
+/* PRIVATE */
+static void
+form_field_set_property (GObject *object,
+                         guint property_id,
+                         const GValue *value,
+                         GParamSpec *pspec)
+{
+       FormField *field = (FormField *)object;
+
+       FormFieldPrivate *priv = FORM_FIELD_GET_PRIVATE (field);
+
+       switch (property_id)
+               {
+                       case PROP_FIELD:
+                               priv->field = g_strstrip (g_value_dup_string (value));
+                               break;
+
+                       case PROP_OBLIGATORY:
+                               priv->obligatory = g_value_get_boolean (value);
+                               break;
+
+                       case PROP_DATAMODEL:
+                               priv->dm = g_value_get_pointer (value);
+                               break;
+
+                       case PROP_WIDGET:
+                               priv->widget = g_value_get_object (value);
+                               break;
+
+                       default:
+                               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+                               break;
+         }
+}
+
+static void
+form_field_get_property (GObject *object,
+                         guint property_id,
+                         GValue *value,
+                         GParamSpec *pspec)
+{
+       FormField *field = (FormField *)object;
+
+       FormFieldPrivate *priv = FORM_FIELD_GET_PRIVATE (field);
+
+       switch (property_id)
+               {
+                       case PROP_FIELD:
+                               g_value_set_string (value, form_field_get_field_name (field));
+                               break;
+
+                       case PROP_OBLIGATORY:
+                               g_value_set_boolean (value, priv->obligatory);
+                               break;
+
+                       case PROP_DATAMODEL:
+                               g_value_set_pointer (value, priv->dm);
+                               break;
+
+                       case PROP_WIDGET:
+                               g_value_set_object (value, priv->widget);
+                               break;
+
+                       default:
+                               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+                               break;
+         }
+}
diff --git a/src/fieldboolean.c b/src/fieldboolean.c
new file mode 100644 (file)
index 0000000..758b3be
--- /dev/null
@@ -0,0 +1,329 @@
+/*
+ * Copyright (C) 2005-2006 Andrea Zagli <azagli@inwind.it>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <string.h>
+
+#include <gtk/gtk.h>
+
+#include "libformwidget.h"
+#include "libformfieldboolean.h"
+
+enum
+{
+       PROP_0,
+       PROP_DEFAULT
+};
+
+static void form_field_boolean_class_init (FormFieldBooleanClass *klass);
+static void form_field_boolean_init (FormFieldBoolean *form_field);
+
+static void form_field_boolean_set_property (GObject *object,
+                                             guint property_id,
+                                             const GValue *value,
+                                             GParamSpec *pspec);
+static void form_field_boolean_get_property (GObject *object,
+                                             guint property_id,
+                                             GValue *value,
+                                             GParamSpec *pspec);
+
+static gboolean form_field_boolean_set_value_stringify (FormField *field, const gchar *value);
+
+static gboolean check_value (const gchar *value);
+
+#define FORM_FIELD_BOOLEAN_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_FORM_FIELD_BOOLEAN, FormFieldBooleanPrivate))
+
+typedef struct _FormFieldBooleanPrivate FormFieldBooleanPrivate;
+struct _FormFieldBooleanPrivate
+       {
+               gboolean default_value;
+       };
+
+
+GType
+form_field_boolean_get_type (void)
+{
+       static GType form_field_boolean_type = 0;
+
+       if (!form_field_boolean_type)
+               {
+                       static const GTypeInfo form_field_boolean_info =
+                       {
+                               sizeof (FormFieldBooleanClass),
+                               NULL,           /* base_init */
+                               NULL,           /* base_finalize */
+                               (GClassInitFunc) form_field_boolean_class_init,
+                               NULL,           /* class_finalize */
+                               NULL,           /* class_data */
+                               sizeof (FormFieldBoolean),
+                               0,              /* n_preallocs */
+                               (GInstanceInitFunc) form_field_boolean_init,
+                               NULL
+                       };
+
+                       form_field_boolean_type = g_type_register_static (TYPE_FORM_FIELD, "FormFieldBoolean",
+                                                                         &form_field_boolean_info, 0);
+    }
+
+       return form_field_boolean_type;
+}
+
+static void
+form_field_boolean_class_init (FormFieldBooleanClass *klass)
+{
+       GObjectClass *object_class = G_OBJECT_CLASS (klass);
+       FormFieldClass *field_class = FORM_FIELD_CLASS (klass);
+
+       object_class->set_property = form_field_boolean_set_property;
+       object_class->get_property = form_field_boolean_get_property;
+
+       field_class->get_value_stringify = form_field_boolean_get_value_stringify;
+       field_class->get_value = form_field_boolean_get_value;
+       field_class->get_value_sql = form_field_boolean_get_value_sql;
+       field_class->clear = form_field_boolean_clear;
+       field_class->is_empty = form_field_boolean_is_empty;
+       field_class->set_from_datamodel = form_field_boolean_set_from_datamodel;
+
+       g_object_class_install_property (object_class, PROP_DEFAULT,
+                                        g_param_spec_boolean ("default",
+                                                              "Default",
+                                                              "Default value",
+                                                              FALSE,
+                                                              G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+
+       g_type_class_add_private (object_class, sizeof (FormFieldBooleanPrivate));
+}
+
+static void
+form_field_boolean_init (FormFieldBoolean *form_field)
+{
+}
+
+/**
+ * form_field_boolean_new:
+ *
+ * Returns: the newly created #FormFieldBoolean.
+ */
+FormField
+*form_field_boolean_new ()
+{
+       return g_object_new (TYPE_FORM_FIELD_BOOLEAN, NULL);
+}
+
+/**
+ * form_field_boolean_get_value_stringify:
+ * @field:
+ *
+ */
+const gchar
+*form_field_boolean_get_value_stringify (FormField *field)
+{
+       const gchar *ret = NULL;
+
+       FormWidget *fw;
+               
+       g_object_get (field,
+                     "form-widget", &fw,
+                     NULL);
+
+       ret = form_widget_get_value_stringify (fw);
+
+       return ret;
+}
+
+/**
+ * form_field_boolean_get_value:
+ * @field:
+ *
+ */
+const GValue
+*form_field_boolean_get_value (FormField *field)
+{
+       GValue *ret = g_malloc0 (sizeof (GValue));
+
+       const gchar *value = form_field_boolean_get_value_stringify (field);
+
+       g_value_init (ret, G_TYPE_BOOLEAN);
+       g_value_set_boolean (ret, strtol (value, NULL, 10));
+
+       return (const GValue *)ret;
+}
+
+/**
+ * form_field_boolean_get_value_sql:
+ * @field:
+ *
+ */
+const gchar
+*form_field_boolean_get_value_sql (FormField *field)
+{
+       const gchar *ret = NULL;
+       const gchar *value = form_field_boolean_get_value_stringify (field);
+
+       if (value != NULL)
+               {
+                       gboolean bool_value;
+
+                       bool_value = check_value (value);
+
+                       ret = g_strconcat ("'", (bool_value ? "t" : "f"), "'", NULL);
+               }
+
+       return ret;
+}
+
+/**
+ * form_field_boolean_clear:
+ * @field:
+ *
+ */
+gboolean
+form_field_boolean_clear (FormField *field)
+{
+       gboolean ret = FALSE;
+
+       FormFieldBooleanPrivate *priv = FORM_FIELD_BOOLEAN_GET_PRIVATE (field);
+
+       ret = form_field_boolean_set_value_stringify (field, g_strdup_printf ("%d", priv->default_value));
+
+       return ret;
+}
+
+/**
+ * form_field_boolean_is_empty:
+ * @field:
+ *
+ */
+gboolean
+form_field_boolean_is_empty (FormField *field)
+{
+       gboolean ret = TRUE;
+
+       return ret;
+}
+
+/**
+ * form_field_boolean_set_from_datamodel:
+ * @field:
+ * @dm:
+ * @row:
+ *
+ */
+gboolean
+form_field_boolean_set_from_datamodel (FormField *field, GdaDataModel *dm, gint row)
+{
+       gboolean ret = FALSE;
+       const gchar *field_name = form_field_get_field_name (field);
+
+       if (dm != NULL)
+               {
+                       gchar *value;
+
+                       value = g_strdup_printf ("%d", gdao_data_model_get_field_value_boolean_at (dm, row, field_name));               
+                       ret = form_field_boolean_set_value_stringify (field, value);
+               }
+
+       return ret;
+}
+
+/* PRIVATE */
+static void
+form_field_boolean_set_property (GObject *object,
+                                 guint property_id,
+                                 const GValue *value,
+                                 GParamSpec *pspec)
+{
+       FormFieldBoolean *field = (FormFieldBoolean *)object;
+
+       FormFieldBooleanPrivate *priv = FORM_FIELD_BOOLEAN_GET_PRIVATE (field);
+
+       switch (property_id)
+               {
+                       case PROP_DEFAULT:
+                               priv->default_value = g_value_get_boolean (value);
+                               break;
+
+                       default:
+                               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+                               break;
+         }
+}
+
+static void
+form_field_boolean_get_property (GObject *object,
+                                 guint property_id,
+                                 GValue *value,
+                                 GParamSpec *pspec)
+{
+       FormFieldBoolean *field = (FormFieldBoolean *)object;
+
+       FormFieldBooleanPrivate *priv = FORM_FIELD_BOOLEAN_GET_PRIVATE (field);
+
+       switch (property_id)
+               {
+                       case PROP_DEFAULT:
+                               g_value_set_boolean (value, priv->default_value);
+                               break;
+
+                       default:
+                               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+                               break;
+         }
+}
+
+static gboolean
+form_field_boolean_set_value_stringify (FormField *field, const gchar *value)
+{
+       gboolean ret = FALSE;
+       FormWidget *fw;
+
+       g_object_get (field,
+                     "form-widget", &fw,
+                     NULL);
+
+       ret = form_widget_set_value_stringify (fw, value);
+
+       return ret;
+}
+
+static gboolean
+check_value (const gchar *value)
+{
+       gchar *str_value;
+       gboolean bool_value = FALSE;
+
+       str_value = g_strstrip (g_strdup (value));
+
+       if (strcmp (str_value, "0") == 0
+                       || strcasecmp (str_value, "f") == 0
+                       || strcasecmp (str_value, "false") == 0
+                       || strcasecmp (str_value, "n") == 0
+                       || strcasecmp (str_value, "no") == 0)
+               {
+                       bool_value = FALSE;
+               }
+       else if (strcmp (str_value, "1") == 0
+                       || strcasecmp (str_value, "t") == 0
+                       || strcasecmp (str_value, "true") == 0
+                       || strcasecmp (str_value, "y") == 0
+                       || strcasecmp (str_value, "yes") == 0)
+               {
+                       bool_value = TRUE;
+               }
+
+       return bool_value;
+}
diff --git a/src/fielddatetime.c b/src/fielddatetime.c
new file mode 100644 (file)
index 0000000..68f6648
--- /dev/null
@@ -0,0 +1,319 @@
+/*
+ * Copyright (C) 2005-2006 Andrea Zagli <azagli@inwind.it>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <string.h>
+#include <time.h>
+
+#include <gtk/gtk.h>
+
+#include "libformwidget.h"
+#include "libformfielddatetime.h"
+
+enum
+{
+       PROP_0,
+       PROP_DEFAULT
+};
+
+static void form_field_datetime_class_init (FormFieldDateTimeClass *klass);
+static void form_field_datetime_init (FormFieldDateTime *form_field);
+
+static void form_field_datetime_set_property (GObject *object,
+                                              guint property_id,
+                                              const GValue *value,
+                                              GParamSpec *pspec);
+static void form_field_datetime_get_property (GObject *object,
+                                              guint property_id,
+                                              GValue *value,
+                                              GParamSpec *pspec);
+
+static gboolean form_field_datetime_set_value_stringify (FormField *field, const gchar *value);
+
+#define FORM_FIELD_DATETIME_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_FORM_FIELD_DATETIME, FormFieldDateTimePrivate))
+
+typedef struct _FormFieldDateTimePrivate FormFieldDateTimePrivate;
+struct _FormFieldDateTimePrivate
+       {
+               struct tm *default_value;
+       };
+
+
+GType
+form_field_datetime_get_type (void)
+{
+       static GType form_field_datetime_type = 0;
+
+       if (!form_field_datetime_type)
+               {
+                       static const GTypeInfo form_field_datetime_info =
+                       {
+                               sizeof (FormFieldDateTimeClass),
+                               NULL,           /* base_init */
+                               NULL,           /* base_finalize */
+                               (GClassInitFunc) form_field_datetime_class_init,
+                               NULL,           /* class_finalize */
+                               NULL,           /* class_data */
+                               sizeof (FormFieldDateTime),
+                               0,              /* n_preallocs */
+                               (GInstanceInitFunc) form_field_datetime_init,
+                               NULL
+                       };
+
+                       form_field_datetime_type = g_type_register_static (TYPE_FORM_FIELD, "FormFieldDateTime",
+                                                                         &form_field_datetime_info, 0);
+    }
+
+       return form_field_datetime_type;
+}
+
+static void
+form_field_datetime_class_init (FormFieldDateTimeClass *klass)
+{
+       GObjectClass *object_class = G_OBJECT_CLASS (klass);
+       FormFieldClass *field_class = FORM_FIELD_CLASS (klass);
+
+       object_class->set_property = form_field_datetime_set_property;
+       object_class->get_property = form_field_datetime_get_property;
+
+       field_class->get_value_stringify = form_field_datetime_get_value_stringify;
+       field_class->get_value = form_field_datetime_get_value;
+       field_class->get_value_sql = form_field_datetime_get_value_sql;
+       field_class->clear = form_field_datetime_clear;
+       field_class->is_empty = form_field_datetime_is_empty;
+       field_class->set_from_datamodel = form_field_datetime_set_from_datamodel;
+
+       g_object_class_install_property (object_class, PROP_DEFAULT,
+                                        g_param_spec_pointer ("default",
+                                                              "Default",
+                                                              "Default value",
+                                                              G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+
+       g_type_class_add_private (object_class, sizeof (FormFieldDateTimePrivate));
+}
+
+static void
+form_field_datetime_init (FormFieldDateTime *form_field)
+{
+}
+
+/**
+ * form_field_datetime_new:
+ *
+ * Returns: the newly created #FormFieldDateTime.
+ */
+FormField
+*form_field_datetime_new ()
+{
+       return g_object_new (TYPE_FORM_FIELD_DATETIME, NULL);
+}
+
+/**
+ * form_field_datetime_get_value_stringify:
+ * @field:
+ *
+ */
+const gchar
+*form_field_datetime_get_value_stringify (FormField *field)
+{
+       const gchar *ret = NULL;
+
+       FormWidget *fw;
+
+       g_object_get (field,
+                     "form-widget", &fw,
+                     NULL);
+
+       ret = form_widget_get_value_stringify (fw);
+
+       return ret;
+}
+
+/**
+ * form_field_datetime_get_value:
+ * @field:
+ *
+ */
+const GValue
+*form_field_datetime_get_value (FormField *field)
+{
+       struct tm datetime;
+       GValue *ret = g_malloc0 (sizeof (GValue));
+
+       const gchar *value = form_field_datetime_get_value_stringify (field);
+
+       if (strptime (value, "%F %T", &datetime) != NULL)
+               {
+                       g_value_init (ret, G_TYPE_POINTER);
+                       g_value_set_pointer (ret, &datetime);
+               }
+
+       return (const GValue *)ret;
+}
+
+/**
+ * form_field_datetime_get_value_sql:
+ * @field:
+ *
+ */
+const gchar
+*form_field_datetime_get_value_sql (FormField *field)
+{
+       const gchar *ret = NULL;
+       const gchar *value = form_field_datetime_get_value_stringify (field);
+
+       if (value != NULL)
+               {
+                       struct tm datetime;
+
+                       if (strptime (value, "%F %T", &datetime) != NULL)
+                               {
+                                       char *buf;
+
+                                       buf = malloc (100);
+
+                                       if (strftime (buf, 100, "%F %T", &datetime) != 0)
+                                               {
+                                                       ret = g_strconcat ("'", buf, "'", NULL);
+                                               }
+                               }
+               }
+
+       return ret;
+}
+
+/**
+ * form_field_datetime_clear:
+ * @field:
+ *
+ */
+gboolean
+form_field_datetime_clear (FormField *field)
+{
+       gboolean ret = FALSE;
+
+       FormFieldDateTimePrivate *priv = FORM_FIELD_DATETIME_GET_PRIVATE (field);
+
+       if (priv->default_value != NULL)
+               {
+                       char *buf;
+
+                       buf = malloc (100);
+
+                       if (strftime (buf, 100, "%F %T", priv->default_value) != NULL)
+                               {
+                                       ret = form_field_datetime_set_value_stringify (field, buf);
+                               }
+               }
+
+       return ret;
+}
+
+/**
+ * form_field_datetime_is_empty:
+ * @field:
+ *
+ */
+gboolean
+form_field_datetime_is_empty (FormField *field)
+{
+       gboolean ret = TRUE;
+
+       return ret;
+}
+
+/**
+ * form_field_datetime_set_from_datamodel:
+ * @field:
+ * @dm:
+ * @row:
+ *
+ */
+gboolean
+form_field_datetime_set_from_datamodel (FormField *field, GdaDataModel *dm, gint row)
+{
+       gboolean ret = FALSE;
+       const gchar *field_name = form_field_get_field_name (field);
+
+       if (dm != NULL)
+               {
+                       ret = form_field_datetime_set_value_stringify (field,
+                                                                                  gdao_data_model_get_field_value_stringify_at (dm, row, field_name));
+               }
+
+       return ret;
+}
+
+/* PRIVATE */
+static void
+form_field_datetime_set_property (GObject *object,
+                                  guint property_id,
+                                  const GValue *value,
+                                  GParamSpec *pspec)
+{
+       FormFieldDateTime *field = (FormFieldDateTime *)object;
+
+       FormFieldDateTimePrivate *priv = FORM_FIELD_DATETIME_GET_PRIVATE (field);
+
+       switch (property_id)
+               {
+                       case PROP_DEFAULT:
+                               priv->default_value = g_value_get_pointer (value);
+                               break;
+
+                       default:
+                               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+                               break;
+         }
+}
+
+static void
+form_field_datetime_get_property (GObject *object,
+                                  guint property_id,
+                                  GValue *value,
+                                  GParamSpec *pspec)
+{
+       FormFieldDateTime *field = (FormFieldDateTime *)object;
+
+       FormFieldDateTimePrivate *priv = FORM_FIELD_DATETIME_GET_PRIVATE (field);
+
+       switch (property_id)
+               {
+                       case PROP_DEFAULT:
+                               g_value_set_pointer (value, priv->default_value);
+                               break;
+
+                       default:
+                               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+                               break;
+         }
+}
+
+static gboolean
+form_field_datetime_set_value_stringify (FormField *field, const gchar *value)
+{
+       gboolean ret = FALSE;
+       FormWidget *fw;
+
+       g_object_get (field,
+                     "form-widget", &fw,
+                     NULL);
+
+       ret = form_widget_set_value_stringify (fw, value);
+
+       return ret;
+}
diff --git a/src/fieldfloat.c b/src/fieldfloat.c
new file mode 100644 (file)
index 0000000..f4f77fc
--- /dev/null
@@ -0,0 +1,310 @@
+/*
+ * Copyright (C) 2005-2006 Andrea Zagli <azagli@inwind.it>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <locale.h>
+
+#include <gtk/gtk.h>
+
+#include <libgdaobj.h>
+
+#include "libformwidget.h"
+#include "libformfieldfloat.h"
+
+enum
+{
+       PROP_0,
+       PROP_DEFAULT
+};
+
+static void form_field_float_class_init (FormFieldFloatClass *klass);
+static void form_field_float_init (FormFieldFloat *form_field);
+
+static void form_field_float_set_property (GObject *object,
+                                           guint property_id,
+                                           const GValue *value,
+                                           GParamSpec *pspec);
+static void form_field_float_get_property (GObject *object,
+                                           guint property_id,
+                                           GValue *value,
+                                           GParamSpec *pspec);
+
+static gboolean form_field_float_set_value_stringify (FormField *field, const gchar *value);
+
+#define FORM_FIELD_FLOAT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_FORM_FIELD_FLOAT, FormFieldFloatPrivate))
+
+typedef struct _FormFieldFloatPrivate FormFieldFloatPrivate;
+struct _FormFieldFloatPrivate
+       {
+               gfloat default_value;
+       };
+
+
+GType
+form_field_float_get_type (void)
+{
+       static GType form_field_float_type = 0;
+
+       if (!form_field_float_type)
+               {
+                       static const GTypeInfo form_field_float_info =
+                       {
+                               sizeof (FormFieldFloatClass),
+                               NULL,           /* base_init */
+                               NULL,           /* base_finalize */
+                               (GClassInitFunc) form_field_float_class_init,
+                               NULL,           /* class_finalize */
+                               NULL,           /* class_data */
+                               sizeof (FormFieldFloat),
+                               0,              /* n_preallocs */
+                               (GInstanceInitFunc) form_field_float_init,
+                               NULL
+                       };
+
+                       form_field_float_type = g_type_register_static (TYPE_FORM_FIELD, "FormFieldFloat",
+                                                                       &form_field_float_info, 0);
+    }
+
+       return form_field_float_type;
+}
+
+static void
+form_field_float_class_init (FormFieldFloatClass *klass)
+{
+       GObjectClass *object_class = G_OBJECT_CLASS (klass);
+       FormFieldClass *field_class = FORM_FIELD_CLASS (klass);
+
+       object_class->set_property = form_field_float_set_property;
+       object_class->get_property = form_field_float_get_property;
+
+       field_class->get_value_stringify = form_field_float_get_value_stringify;
+       field_class->get_value = form_field_float_get_value;
+       field_class->get_value_sql = form_field_float_get_value_sql;
+       field_class->clear = form_field_float_clear;
+       field_class->is_empty = form_field_float_is_empty;
+       field_class->set_from_datamodel = form_field_float_set_from_datamodel;
+
+       g_object_class_install_property (object_class, PROP_DEFAULT,
+                                        g_param_spec_float ("default",
+                                                            "Default",
+                                                            "Default value",
+                                                            -G_MAXFLOAT, G_MAXFLOAT, 0.0f,
+                                                            G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+
+       g_type_class_add_private (object_class, sizeof (FormFieldFloatPrivate));
+}
+
+static void
+form_field_float_init (FormFieldFloat *form_field)
+{
+}
+
+/**
+ * form_field_float_new:
+ *
+ * Returns: the newly created #FormFieldFloat.
+ */
+FormField
+*form_field_float_new ()
+{
+       return g_object_new (TYPE_FORM_FIELD_FLOAT, NULL);
+}
+
+/**
+ * form_field_float_get_value_stringify:
+ * @field:
+ *
+ */
+const gchar
+*form_field_float_get_value_stringify (FormField *field)
+{
+       const gchar *ret = NULL;
+
+       FormWidget *fw;
+               
+       g_object_get (field,
+                     "form-widget", &fw,
+                     NULL);
+
+       ret = g_strdup_printf ("%f", strtod (form_widget_get_value_stringify (fw), NULL));
+
+       return ret;
+}
+
+/**
+ * form_field_float_get_value:
+ * @field:
+ *
+ */
+const GValue
+*form_field_float_get_value (FormField *field)
+{
+       GValue *ret = g_malloc0 (sizeof (GValue));
+
+       const gchar *value = form_field_float_get_value_stringify (field);
+
+       g_value_init (ret, G_TYPE_FLOAT);
+       g_value_set_float (ret, strtod (value, NULL));
+
+       return (const GValue *)ret;
+}
+
+/**
+ * form_field_float_get_value_sql:
+ * @field:
+ *
+ */
+const gchar
+*form_field_float_get_value_sql (FormField *field)
+{
+       const gchar *ret = NULL;
+       const gchar *value = form_field_float_get_value_stringify (field);
+
+       if (value != NULL)
+               {
+                       char *cur = setlocale (LC_NUMERIC, NULL);
+                       gfloat fval = strtod (value, NULL);
+               
+                       setlocale (LC_NUMERIC, "C");
+
+                       ret = g_strdup_printf ("%f", fval);
+               
+                       setlocale (LC_NUMERIC, cur);
+               }
+
+       return ret;
+}
+
+/**
+ * form_field_float_clear:
+ * @field:
+ *
+ */
+gboolean
+form_field_float_clear (FormField *field)
+{
+       gboolean ret = FALSE;
+
+       FormFieldFloatPrivate *priv = FORM_FIELD_FLOAT_GET_PRIVATE (field);
+
+       ret = form_field_float_set_value_stringify (field, g_strdup_printf ("%f", priv->default_value));
+
+       return ret;
+}
+
+/**
+ * form_field_float_is_empty:
+ * @field:
+ *
+ */
+gboolean
+form_field_float_is_empty (FormField *field)
+{
+       gboolean ret = TRUE;
+       const gchar *value;
+
+       value = form_field_float_get_value_stringify (field);
+
+       if (strtod (value, NULL) == 0.0f)
+               {
+                       ret = FALSE;
+               }
+
+       return ret;
+}
+
+/**
+ * form_field_float_set_from_datamodel:
+ * @field:
+ * @dm:
+ * @row:
+ *
+ */
+gboolean
+form_field_float_set_from_datamodel (FormField *field, GdaDataModel *dm, gint row)
+{
+       gboolean ret = FALSE;
+       const gchar *field_name = form_field_get_field_name (field);
+
+       if (dm != NULL)
+               {
+                       ret = form_field_float_set_value_stringify (field,
+                                                                               gdao_data_model_get_field_value_stringify_at (dm, row, field_name));
+               }
+
+       return ret;
+}
+
+/* PRIVATE */
+static void
+form_field_float_set_property (GObject *object,
+                               guint property_id,
+                               const GValue *value,
+                               GParamSpec *pspec)
+{
+       FormFieldFloat *field = (FormFieldFloat *)object;
+
+       FormFieldFloatPrivate *priv = FORM_FIELD_FLOAT_GET_PRIVATE (field);
+
+       switch (property_id)
+               {
+                       case PROP_DEFAULT:
+                               priv->default_value = g_value_get_float (value);
+                               break;
+
+                       default:
+                               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+                               break;
+         }
+}
+
+static void
+form_field_float_get_property (GObject *object,
+                               guint property_id,
+                               GValue *value,
+                               GParamSpec *pspec)
+{
+       FormFieldFloat *field = (FormFieldFloat *)object;
+
+       FormFieldFloatPrivate *priv = FORM_FIELD_FLOAT_GET_PRIVATE (field);
+
+       switch (property_id)
+               {
+                       case PROP_DEFAULT:
+                               g_value_set_float (value, priv->default_value);
+                               break;
+
+                       default:
+                               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+                               break;
+         }
+}
+
+static gboolean
+form_field_float_set_value_stringify (FormField *field, const gchar *value)
+{
+       gboolean ret = FALSE;
+       FormWidget *fw;
+
+       g_object_get (field,
+                     "form-widget", &fw,
+                     NULL);
+
+       ret = form_widget_set_value_stringify (fw, value);
+
+       return ret;
+}
diff --git a/src/fieldinteger.c b/src/fieldinteger.c
new file mode 100644 (file)
index 0000000..5beaffb
--- /dev/null
@@ -0,0 +1,301 @@
+/*
+ * Copyright (C) 2005-2006 Andrea Zagli <azagli@inwind.it>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <gtk/gtk.h>
+
+#include <libgdaobj.h>
+
+#include "libformwidget.h"
+#include "libformfieldinteger.h"
+
+enum
+{
+       PROP_0,
+       PROP_DEFAULT
+};
+
+static void form_field_integer_class_init (FormFieldIntegerClass *klass);
+static void form_field_integer_init (FormFieldInteger *form_field);
+
+static void form_field_integer_set_property (GObject *object,
+                                             guint property_id,
+                                             const GValue *value,
+                                             GParamSpec *pspec);
+static void form_field_integer_get_property (GObject *object,
+                                             guint property_id,
+                                             GValue *value,
+                                             GParamSpec *pspec);
+
+static gboolean form_field_integer_set_value_stringify (FormField *field, const gchar *value);
+
+#define FORM_FIELD_INTEGER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_FORM_FIELD_INTEGER, FormFieldIntegerPrivate))
+
+typedef struct _FormFieldIntegerPrivate FormFieldIntegerPrivate;
+struct _FormFieldIntegerPrivate
+       {
+               gint default_value;
+       };
+
+
+GType
+form_field_integer_get_type (void)
+{
+       static GType form_field_integer_type = 0;
+
+       if (!form_field_integer_type)
+               {
+                       static const GTypeInfo form_field_integer_info =
+                       {
+                               sizeof (FormFieldIntegerClass),
+                               NULL,           /* base_init */
+                               NULL,           /* base_finalize */
+                               (GClassInitFunc) form_field_integer_class_init,
+                               NULL,           /* class_finalize */
+                               NULL,           /* class_data */
+                               sizeof (FormFieldInteger),
+                               0,              /* n_preallocs */
+                               (GInstanceInitFunc) form_field_integer_init,
+                               NULL
+                       };
+
+                       form_field_integer_type = g_type_register_static (TYPE_FORM_FIELD, "FormFieldInteger",
+                                                                         &form_field_integer_info, 0);
+    }
+
+       return form_field_integer_type;
+}
+
+static void
+form_field_integer_class_init (FormFieldIntegerClass *klass)
+{
+       GObjectClass *object_class = G_OBJECT_CLASS (klass);
+       FormFieldClass *field_class = FORM_FIELD_CLASS (klass);
+
+       object_class->set_property = form_field_integer_set_property;
+       object_class->get_property = form_field_integer_get_property;
+
+       field_class->get_value_stringify = form_field_integer_get_value_stringify;
+       field_class->get_value = form_field_integer_get_value;
+       field_class->get_value_sql = form_field_integer_get_value_sql;
+       field_class->clear = form_field_integer_clear;
+       field_class->is_empty = form_field_integer_is_empty;
+       field_class->set_from_datamodel = form_field_integer_set_from_datamodel;
+
+       g_object_class_install_property (object_class, PROP_DEFAULT,
+                                        g_param_spec_int ("default",
+                                                          "Default",
+                                                          "Default value",
+                                                          G_MININT, G_MAXINT, 0,
+                                                          G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+
+       g_type_class_add_private (object_class, sizeof (FormFieldIntegerPrivate));
+}
+
+static void
+form_field_integer_init (FormFieldInteger *form_field)
+{
+}
+
+/**
+ * form_field_integer_new:
+ *
+ * Returns: the newly created #FormFieldInteger.
+ */
+FormField
+*form_field_integer_new ()
+{
+       return g_object_new (TYPE_FORM_FIELD_INTEGER, NULL);
+}
+
+/**
+ * form_field_integer_get_value_stringify:
+ * @field:
+ *
+ */
+const gchar
+*form_field_integer_get_value_stringify (FormField *field)
+{
+       const gchar *ret = NULL;
+
+       FormWidget *fw;
+               
+       g_object_get (field,
+                     "form-widget", &fw,
+                     NULL);
+
+       ret = g_strdup_printf ("%d", strtol (form_widget_get_value_stringify (fw), NULL, 10));
+
+       return ret;
+}
+
+/**
+ * form_field_integer_get_value:
+ * @field:
+ *
+ */
+const GValue
+*form_field_integer_get_value (FormField *field)
+{
+       GValue *ret = g_malloc0 (sizeof (GValue));
+
+       const gchar *value = form_field_integer_get_value_stringify (field);
+
+       g_value_init (ret, G_TYPE_INT);
+       g_value_set_int (ret, atol (value));
+
+       return (const GValue *)ret;
+}
+
+/**
+ * form_field_integer_get_value_sql:
+ * @field:
+ *
+ */
+const gchar
+*form_field_integer_get_value_sql (FormField *field)
+{
+       const gchar *ret = NULL;
+       const gchar *value = form_field_integer_get_value_stringify (field);
+
+       if (value != NULL)
+               {
+                       ret = value;
+               }
+
+       return ret;
+}
+
+/**
+ * form_field_integer_clear:
+ * @field:
+ *
+ */
+gboolean
+form_field_integer_clear (FormField *field)
+{
+       gboolean ret = FALSE;
+
+       FormFieldIntegerPrivate *priv = FORM_FIELD_INTEGER_GET_PRIVATE (field);
+
+       ret = form_field_integer_set_value_stringify (field, g_strdup_printf ("%d", priv->default_value));
+
+       return ret;
+}
+
+/**
+ * form_field_integer_is_empty:
+ * @field:
+ *
+ */
+gboolean
+form_field_integer_is_empty (FormField *field)
+{
+       gboolean ret = TRUE;
+       const gchar *value;
+
+       value = form_field_integer_get_value_stringify (field);
+
+       if (strtol (value, NULL, 10) == 0)
+               {
+                       ret = FALSE;
+               }
+
+       return ret;
+}
+
+/**
+ * form_field_integer_set_from_datamodel:
+ * @field:
+ * @dm:
+ * @row:
+ *
+ */
+gboolean
+form_field_integer_set_from_datamodel (FormField *field, GdaDataModel *dm, gint row)
+{
+       gboolean ret = FALSE;
+       const gchar *field_name = form_field_get_field_name (field);
+
+       if (dm != NULL)
+               {
+                       ret = form_field_integer_set_value_stringify (field,
+                                                                                 gdao_data_model_get_field_value_stringify_at (dm, row, field_name));
+               }
+
+       return ret;
+}
+
+/* PRIVATE */
+static void
+form_field_integer_set_property (GObject *object,
+                                 guint property_id,
+                                 const GValue *value,
+                                 GParamSpec *pspec)
+{
+       FormFieldInteger *field = (FormFieldInteger *)object;
+
+       FormFieldIntegerPrivate *priv = FORM_FIELD_INTEGER_GET_PRIVATE (field);
+
+       switch (property_id)
+               {
+                       case PROP_DEFAULT:
+                               priv->default_value = g_value_get_int (value);
+                               break;
+
+                       default:
+                               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+                               break;
+         }
+}
+
+static void
+form_field_integer_get_property (GObject *object,
+                                 guint property_id,
+                                 GValue *value,
+                                 GParamSpec *pspec)
+{
+       FormFieldInteger *field = (FormFieldInteger *)object;
+
+       FormFieldIntegerPrivate *priv = FORM_FIELD_INTEGER_GET_PRIVATE (field);
+
+       switch (property_id)
+               {
+                       case PROP_DEFAULT:
+                               g_value_set_int (value, priv->default_value);
+                               break;
+
+                       default:
+                               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+                               break;
+         }
+}
+
+static gboolean
+form_field_integer_set_value_stringify (FormField *field, const gchar *value)
+{
+       gboolean ret = FALSE;
+       FormWidget *fw;
+
+       g_object_get (field,
+                     "form-widget", &fw,
+                     NULL);
+
+       ret = form_widget_set_value_stringify (fw, value);
+
+       return ret;
+}
diff --git a/src/fieldtext.c b/src/fieldtext.c
new file mode 100644 (file)
index 0000000..774e094
--- /dev/null
@@ -0,0 +1,301 @@
+/*
+ * Copyright (C) 2005-2006 Andrea Zagli <azagli@inwind.it>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <gtk/gtk.h>
+
+#include <libgdaobj.h>
+
+#include "libformwidget.h"
+#include "libformfieldtext.h"
+
+enum
+{
+       PROP_0,
+       PROP_DEFAULT
+};
+
+static void form_field_text_class_init (FormFieldTextClass *klass);
+static void form_field_text_init (FormFieldText *form_field);
+
+static void form_field_text_set_property (GObject *object,
+                                          guint property_id,
+                                          const GValue *value,
+                                          GParamSpec *pspec);
+static void form_field_text_get_property (GObject *object,
+                                          guint property_id,
+                                          GValue *value,
+                                          GParamSpec *pspec);
+
+static gboolean form_field_text_set_value_stringify (FormField *field, const gchar *value);
+
+#define FORM_FIELD_TEXT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_FORM_FIELD_TEXT, FormFieldTextPrivate))
+
+typedef struct _FormFieldTextPrivate FormFieldTextPrivate;
+struct _FormFieldTextPrivate
+       {
+               gchar *default_value;
+       };
+
+
+GType
+form_field_text_get_type (void)
+{
+       static GType form_field_text_type = 0;
+
+       if (!form_field_text_type)
+               {
+                       static const GTypeInfo form_field_text_info =
+                       {
+                               sizeof (FormFieldTextClass),
+                               NULL,           /* base_init */
+                               NULL,           /* base_finalize */
+                               (GClassInitFunc) form_field_text_class_init,
+                               NULL,           /* class_finalize */
+                               NULL,           /* class_data */
+                               sizeof (FormFieldText),
+                               0,              /* n_preallocs */
+                               (GInstanceInitFunc) form_field_text_init,
+                               NULL
+                       };
+
+                       form_field_text_type = g_type_register_static (TYPE_FORM_FIELD, "FormFieldText",
+                                                                      &form_field_text_info, 0);
+    }
+
+       return form_field_text_type;
+}
+
+static void
+form_field_text_class_init (FormFieldTextClass *klass)
+{
+       GObjectClass *object_class = G_OBJECT_CLASS (klass);
+       FormFieldClass *field_class = FORM_FIELD_CLASS (klass);
+
+       object_class->set_property = form_field_text_set_property;
+       object_class->get_property = form_field_text_get_property;
+
+       field_class->get_value_stringify = form_field_text_get_value_stringify;
+       field_class->get_value = form_field_text_get_value;
+       field_class->get_value_sql = form_field_text_get_value_sql;
+       field_class->clear = form_field_text_clear;
+       field_class->is_empty = form_field_text_is_empty;
+       field_class->set_from_datamodel = form_field_text_set_from_datamodel;
+
+       g_object_class_install_property (object_class, PROP_DEFAULT,
+                                        g_param_spec_string ("default",
+                                                             "Default",
+                                                             "Default value",
+                                                             "",
+                                                             G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+
+       g_type_class_add_private (object_class, sizeof (FormFieldTextPrivate));
+}
+
+static void
+form_field_text_init (FormFieldText *form_field)
+{
+}
+
+/**
+ * form_field_text_new:
+ *
+ * Returns: the newly created #FormFieldText.
+ */
+FormField
+*form_field_text_new ()
+{
+       return g_object_new (TYPE_FORM_FIELD_TEXT, NULL);
+}
+
+/**
+ * form_field_text_get_value_stringify:
+ * @field:
+ *
+ */
+const gchar
+*form_field_text_get_value_stringify (FormField *field)
+{
+       const gchar *ret = NULL;
+
+       FormWidget *fw;
+               
+       g_object_get (field,
+                     "form-widget", &fw,
+                     NULL);
+
+       ret = form_widget_get_value_stringify (fw);
+
+       return ret;
+}
+
+/**
+ * form_field_text_get_value:
+ * @field:
+ *
+ */
+const GValue
+*form_field_text_get_value (FormField *field)
+{
+       GValue *ret = g_malloc0 (sizeof (GValue));
+
+       const gchar *value = form_field_text_get_value_stringify (field);
+
+       g_value_init (ret, G_TYPE_STRING);
+       g_value_set_string (ret, value);
+
+       return (const GValue *)ret;
+}
+
+/**
+ * form_field_text_get_value_sql:
+ * @field:
+ *
+ */
+const gchar
+*form_field_text_get_value_sql (FormField *field)
+{
+       const gchar *ret = NULL;
+       const gchar *value = form_field_text_get_value_stringify (field);
+
+       if (value != NULL)
+               {
+                       ret = g_strconcat ("'", gdao_strescape (value, NULL), "'", NULL);
+               }
+
+       return ret;
+}
+
+/**
+ * form_field_text_clear:
+ * @field:
+ *
+ */
+gboolean
+form_field_text_clear (FormField *field)
+{
+       gboolean ret = FALSE;
+
+       FormFieldTextPrivate *priv = FORM_FIELD_TEXT_GET_PRIVATE (field);
+
+       ret = form_field_text_set_value_stringify (field, priv->default_value);
+
+       return ret;
+}
+
+/**
+ * form_field_text_is_empty:
+ * @field:
+ *
+ */
+gboolean
+form_field_text_is_empty (FormField *field)
+{
+       gboolean ret = TRUE;
+       const gchar *value;
+
+       value = form_field_text_get_value_stringify (field);
+
+       if (strcmp (value, "") == 0)
+               {
+                       ret = FALSE;
+               }
+
+       return ret;
+}
+
+/**
+ * form_field_text_set_from_datamodel:
+ * @field:
+ * @dm:
+ * @row:
+ *
+ */
+gboolean
+form_field_text_set_from_datamodel (FormField *field, GdaDataModel *dm, gint row)
+{
+       gboolean ret = FALSE;
+       const gchar *field_name = form_field_get_field_name (field);
+
+       if (dm != NULL)
+               {
+                       ret = form_field_text_set_value_stringify (field,
+                                                                              gdao_data_model_get_field_value_stringify_at (dm, row, field_name));
+               }
+
+       return ret;
+}
+
+/* PRIVATE */
+static void
+form_field_text_set_property (GObject *object,
+                              guint property_id,
+                              const GValue *value,
+                              GParamSpec *pspec)
+{
+       FormFieldText *field = (FormFieldText *)object;
+
+       FormFieldTextPrivate *priv = FORM_FIELD_TEXT_GET_PRIVATE (field);
+
+       switch (property_id)
+               {
+                       case PROP_DEFAULT:
+                               priv->default_value = g_strstrip (g_strdup (g_value_get_string (value)));
+                               break;
+
+                       default:
+                               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+                               break;
+         }
+}
+
+static void
+form_field_text_get_property (GObject *object,
+                              guint property_id,
+                              GValue *value,
+                              GParamSpec *pspec)
+{
+       FormFieldText *field = (FormFieldText *)object;
+
+       FormFieldTextPrivate *priv = FORM_FIELD_TEXT_GET_PRIVATE (field);
+
+       switch (property_id)
+               {
+                       case PROP_DEFAULT:
+                               g_value_set_string (value, priv->default_value);
+                               break;
+
+                       default:
+                               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+                               break;
+         }
+}
+
+static gboolean
+form_field_text_set_value_stringify (FormField *field, const gchar *value)
+{
+       gboolean ret = FALSE;
+       FormWidget *fw;
+
+       g_object_get (field,
+                     "form-widget", &fw,
+                     NULL);
+
+       ret = form_widget_set_value_stringify (fw, value);
+
+       return ret;
+}
diff --git a/src/form.c b/src/form.c
new file mode 100644 (file)
index 0000000..bf10e4c
--- /dev/null
@@ -0,0 +1,417 @@
+/*
+ * Copyright (C) 2005-2006 Andrea Zagli <azagli@inwind.it>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+       #include <config.h>
+#endif
+
+#include <string.h>
+
+#include "libform.h"
+
+enum
+{
+       PROP_0,
+       PROP_TABLE,
+       PROP_KEY
+};
+
+static void form_class_init (FormClass *class);
+static void form_init (Form *form);
+
+static void form_set_property (GObject *object,
+                               guint property_id,
+                               const GValue *value,
+                               GParamSpec *pspec);
+static void form_get_property (GObject *object,
+                               guint property_id,
+                               GValue *value,
+                               GParamSpec *pspec);
+
+#define FORM_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_FORM, FormPrivate))
+
+typedef struct _FormPrivate FormPrivate;
+struct _FormPrivate
+       {
+               GList *fields;
+
+               gchar *table;
+               FormKey *key;
+       };
+
+
+GType
+form_get_type (void)
+{
+  static GType form_type = 0;
+
+  if (!form_type)
+    {
+      static const GTypeInfo form_info =
+      {
+        sizeof (FormClass),
+        NULL,          /* base_init */
+        NULL,          /* base_finalize */
+        (GClassInitFunc) form_class_init,
+        NULL,          /* class_finalize */
+        NULL,          /* class_data */
+        sizeof (Form),
+        0,             /* n_preallocs */
+        (GInstanceInitFunc) form_init,
+                               NULL
+      };
+
+      form_type = g_type_register_static (G_TYPE_OBJECT, "Form",
+                                                                 &form_info, 0);
+    }
+
+  return form_type;
+}
+
+static void
+form_class_init (FormClass *class)
+{
+       GObjectClass *object_class = G_OBJECT_CLASS (class);
+
+       object_class->set_property = form_set_property;
+       object_class->get_property = form_get_property;
+
+       g_object_class_install_property (object_class, PROP_TABLE,
+                                        g_param_spec_string ("table",
+                                                             "Table",
+                                                             "Form's table",
+                                                             "",
+                                                             G_PARAM_READWRITE));
+
+       g_object_class_install_property (object_class, PROP_KEY,
+                                        g_param_spec_object ("key",
+                                                             "Key",
+                                                             "Key",
+                                                             TYPE_FORM_KEY,
+                                                             G_PARAM_READWRITE));
+
+       g_type_class_add_private (object_class, sizeof (FormPrivate));
+}
+
+static void
+form_init (Form *form)
+{
+       FormPrivate *priv = FORM_GET_PRIVATE (form);
+
+       priv->fields = NULL;
+}
+
+/**
+ * form_new:
+ *
+ * Returns: the newly created #Form.
+ */
+Form
+*form_new ()
+{
+       return g_object_new (TYPE_FORM, NULL);
+}
+
+/**
+ * form_add_field:
+ * @form:
+ * @field:
+ *
+ */
+gboolean
+form_add_field (Form *form, FormField *field)
+{
+       gboolean ret = FALSE;
+
+       FormPrivate *priv = FORM_GET_PRIVATE (form);
+
+       g_return_val_if_fail (IS_FORM_FIELD (field), FALSE);
+
+       priv->fields = g_list_append (priv->fields, field);
+
+       ret = TRUE;
+
+       return ret;
+}
+
+/**
+ * form_remove_field:
+ * @form:
+ * @field:
+ *
+ */
+gboolean
+form_remove_field (Form *form, FormField *field)
+{
+       gboolean ret = FALSE;
+
+       FormPrivate *priv = FORM_GET_PRIVATE (form);
+
+       g_return_val_if_fail (IS_FORM_FIELD (field), FALSE);
+
+       priv->fields = g_list_remove (priv->fields, field);
+
+       ret = TRUE;
+
+       return ret;
+}
+
+/**
+ * form_clear:
+ * @form:
+ *
+ */
+gboolean
+form_clear (Form *form)
+{
+       FormField *field;
+       gboolean ret = FALSE;
+
+       FormPrivate *priv = FORM_GET_PRIVATE (form);
+
+       GList *fields = g_list_first (priv->fields);
+
+       while (fields != NULL)
+               {
+                       field = (FormField *)fields->data;
+
+                       form_field_clear (field);
+
+                       fields = g_list_next (fields);
+               }
+
+       ret = TRUE;
+
+       return ret;
+}
+
+/**
+ * form_check:
+ * @form:
+ *
+ * Returns: TRUE if all obligatory fields are full.
+ */
+gboolean
+form_check (Form *form)
+{
+       FormField *field;
+       gboolean ret = TRUE;
+       gboolean obl = FALSE;
+
+       FormPrivate *priv = FORM_GET_PRIVATE (form);
+
+       GList *fields = g_list_first (priv->fields);
+
+       while (fields != NULL)
+               {
+                       field = (FormField *)fields->data;
+
+                       g_object_get (G_OBJECT (field),
+                                     "obligatory", &obl,
+                                     NULL);
+
+                       if (obl && !form_field_is_empty (field))
+                               {
+                                       ret = FALSE;
+                                       break;
+                               }
+
+                       fields = g_list_next (fields);
+               }
+
+       if (ret)
+               {
+                       ret = form_key_check (priv->key);
+               }
+
+       return ret;
+}
+
+/**
+ * form_get_sql:
+ * @form:
+ * @type:
+ *
+ */
+gchar
+*form_get_sql (Form *form, FormSqlType type)
+{
+       FormField *field;
+       gchar *sql = "";
+       gchar *fields_names = "";
+       gchar *values = "";
+       const gchar *value;
+       gchar *where = "";
+       const gchar *field_name;
+
+       FormPrivate *priv = FORM_GET_PRIVATE (form);
+
+       GList *fields = g_list_first (priv->fields);
+
+       while (fields != NULL)
+               {
+                       field = (FormField *)fields->data;
+
+                       field_name = form_field_get_field_name (field);
+
+                       if (field_name != NULL && strcmp (field_name, "") != 0)
+                               {
+                                       switch (type)
+                                               {
+                                                       case FORM_SQL_SELECT:
+                                                               fields_names = g_strconcat (fields_names, field_name, ", ", NULL);
+                                                               break;
+
+                                                       case FORM_SQL_INSERT:
+                                                               value = form_field_get_value_sql (field);
+                                                               if (value != NULL)
+                                                                       {
+                                                                               fields_names = g_strconcat (fields_names, field_name, ", ", NULL);
+                                                                               values = g_strconcat (values, value, ", ", NULL);
+                                                                       }
+                                                               break;
+
+                                                       case FORM_SQL_UPDATE:
+                                                               if (!form_key_field_is_key (priv->key, field))
+                                                                       {
+                                                                               value = form_field_get_value_sql (field);
+                                                                               if (value != NULL)
+                                                                                       {
+                                                                                               fields_names = g_strconcat (fields_names, field_name, " = ", value, ", ", NULL);
+                                                                                       }
+                                                                       }
+                                                               break;
+                                               }
+                               }
+
+                       fields = g_list_next (fields);
+               }
+
+       if (g_str_has_suffix (fields_names, ", "))
+               {
+                       fields_names[strlen (fields_names) - 2] = '\0';
+               }
+       if (g_str_has_suffix (values, ", "))
+               {
+                       values[strlen (values) - 2] = '\0';
+               }
+
+       switch (type)
+               {
+                       case FORM_SQL_SELECT:
+                               sql = g_strconcat ("SELECT ", fields_names, " FROM ", priv->table, NULL);
+                               break;
+
+                       case FORM_SQL_INSERT:
+                               sql = g_strconcat ("INSERT INTO ", priv->table, " (", fields_names, ") VALUES (", values, ")", NULL);
+                               break;
+
+                       case FORM_SQL_UPDATE:
+                               sql = g_strconcat ("UPDATE ", priv->table, " SET ", fields_names, NULL);
+                               break;
+
+                       case FORM_SQL_DELETE:
+                               sql = g_strconcat ("DELETE FROM ", priv->table, NULL);
+                               break;
+               }
+
+       where = form_key_get_sql (priv->key);
+       if ((type == FORM_SQL_SELECT || type == FORM_SQL_UPDATE || type == FORM_SQL_DELETE)
+           && where != NULL && strcmp (where, "") != 0)
+               {
+                       sql = g_strconcat (sql, where, NULL);
+               }
+
+       return sql;
+}
+
+gboolean
+form_fill_from_datamodel (Form *form, GdaDataModel *dm, gint row)
+{
+       gboolean ret = TRUE;
+       FormField *field;
+       gchar *field_name;
+
+       FormPrivate *priv = FORM_GET_PRIVATE (form);
+
+       GList *fields = g_list_first (priv->fields);
+
+       while (fields != NULL)
+               {
+                       field = (FormField *)fields->data;
+
+                       form_field_set_from_datamodel (field, dm, row);
+
+                       fields = g_list_next (fields);
+               }
+
+       return ret;
+}
+
+/* PRIVATE */
+static void
+form_set_property (GObject *object,
+                   guint property_id,
+                   const GValue *value,
+                   GParamSpec *pspec)
+{
+       Form *form = (Form *)object;
+
+       FormPrivate *priv = FORM_GET_PRIVATE (form);
+
+       switch (property_id)
+               {
+                       case PROP_TABLE:
+                               priv->table = g_strstrip (g_strdup (g_value_get_string (value)));
+                               break;
+
+                       case PROP_KEY:
+                               priv->key = g_value_get_object (value);
+                               break;
+
+                       default:
+                               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+                               break;
+         }
+}
+
+static void
+form_get_property (GObject *object,
+                   guint property_id,
+                   GValue *value,
+                   GParamSpec *pspec)
+{
+       Form *form = (Form *)object;
+
+       FormPrivate *priv = FORM_GET_PRIVATE (form);
+
+       switch (property_id)
+               {
+                       case PROP_TABLE:
+                               g_value_set_string (value, priv->table);
+                               break;
+
+                       case PROP_KEY:
+                               g_value_set_object (value, priv->key);
+                               break;
+
+                       default:
+                               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+                               break;
+         }
+}
diff --git a/src/formkey.c b/src/formkey.c
new file mode 100644 (file)
index 0000000..8189c1f
--- /dev/null
@@ -0,0 +1,223 @@
+/*
+ * Copyright (C) 2005-2006 Andrea Zagli <azagli@inwind.it>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <string.h>
+
+#include "libformkey.h"
+
+static void form_key_class_init (FormKeyClass *class);
+static void form_key_init (FormKey *form_key);
+
+
+#define FORM_KEY_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_FORM_KEY, FormKeyPrivate))
+
+typedef struct _FormKeyPrivate FormKeyPrivate;
+struct _FormKeyPrivate
+       {
+               GList *fields;
+       };
+
+
+GType
+form_key_get_type (void)
+{
+  static GType form_key_type = 0;
+
+  if (!form_key_type)
+    {
+      static const GTypeInfo form_key_info =
+      {
+        sizeof (FormKeyClass),
+        NULL,          /* base_init */
+        NULL,          /* base_finalize */
+        (GClassInitFunc) form_key_class_init,
+        NULL,          /* class_finalize */
+        NULL,          /* class_data */
+        sizeof (FormKey),
+        0,             /* n_preallocs */
+        (GInstanceInitFunc) form_key_init,
+                               NULL
+      };
+
+      form_key_type = g_type_register_static (G_TYPE_OBJECT, "FormKey",
+                                                                     &form_key_info, 0);
+    }
+
+  return form_key_type;
+}
+
+static void
+form_key_class_init (FormKeyClass *class)
+{
+       GObjectClass *object_class = G_OBJECT_CLASS (class);
+
+       g_type_class_add_private (object_class, sizeof (FormKeyPrivate));
+}
+
+static void
+form_key_init (FormKey *form_key)
+{
+       FormKeyPrivate *priv = FORM_KEY_GET_PRIVATE (form_key);
+
+       priv->fields = NULL;
+}
+
+/**
+ * form_key_new:
+ *
+ * Returns: the newly created #FormKey.
+ */
+FormKey
+*form_key_new ()
+{
+       return g_object_new (TYPE_FORM_KEY, NULL);
+}
+
+/**
+ * form_key_add_field:
+ * @form_key:
+ * @field:
+ *
+ */
+gboolean
+form_key_add_field (FormKey *form_key, FormField *field)
+{
+       gboolean ret = FALSE;
+
+       FormKeyPrivate *priv = FORM_KEY_GET_PRIVATE (form_key);
+
+       g_return_val_if_fail (IS_FORM_FIELD (field), FALSE);
+
+       priv->fields = g_list_append (priv->fields, field);
+
+       ret = TRUE;
+
+       return ret;
+}
+
+/**
+ * form_key_remove_field:
+ * @form_key:
+ * @field:
+ *
+ */
+gboolean
+form_key_remove_field (FormKey *form_key, FormField *field)
+{
+       gboolean ret = FALSE;
+
+       FormKeyPrivate *priv = FORM_KEY_GET_PRIVATE (form_key);
+
+       g_return_val_if_fail (IS_FORM_FIELD (field), FALSE);
+
+       priv->fields = g_list_remove (priv->fields, field);
+
+       ret = TRUE;
+
+       return ret;
+}
+
+/**
+ * form_key_check:
+ * @form_key:
+ *
+ * Returns: TRUE if all obligatory fields are full.
+ */
+gboolean
+form_key_check (FormKey *form_key)
+{
+       FormField *field;
+       gboolean ret = FALSE;
+
+       FormKeyPrivate *priv = FORM_KEY_GET_PRIVATE (form_key);
+
+       GList *fields = g_list_first (priv->fields);
+
+       while (fields != NULL)
+               {
+                       field = (FormField *)fields->data;
+
+                       if (form_field_is_empty (field))
+                               {
+                                       ret = TRUE;
+                                       break;
+                               }
+
+                       fields = g_list_next (fields);
+               }
+
+       return ret;
+}
+
+/**
+ * form_key_get_sql:
+ * @form_key:
+ *
+ */
+gchar
+*form_key_get_sql (FormKey *form_key)
+{
+       FormField *field;
+       gchar *sql = "";
+       gchar *field_name;
+
+       g_return_val_if_fail (IS_FORM_KEY (form_key), NULL);
+
+       FormKeyPrivate *priv = FORM_KEY_GET_PRIVATE (form_key);
+
+       GList *fields = g_list_first (priv->fields);
+
+       while (fields != NULL)
+               {
+                       field = (FormField *)fields->data;
+
+                       g_object_get (G_OBJECT (field),
+                                     "field", &field_name,
+                                     NULL);
+
+                       sql = g_strconcat (sql, " AND ", field_name, " = ",
+                                          form_field_get_value_sql (field), NULL);
+
+                       fields = g_list_next (fields);
+               }
+
+       if (strcmp (sql, "") != 0)
+               {
+                       sql = g_strconcat (" WHERE ", g_strdup (sql + 5), NULL);
+               }
+
+       return sql;
+}
+
+/**
+ * form_key_field_is_key:
+ * @form_key:
+ * @field:
+ *
+ * Returns: TRUE if @field is part of @form_key.
+ */
+gboolean
+form_key_field_is_key (FormKey *form_key, FormField *field)
+{
+       g_return_val_if_fail (IS_FORM_KEY (form_key), FALSE);
+       g_return_val_if_fail (IS_FORM_FIELD (field), FALSE);
+
+       FormKeyPrivate *priv = FORM_KEY_GET_PRIVATE (form_key);
+
+       return (g_list_index (priv->fields, field) >= 0 ? TRUE : FALSE);
+}
diff --git a/src/libform.h b/src/libform.h
new file mode 100644 (file)
index 0000000..9c0f376
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2005-2006 Andrea Zagli <azagli@inwind.it>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LIBFORM_H__
+#define __LIBFORM_H__
+
+#include <glib.h>
+#include <glade/glade.h>
+
+#include <libgdaobj.h>
+
+#include <libformfield.h>
+#include <libformkey.h>
+
+
+G_BEGIN_DECLS
+
+
+#define TYPE_FORM                 (form_get_type ())
+#define FORM(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FORM, Form))
+#define FORM_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FORM, FormClass))
+#define IS_FORM(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FORM))
+#define IS_FORM_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FORM))
+#define FORM_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FORM, FormClass))
+
+
+typedef struct _Form Form;
+typedef struct _FormClass FormClass;
+
+struct _Form
+       {
+               GObject parent;
+       };
+
+struct _FormClass
+       {
+               GObjectClass parent_class;
+       };
+
+GType form_get_type (void) G_GNUC_CONST;
+
+
+Form *form_new (void);
+
+gboolean form_add_field (Form *form, FormField *field);
+gboolean form_remove_field (Form *form, FormField *field);
+
+gboolean form_clear (Form *form);
+
+gboolean form_check (Form *form);
+
+typedef enum
+{
+       FORM_SQL_SELECT,
+       FORM_SQL_INSERT,
+       FORM_SQL_UPDATE,
+       FORM_SQL_DELETE
+} FormSqlType;
+
+gchar *form_get_sql (Form *form, FormSqlType type);
+
+gboolean form_fill_from_datamodel (Form *form, GdaDataModel *dm, gint row);
+
+
+G_END_DECLS
+
+
+#endif /* __LIBFORM_H__ */
diff --git a/src/libformfield.h b/src/libformfield.h
new file mode 100644 (file)
index 0000000..4cc6277
--- /dev/null
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2005-2006 Andrea Zagli <azagli@inwind.it>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LIBFORM_FIELD_H__
+#define __LIBFORM_FIELD_H__
+
+#include <glib.h>
+
+#include <libgdaobj.h>
+
+#include <libformwidget.h>
+
+
+G_BEGIN_DECLS
+
+
+#define TYPE_FORM_FIELD                 (form_field_get_type ())
+#define FORM_FIELD(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FORM_FIELD, FormField))
+#define FORM_FIELD_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FORM_FIELD, FormFieldClass))
+#define IS_FORM_FIELD(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FORM_FIELD))
+#define IS_FORM_FIELD_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FORM_FIELD))
+#define FORM_FIELD_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FORM_FIELD, FormFieldClass))
+
+
+typedef struct _FormField FormField;
+typedef struct _FormFieldClass FormFieldClass;
+
+struct _FormField
+       {
+               GObject parent;
+       };
+
+struct _FormFieldClass
+       {
+               GObjectClass parent_class;
+
+               const gchar *(*get_value_stringify) (FormField *field);
+               const GValue *(*get_value) (FormField *field);
+               const gchar *(*get_value_sql) (FormField *field);
+
+               gboolean (*clear) (FormField *field);
+               gboolean (*is_empty) (FormField *field);
+               gboolean (*set_from_datamodel) (FormField *field, GdaDataModel *dm, gint row);
+       };
+
+GType form_field_get_type (void) G_GNUC_CONST;
+
+FormField *form_field_new (void);
+FormField *form_field_new_from_form_widget (FormWidget *fwidget);
+
+const gchar *form_field_get_field_name (FormField *field);
+
+const gchar *form_field_get_value_stringify (FormField *field);
+const GValue *form_field_get_value (FormField *field);
+const gchar *form_field_get_value_sql (FormField *field);
+
+gboolean form_field_clear (FormField *field);
+
+gboolean form_field_is_empty (FormField *field);
+
+gboolean form_field_set_from_datamodel (FormField *field, GdaDataModel *dm, gint row);
+
+
+G_END_DECLS
+
+
+#endif /* __LIBFORM_FIELD_H__ */
diff --git a/src/libformfieldboolean.h b/src/libformfieldboolean.h
new file mode 100644 (file)
index 0000000..a9371ed
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2005-2006 Andrea Zagli <azagli@inwind.it>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LIBFORM_FIELD_BOOLEAN_H__
+#define __LIBFORM_FIELD_BOOLEAN_H__
+
+#include <libgdaobj.h>
+
+#include <libformfield.h>
+
+
+G_BEGIN_DECLS
+
+
+#define TYPE_FORM_FIELD_BOOLEAN                 (form_field_boolean_get_type ())
+#define FORM_FIELD_BOOLEAN(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FORM_FIELD_BOOLEAN, FormFieldBoolean))
+#define FORM_FIELD_BOOLEAN_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FORM_FIELD_BOOLEAN, FormFieldBooleanClass))
+#define IS_FORM_FIELD_BOOLEAN(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FORM_FIELD_BOOLEAN))
+#define IS_FORM_FIELD_BOOLEAN_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FORM_FIELD_BOOLEAN))
+#define FORM_FIELD_BOOLEAN_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FORM_FIELD_BOOLEAN, FormFieldBooleanClass))
+
+
+typedef struct _FormFieldBoolean FormFieldBoolean;
+typedef struct _FormFieldBooleanClass FormFieldBooleanClass;
+
+struct _FormFieldBoolean
+       {
+               FormField parent;
+       };
+
+struct _FormFieldBooleanClass
+       {
+               FormFieldClass parent_class;
+       };
+
+GType form_field_boolean_get_type (void) G_GNUC_CONST;
+
+FormField *form_field_boolean_new (void);
+
+const gchar *form_field_boolean_get_value_stringify (FormField *field);
+const GValue *form_field_boolean_get_value (FormField *field);
+const gchar *form_field_boolean_get_value_sql (FormField *field);
+
+gboolean form_field_boolean_clear (FormField *field);
+
+gboolean form_field_boolean_is_empty (FormField *field);
+
+gboolean form_field_boolean_set_from_datamodel (FormField *field, GdaDataModel *dm, gint row);
+
+
+G_END_DECLS
+
+
+#endif /* __LIBFORM_FIELD_BOOLEAN_H__ */
diff --git a/src/libformfielddatetime.h b/src/libformfielddatetime.h
new file mode 100644 (file)
index 0000000..8236d6a
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2005-2006 Andrea Zagli <azagli@inwind.it>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LIBFORM_FIELD_DATETIME_H__
+#define __LIBFORM_FIELD_DATETIME_H__
+
+#include <libgdaobj.h>
+
+#include <libformfield.h>
+
+
+G_BEGIN_DECLS
+
+
+#define TYPE_FORM_FIELD_DATETIME                 (form_field_datetime_get_type ())
+#define FORM_FIELD_DATETIME(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FORM_FIELD_DATETIME, FormFieldDateTime))
+#define FORM_FIELD_DATETIME_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FORM_FIELD_DATETIME, FormFieldDateTimeClass))
+#define IS_FORM_FIELD_DATETIME(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FORM_FIELD_DATETIME))
+#define IS_FORM_FIELD_DATETIME_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FORM_FIELD_DATETIME))
+#define FORM_FIELD_DATETIME_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FORM_FIELD_DATETIME, FormFieldDateTimeClass))
+
+
+typedef struct _FormFieldDateTime FormFieldDateTime;
+typedef struct _FormFieldDateTimeClass FormFieldDateTimeClass;
+
+struct _FormFieldDateTime
+       {
+               FormField parent;
+       };
+
+struct _FormFieldDateTimeClass
+       {
+               FormFieldClass parent_class;
+       };
+
+GType form_field_datetime_get_type (void) G_GNUC_CONST;
+
+FormField *form_field_datetime_new (void);
+
+const gchar *form_field_datetime_get_value_stringify (FormField *field);
+const GValue *form_field_datetime_get_value (FormField *field);
+const gchar *form_field_datetime_get_value_sql (FormField *field);
+
+gboolean form_field_datetime_clear (FormField *field);
+
+gboolean form_field_datetime_is_empty (FormField *field);
+
+gboolean form_field_datetime_set_from_datamodel (FormField *field, GdaDataModel *dm, gint row);
+
+
+G_END_DECLS
+
+
+#endif /* __LIBFORM_FIELD_DATETIME_H__ */
diff --git a/src/libformfieldfloat.h b/src/libformfieldfloat.h
new file mode 100644 (file)
index 0000000..1749ed7
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2005-2006 Andrea Zagli <azagli@inwind.it>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LIBFORM_FIELD_FLOAT_H__
+#define __LIBFORM_FIELD_FLOAT_H__
+
+#include <libgdaobj.h>
+
+#include <libformfield.h>
+
+
+G_BEGIN_DECLS
+
+
+#define TYPE_FORM_FIELD_FLOAT                 (form_field_float_get_type ())
+#define FORM_FIELD_FLOAT(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FORM_FIELD_FLOAT, FormFieldFloat))
+#define FORM_FIELD_FLOAT_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FORM_FIELD_FLOAT, FormFieldFloatClass))
+#define IS_FORM_FIELD_FLOAT(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FORM_FIELD_FLOAT))
+#define IS_FORM_FIELD_FLOAT_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FORM_FIELD_FLOAT))
+#define FORM_FIELD_FLOAT_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FORM_FIELD_FLOAT, FormFieldFloatClass))
+
+
+typedef struct _FormFieldFloat FormFieldFloat;
+typedef struct _FormFieldFloatClass FormFieldFloatClass;
+
+struct _FormFieldFloat
+       {
+               FormField parent;
+       };
+
+struct _FormFieldFloatClass
+       {
+               FormFieldClass parent_class;
+       };
+
+GType form_field_float_get_type (void) G_GNUC_CONST;
+
+FormField *form_field_float_new (void);
+
+const gchar *form_field_float_get_value_stringify (FormField *field);
+const GValue *form_field_float_get_value (FormField *field);
+const gchar *form_field_float_get_value_sql (FormField *field);
+
+gboolean form_field_float_clear (FormField *field);
+
+gboolean form_field_float_is_empty (FormField *field);
+
+gboolean form_field_float_set_from_datamodel (FormField *field, GdaDataModel *dm, gint row);
+
+
+G_END_DECLS
+
+
+#endif /* __LIBFORM_FIELD_FLOAT_H__ */
diff --git a/src/libformfieldinteger.h b/src/libformfieldinteger.h
new file mode 100644 (file)
index 0000000..c4ee43b
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2005-2006 Andrea Zagli <azagli@inwind.it>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LIBFORM_FIELD_INTEGER_H__
+#define __LIBFORM_FIELD_INTEGER_H__
+
+#include <libgdaobj.h>
+
+#include <libformfield.h>
+
+
+G_BEGIN_DECLS
+
+
+#define TYPE_FORM_FIELD_INTEGER                 (form_field_integer_get_type ())
+#define FORM_FIELD_INTEGER(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FORM_FIELD_INTEGER, FormFieldInteger))
+#define FORM_FIELD_INTEGER_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FORM_FIELD_INTEGER, FormFieldIntegerClass))
+#define IS_FORM_FIELD_INTEGER(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FORM_FIELD_INTEGER))
+#define IS_FORM_FIELD_INTEGER_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FORM_FIELD_INTEGER))
+#define FORM_FIELD_INTEGER_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FORM_FIELD_INTEGER, FormFieldIntegerClass))
+
+
+typedef struct _FormFieldInteger FormFieldInteger;
+typedef struct _FormFieldIntegerClass FormFieldIntegerClass;
+
+struct _FormFieldInteger
+       {
+               FormField parent;
+       };
+
+struct _FormFieldIntegerClass
+       {
+               FormFieldClass parent_class;
+       };
+
+GType form_field_integer_get_type (void) G_GNUC_CONST;
+
+FormField *form_field_integer_new (void);
+
+const gchar *form_field_integer_get_value_stringify (FormField *field);
+const GValue *form_field_integer_get_value (FormField *field);
+const gchar *form_field_integer_get_value_sql (FormField *field);
+
+gboolean form_field_integer_clear (FormField *field);
+
+gboolean form_field_integer_is_empty (FormField *field);
+
+gboolean form_field_integer_set_from_datamodel (FormField *field, GdaDataModel *dm, gint row);
+
+
+G_END_DECLS
+
+
+#endif /* __LIBFORM_FIELD_INTEGER_H__ */
diff --git a/src/libformfieldtext.h b/src/libformfieldtext.h
new file mode 100644 (file)
index 0000000..7f4c26c
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2005-2006 Andrea Zagli <azagli@inwind.it>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LIBFORM_FIELD_TEXT_H__
+#define __LIBFORM_FIELD_TEXT_H__
+
+#include <libgdaobj.h>
+
+#include <libformfield.h>
+
+
+G_BEGIN_DECLS
+
+
+#define TYPE_FORM_FIELD_TEXT                 (form_field_text_get_type ())
+#define FORM_FIELD_TEXT(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FORM_FIELD_TEXT, FormFieldText))
+#define FORM_FIELD_TEXT_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FORM_FIELD_TEXT, FormFieldTextClass))
+#define IS_FORM_FIELD_TEXT(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FORM_FIELD_TEXT))
+#define IS_FORM_FIELD_TEXT_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FORM_FIELD_TEXT))
+#define FORM_FIELD_TEXT_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FORM_FIELD_TEXT, FormFieldTextClass))
+
+
+typedef struct _FormFieldText FormFieldText;
+typedef struct _FormFieldTextClass FormFieldTextClass;
+
+struct _FormFieldText
+       {
+               FormField parent;
+       };
+
+struct _FormFieldTextClass
+       {
+               FormFieldClass parent_class;
+       };
+
+GType form_field_text_get_type (void) G_GNUC_CONST;
+
+FormField *form_field_text_new (void);
+
+const gchar *form_field_text_get_value_stringify (FormField *field);
+const GValue *form_field_text_get_value (FormField *field);
+const gchar *form_field_text_get_value_sql (FormField *field);
+
+gboolean form_field_text_clear (FormField *field);
+
+gboolean form_field_text_is_empty (FormField *field);
+
+gboolean form_field_text_set_from_datamodel (FormField *field, GdaDataModel *dm, gint row);
+
+
+G_END_DECLS
+
+
+#endif /* __LIBFORM_FIELD_TEXT_H__ */
diff --git a/src/libformkey.h b/src/libformkey.h
new file mode 100644 (file)
index 0000000..816dd10
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2005-2006 Andrea Zagli <azagli@inwind.it>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LIBFORM_KEY_H__
+#define __LIBFORM_KEY_H__
+
+#include <glib.h>
+
+#include <libformfield.h>
+
+
+G_BEGIN_DECLS
+
+
+#define TYPE_FORM_KEY                 (form_key_get_type ())
+#define FORM_KEY(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FORM_KEY, FormKey))
+#define FORM_KEY_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FORM_KEY, FormKeyClass))
+#define IS_FORM_KEY(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FORM_KEY))
+#define IS_FORM_KEY_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FORM_KEY))
+#define FORM_KEY_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FORM_KEY, FormKeyClass))
+
+
+typedef struct _FormKey FormKey;
+typedef struct _FormKeyClass FormKeyClass;
+
+struct _FormKey
+       {
+               GObject parent;
+       };
+
+struct _FormKeyClass
+       {
+               GObjectClass parent_class;
+       };
+
+GType form_key_get_type (void) G_GNUC_CONST;
+
+
+FormKey *form_key_new (void);
+
+gboolean form_key_add_field (FormKey *form_key, FormField *field);
+gboolean form_key_remove_field (FormKey *form_key, FormField *field);
+
+gboolean form_key_check (FormKey *form_key);
+
+gchar *form_key_get_sql (FormKey *form_key);
+
+gboolean form_key_field_is_key (FormKey *form_key, FormField *field);
+
+
+G_END_DECLS
+
+
+#endif /* __LIBFORM_KEY_H__ */
diff --git a/src/libformwidget.h b/src/libformwidget.h
new file mode 100644 (file)
index 0000000..e715189
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2005-2006 Andrea Zagli <azagli@inwind.it>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LIBFORM_WIDGET_H__
+#define __LIBFORM_WIDGET_H__
+
+#include <glib.h>
+#include <gtk/gtk.h>
+#include <glade/glade.h>
+
+
+G_BEGIN_DECLS
+
+
+#define TYPE_FORM_WIDGET                 (form_widget_get_type ())
+#define FORM_WIDGET(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FORM_WIDGET, FormWidget))
+#define FORM_WIDGET_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FORM_WIDGET, FormWidgetClass))
+#define IS_FORM_WIDGET(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FORM_WIDGET))
+#define IS_FORM_WIDGET_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FORM_WIDGET))
+#define FORM_WIDGET_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FORM_WIDGET, FormWidgetClass))
+
+
+typedef struct _FormWidget FormWidget;
+typedef struct _FormWidgetClass FormWidgetClass;
+
+struct _FormWidget
+       {
+               GObject parent;
+       };
+
+struct _FormWidgetClass
+       {
+               GObjectClass parent_class;
+
+               const gchar *(*get_value_stringify) (FormWidget *fwidget);
+
+               gboolean (*set_value_stringify) (FormWidget *fwidget, const gchar *value);
+       };
+
+GType form_widget_get_type (void) G_GNUC_CONST;
+
+FormWidget *form_widget_new (void);
+
+gboolean form_widget_set_from_glade (FormWidget *fwidget, GladeXML *glade, const gchar *widget_name);
+
+GtkWidget *form_widget_get_widget (FormWidget *fwidget);
+
+const gchar *form_widget_get_value_stringify (FormWidget *fwidget);
+
+gboolean form_widget_set_value_stringify (FormWidget *fwidget, const gchar *value);
+
+
+G_END_DECLS
+
+
+#endif /* __LIBFORM_WIDGET_H__ */
diff --git a/src/libformwidgetcheck.h b/src/libformwidgetcheck.h
new file mode 100644 (file)
index 0000000..d0ccb0d
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2005-2006 Andrea Zagli <azagli@inwind.it>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LIBFORM_WIDGET_CHECK_H__
+#define __LIBFORM_WIDGET_CHECK_H__
+
+#include <libformwidget.h>
+
+
+G_BEGIN_DECLS
+
+
+#define TYPE_FORM_WIDGET_CHECK                 (form_widget_check_get_type ())
+#define FORM_WIDGET_CHECK(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FORM_WIDGET_CHECK, FormWidgetCheck))
+#define FORM_WIDGET_CHECK_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FORM_WIDGET_CHECK, FormWidgetCheckClass))
+#define IS_FORM_WIDGET_CHECK(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FORM_WIDGET_CHECK))
+#define IS_FORM_WIDGET_CHECK_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FORM_WIDGET_CHECK))
+#define FORM_WIDGET_CHECK_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FORM_WIDGET_CHECK, FormWidgetCheckClass))
+
+
+typedef struct _FormWidgetCheck FormWidgetCheck;
+typedef struct _FormWidgetCheckClass FormWidgetCheckClass;
+
+struct _FormWidgetCheck
+       {
+               FormWidget parent;
+       };
+
+struct _FormWidgetCheckClass
+       {
+               FormWidgetClass parent_class;
+       };
+
+GType form_widget_check_get_type (void) G_GNUC_CONST;
+
+FormWidget *form_widget_check_new (void);
+
+const gchar *form_widget_check_get_value_stringify (FormWidget *widget);
+
+gboolean form_widget_check_set_value_stringify (FormWidget *fwidget, const gchar *value);
+
+
+G_END_DECLS
+
+
+#endif /* __LIBFORM_WIDGET_CHECK_H__ */
diff --git a/src/libformwidgetentry.h b/src/libformwidgetentry.h
new file mode 100644 (file)
index 0000000..11d1de3
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2005-2006 Andrea Zagli <azagli@inwind.it>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LIBFORM_WIDGET_ENTRY_H__
+#define __LIBFORM_WIDGET_ENTRY_H__
+
+#include <libformwidget.h>
+
+
+G_BEGIN_DECLS
+
+
+#define TYPE_FORM_WIDGET_ENTRY                 (form_widget_entry_get_type ())
+#define FORM_WIDGET_ENTRY(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FORM_WIDGET_ENTRY, FormWidgetEntry))
+#define FORM_WIDGET_ENTRY_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FORM_WIDGET_ENTRY, FormWidgetEntryClass))
+#define IS_FORM_WIDGET_ENTRY(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FORM_WIDGET_ENTRY))
+#define IS_FORM_WIDGET_ENTRY_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FORM_WIDGET_ENTRY))
+#define FORM_WIDGET_ENTRY_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FORM_WIDGET_ENTRY, FormWidgetEntryClass))
+
+
+typedef struct _FormWidgetEntry FormWidgetEntry;
+typedef struct _FormWidgetEntryClass FormWidgetEntryClass;
+
+struct _FormWidgetEntry
+       {
+               FormWidget parent;
+       };
+
+struct _FormWidgetEntryClass
+       {
+               FormWidgetClass parent_class;
+       };
+
+GType form_widget_entry_get_type (void) G_GNUC_CONST;
+
+FormWidget *form_widget_entry_new (void);
+
+const gchar *form_widget_entry_get_value_stringify (FormWidget *widget);
+
+gboolean form_widget_entry_set_value_stringify (FormWidget *fwidget, const gchar *value);
+
+
+G_END_DECLS
+
+
+#endif /* __LIBFORM_WIDGET_ENTRY_H__ */
diff --git a/src/libformwidgetlabel.h b/src/libformwidgetlabel.h
new file mode 100644 (file)
index 0000000..0ffab9a
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2005-2006 Andrea Zagli <azagli@inwind.it>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LIBFORM_WIDGET_LABEL_H__
+#define __LIBFORM_WIDGET_LABEL_H__
+
+#include <libformwidget.h>
+
+
+G_BEGIN_DECLS
+
+
+#define TYPE_FORM_WIDGET_LABEL                 (form_widget_label_get_type ())
+#define FORM_WIDGET_LABEL(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FORM_WIDGET_LABEL, FormWidgetLabel))
+#define FORM_WIDGET_LABEL_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FORM_WIDGET_LABEL, FormWidgetLabelClass))
+#define IS_FORM_WIDGET_LABEL(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FORM_WIDGET_LABEL))
+#define IS_FORM_WIDGET_LABEL_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FORM_WIDGET_LABEL))
+#define FORM_WIDGET_LABEL_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FORM_WIDGET_LABEL, FormWidgetLabelClass))
+
+
+typedef struct _FormWidgetLabel FormWidgetLabel;
+typedef struct _FormWidgetLabelClass FormWidgetLabelClass;
+
+struct _FormWidgetLabel
+       {
+               FormWidget parent;
+       };
+
+struct _FormWidgetLabelClass
+       {
+               FormWidgetClass parent_class;
+       };
+
+GType form_widget_label_get_type (void) G_GNUC_CONST;
+
+FormWidget *form_widget_label_new (void);
+
+const gchar *form_widget_label_get_value_stringify (FormWidget *widget);
+
+gboolean form_widget_label_set_value_stringify (FormWidget *fwidget, const gchar *value);
+
+
+G_END_DECLS
+
+
+#endif /* __LIBFORM_WIDGET_LABEL_H__ */
diff --git a/src/libformwidgetspin.h b/src/libformwidgetspin.h
new file mode 100644 (file)
index 0000000..b58450e
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2005-2006 Andrea Zagli <azagli@inwind.it>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LIBFORM_WIDGET_SPIN_H__
+#define __LIBFORM_WIDGET_SPIN_H__
+
+#include <libformwidget.h>
+
+
+G_BEGIN_DECLS
+
+
+#define TYPE_FORM_WIDGET_SPIN                 (form_widget_spin_get_type ())
+#define FORM_WIDGET_SPIN(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FORM_WIDGET_SPIN, FormWidgetSpin))
+#define FORM_WIDGET_SPIN_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FORM_WIDGET_SPIN, FormWidgetSpinClass))
+#define IS_FORM_WIDGET_SPIN(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FORM_WIDGET_SPIN))
+#define IS_FORM_WIDGET_SPIN_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FORM_WIDGET_SPIN))
+#define FORM_WIDGET_SPIN_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FORM_WIDGET_SPIN, FormWidgetSpinClass))
+
+
+typedef struct _FormWidgetSpin FormWidgetSpin;
+typedef struct _FormWidgetSpinClass FormWidgetSpinClass;
+
+struct _FormWidgetSpin
+       {
+               FormWidget parent;
+       };
+
+struct _FormWidgetSpinClass
+       {
+               FormWidgetClass parent_class;
+       };
+
+GType form_widget_spin_get_type (void) G_GNUC_CONST;
+
+FormWidget *form_widget_spin_new (void);
+
+const gchar *form_widget_spin_get_value_stringify (FormWidget *widget);
+
+gboolean form_widget_spin_set_value_stringify (FormWidget *fwidget, const gchar *value);
+
+
+G_END_DECLS
+
+
+#endif /* __LIBFORM_WIDGET_SPIN_H__ */
diff --git a/src/libformwidgettextview.h b/src/libformwidgettextview.h
new file mode 100644 (file)
index 0000000..9f9ffe5
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2005-2006 Andrea Zagli <azagli@inwind.it>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LIBFORM_WIDGET_TEXTVIEW_H__
+#define __LIBFORM_WIDGET_TEXTVIEW_H__
+
+#include <libformwidget.h>
+
+
+G_BEGIN_DECLS
+
+
+#define TYPE_FORM_WIDGET_TEXTVIEW                 (form_widget_textview_get_type ())
+#define FORM_WIDGET_TEXTVIEW(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FORM_WIDGET_TEXTVIEW, FormWidgetTextview))
+#define FORM_WIDGET_TEXTVIEW_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FORM_WIDGET_TEXTVIEW, FormWidgetTextviewClass))
+#define IS_FORM_WIDGET_TEXTVIEW(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FORM_WIDGET_TEXTVIEW))
+#define IS_FORM_WIDGET_TEXTVIEW_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FORM_WIDGET_TEXTVIEW))
+#define FORM_WIDGET_TEXTVIEW_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FORM_WIDGET_TEXTVIEW, FormWidgetTextviewClass))
+
+
+typedef struct _FormWidgetTextview FormWidgetTextview;
+typedef struct _FormWidgetTextviewClass FormWidgetTextviewClass;
+
+struct _FormWidgetTextview
+       {
+               FormWidget parent;
+       };
+
+struct _FormWidgetTextviewClass
+       {
+               FormWidgetClass parent_class;
+       };
+
+GType form_widget_textview_get_type (void) G_GNUC_CONST;
+
+FormWidget *form_widget_textview_new (void);
+
+const gchar *form_widget_textview_get_value_stringify (FormWidget *widget);
+
+gboolean form_widget_textview_set_value_stringify (FormWidget *fwidget, const gchar *value);
+
+
+G_END_DECLS
+
+
+#endif /* __LIBFORM_WIDGET_TEXTVIEW_H__ */
diff --git a/src/old/form.c b/src/old/form.c
new file mode 100644 (file)
index 0000000..6148922
--- /dev/null
@@ -0,0 +1,692 @@
+/*
+ * Copyright (C) 2005-2006 Andrea Zagli <azagli@inwind.it>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <string.h>
+#include <locale.h>
+
+#include <libgdaobj.h>
+
+#include "libform.h"
+
+static void form_class_init (FormClass *class);
+static void form_init (Form *form);
+
+static Field *form_get_field (Form *form, const gchar *name);
+static gchar *form_field_get_value_sql (Field *f);
+static gboolean form_field_check_struct (Field *f);
+
+
+#define FORM_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_FORM, FormPrivate))
+
+typedef struct _FormPrivate FormPrivate;
+struct _FormPrivate
+       {
+               GList fields;
+               GladeXML *glade;
+
+               struct lconv *loc;
+       };
+
+
+GType
+form_get_type (void)
+{
+  static GType form_type = 0;
+
+  if (!form_type)
+    {
+      static const GTypeInfo form_info =
+      {
+        sizeof (FormClass),
+        NULL,          /* base_init */
+        NULL,          /* base_finalize */
+        (GClassInitFunc) form_class_init,
+        NULL,          /* class_finalize */
+        NULL,          /* class_data */
+        sizeof (Form),
+        0,             /* n_preallocs */
+        (GInstanceInitFunc) form_init,
+                               NULL
+      };
+
+      form_type = g_type_register_static (G_TYPE_OBJECT, "Form",
+                                                                 &form_info, 0);
+    }
+
+  return form_type;
+}
+
+static void
+form_class_init (FormClass *class)
+{
+       GObjectClass *object_class = G_OBJECT_CLASS (class);
+
+       g_type_class_add_private (object_class, sizeof (FormPrivate));
+}
+
+static void
+form_init (Form *form)
+{
+       FormPrivate *priv = FORM_GET_PRIVATE (form);
+
+       priv->fields = NULL;
+       priv->glade = NULL;
+       priv->loc = localeconv ();
+}
+
+/**
+ * form_new:
+ *
+ * Returns: the newly created #Form.
+ */
+Form
+*form_new ()
+{
+       return FORM (g_object_new (form_get_type (), NULL));
+}
+
+/**
+ * form_set_glade:
+ * @glade:
+ *
+ * Returns: the newly created #Form.
+ */
+gboolean
+form_set_glade (Form *form, GladeXML *glade)
+{
+       gboolean ret = FALSE;
+
+       FormPrivate *priv = FORM_GET_PRIVATE (form);
+
+       priv->glade = glade;
+
+       /* TO DO */
+       /* setting fields with glade attributes */
+
+       ret = TRUE;
+
+       return ret;
+}
+
+gboolean
+form_add_field (Form *form, FormField *field)
+{
+       gboolean ret = FALSE;
+
+       FormPrivate *priv = FORM_GET_PRIVATE (form);
+
+       priv->field = g_list_append (priv->fields, field);
+
+       if (priv->glade != NULL)
+               {
+                       /* TO DO */
+                       /* setting fields with glade attributes */
+               }
+
+       ret = TRUE;
+
+       return ret;
+}
+
+gboolean
+form_remove_field (Form *form, FormField *field)
+{
+       gboolean ret = FALSE;
+
+       FormPrivate *priv = FORM_GET_PRIVATE (form);
+
+       priv->field = g_list_remove (priv->fields, field);
+
+       ret = TRUE;
+
+       return ret;
+}
+
+/**
+ * form_sql_get:
+ * @form: a #Form.
+ * @type:
+ * @table:
+ *
+ */
+gchar
+*form_get_sql (Form *form, FrmSqlType type, const gchar *table, ...)
+{
+       gchar *sql, *fields = "", *keys, *pkeys = NULL, *pname;
+       gint i;
+       Field *f;
+       gboolean with_key;
+       va_list ap;
+
+       if (table == NULL)
+               {
+                       return NULL;
+               }
+
+       FormPrivate *priv = FORM_GET_PRIVATE (form);
+
+       with_key = (type == FRM_SQL_TYPE_UPDATE ||
+                   type == FRM_SQL_TYPE_DELETE);
+
+       va_start (ap, table);
+       
+       while (TRUE)
+               {
+                       pname = va_arg (ap, gchar *);
+                       if (pname == NULL)
+                               {
+                                       break;
+                               }
+
+                       if (strcmp  (pname, "with-key") == 0)
+                               {
+                                       with_key = va_arg (ap, gboolean);
+                               }
+                       else
+                               {
+                                       pkeys = g_strjoin (NULL, " AND ", pname, " = ", NULL);
+                                       f = form_get_field (form, pname);
+                                       switch (f->field_type)
+                                               {
+                                                       case FRM_FIELD_TYPE_TEXT:
+                                                               pkeys = g_strjoin (NULL, pkeys, "'",
+                                                                                                                                        s_strescape (va_arg (ap, gchar *), NULL),
+                                                                                                                                        "'", NULL);
+                                                               break;
+
+                                                       case FRM_FIELD_TYPE_INTEGER:
+                                                               pkeys = g_strjoin (NULL, pkeys,
+                                                                                                                                        g_strdup_printf ("%d", va_arg (ap, gint)),
+                                                                                                                                        NULL);
+                                                               break;
+
+                                                       case FRM_FIELD_TYPE_FLOAT:
+                                                               pkeys = g_strjoin (NULL, pkeys,
+                                                                                                                                        g_strdup_printf ("%f", va_arg (ap, double)),
+                                                                                                                                        NULL);
+                                                               break;
+
+                                                       case FRM_FIELD_TYPE_BOOLEAN:
+                                                               pkeys = g_strjoin (NULL, pkeys, "'",
+                                                                                                                                        (va_arg (ap, gboolean) == TRUE ? "-1" : "0"),
+                                                                                                                                        "'", NULL);
+                                                               break;
+
+                                                       case FRM_FIELD_TYPE_DATE:
+                                                               {
+                                                                       GDate *date = va_arg (ap, GDate *);
+                                                                       pkeys = g_strjoin (NULL, pkeys, "'",
+                                                                                                                                                g_strdup_printf ("%04d%02d%02d",
+                                                                                                                                                                                                                       g_date_get_year (date),
+                                                                                                                                                                                                                       g_date_get_month (date),
+                                                                                                                                                                                                                       g_date_get_day (date)),
+                                                                                                                                                "'", NULL);
+                                                               }
+                                                               break;
+                                               }
+                               }
+               }
+
+       va_end (ap);
+
+       switch (type)
+               {
+                       case FRM_SQL_TYPE_SELECT:
+                               {
+                                       sql = g_strdup ("SELECT ");
+
+                                       for (i = 0; i < priv->nfields; i++)
+                                               {
+                                                       f = priv->fields[i];
+       
+                                                       if (strcmp (f->table_name, table) == 0)
+                                                               {
+                                                                       if (with_key && pkeys == NULL && f->key)
+                                                                               {
+                                                                                       keys = g_strjoin (NULL, keys, " AND ", f->field_name, " = ",
+                                                                                                         form_field_get_value_sql (f), NULL);
+                                                                               }
+                                                                       fields = g_strjoin (NULL, fields, f->field_name, ", ", NULL);
+                                                               }
+                                               }
+
+                                       fields[strlen (fields) - 2] = ' ';
+
+                                       sql = g_strjoin (NULL, sql, fields, "FROM ", g_strdup_printf ("%s", table), NULL);
+                                       if (with_key)
+                                               {
+                                                       sql = g_strjoin (NULL, sql, " WHERE TRUE", (pkeys != NULL ? pkeys : keys), NULL);
+                                               }
+                                       break;
+                               }
+               
+                       case FRM_SQL_TYPE_INSERT:
+                               {
+                                       gchar *values = "(";
+
+                                       sql = g_strdup_printf ("INSERT INTO %s ", table);
+                                       
+                                       for (i = 0; i < priv->nfields; i++)
+                                               {
+                                                       f = priv->fields[i];
+
+                                                       if (strcmp (f->table_name, table) == 0)
+                                                               {
+                                                                       fields = g_strjoin (NULL, fields, f->field_name, ", ", NULL);
+                                                                       values = g_strjoin (NULL, values, form_field_get_value_sql (f), ", ", NULL);
+                                                               }
+                                               }
+       
+                                       fields[strlen (fields) - 2] = ')';
+                                       values[strlen (values) - 2] = ')';
+
+                                       sql = g_strjoin (NULL, sql, "(", fields, " VALUES ", values, NULL);
+                                       break;
+                               }
+
+                       case FRM_SQL_TYPE_UPDATE:
+                               {
+                                       sql = g_strdup_printf ("UPDATE %s SET ", table);
+
+                                       for (i = 0; i < priv->nfields; i++)
+                                               {
+                                                       f = priv->fields[i];
+
+                                                       if (strcmp (f->table_name, table) == 0)
+                                                               {
+                                                                       if (with_key && f->key)
+                                                                               {
+                                                                                       keys = g_strjoin (NULL, keys, " AND ", f->field_name, " = ",
+                                                                                                         form_field_get_value_sql (f), NULL);
+                                                                               }
+                                                                       else
+                                                                               {
+                                                                                       fields = g_strjoin (NULL, fields, f->field_name, " = ", form_field_get_value_sql (f), ", ", NULL);
+                                                                               }
+                                                               }
+                                               }
+
+                                       fields[strlen (fields) - 2] = ' ';
+
+                                       sql = g_strjoin (NULL, sql, fields, keys, NULL);
+                                       break;
+                               }
+
+                       case FRM_SQL_TYPE_DELETE:
+                               {
+                                       sql = g_strdup_printf ("DELETE FROM %s%s", table, (with_key ? " WHERE TRUE" : ""));
+
+                                       if (with_key)
+                                               {
+                                                       if (pkeys != NULL)
+                                                               {
+                                                                       sql = g_strjoin (NULL, sql, pkeys, NULL);
+                                                               }
+                                                       else
+                                                               {
+                                                                       for (i = 0; i < priv->nfields; i++)
+                                                                               {
+                                                                                       f = priv->fields[i];
+                               
+                                                                                       if (strcmp (f->table_name, table) == 0 && f->key)
+                                                                                               {
+                                                                                                       sql = g_strjoin (NULL, sql, " AND ", f->field_name, "=",
+                                                                                                                                                                        form_field_get_value_sql (f), NULL);
+                                                                                               }
+                                                                               }
+                                                               }
+                                               }
+                                       break;
+                               }
+               }
+
+       return sql;
+}
+
+/**
+ * form_clear:
+ * @form: a #Form.
+ *
+ * Clears the form.
+ */
+gboolean
+form_clear (Form *form)
+{
+       gint i;
+       Field *f;
+
+       FormPrivate *priv = FORM_GET_PRIVATE (form);
+
+       for (i = 0; i < priv->nfields; i++)
+               {
+                       f = priv->fields[i];
+
+                       if (f->widget_type == GTK_TYPE_LABEL)
+                               {
+                                       gtk_label_set_text (GTK_LABEL (f->widget), f->default_value);
+                               }
+                       else if (f->widget_type == GTK_TYPE_ENTRY)
+                               {
+                                       gtk_entry_set_text (GTK_ENTRY (f->widget), f->default_value);
+                               }
+                       else if (f->widget_type == GTK_TYPE_SPIN_BUTTON)
+                               {
+                                       gtk_spin_button_set_value (GTK_SPIN_BUTTON (f->widget), atof (f->default_value));
+                               }
+                       else if (f->widget_type == GTK_TYPE_COMBO_BOX)
+                               {
+                                       gtk_combo_box_set_active (GTK_COMBO_BOX (f->widget), atoi (f->default_value));
+                               }
+               }
+}
+
+/**
+ * form_fill_from_datamodel:
+ * @form: a #Form.
+ * @dm:
+ *
+ */
+gboolean
+form_fill_from_datamodel (Form *form, GdaDataModel *dm, gint row)
+{
+       gint nfield;
+       Field *f;
+
+       FormPrivate *priv = FORM_GET_PRIVATE (form);
+
+       for (nfield = 0; nfield < priv->nfields; nfield++)
+               {
+                       f = priv->fields[nfield];
+
+                       if (f->widget_type == GTK_TYPE_LABEL)
+                               {
+                                       gtk_label_set_text (GTK_LABEL (f->widget),
+                                                           gdao_data_model_get_field_value_stringify_at (dm, row, f->field_name));
+                               }
+                       else if (f->widget_type == GTK_TYPE_ENTRY)
+                               {
+                                       gtk_entry_set_text (GTK_ENTRY (f->widget),
+                                                           gdao_data_model_get_field_value_stringify_at (dm, row, f->field_name));
+                               }
+                       else if (f->widget_type == GTK_TYPE_SPIN_BUTTON)
+                               {
+                                       gtk_spin_button_set_value (GTK_SPIN_BUTTON (f->widget),
+                                                           gdao_data_model_get_field_value_double_at (dm, row, f->field_name));
+                               }
+                       else if (f->widget_type == GTK_TYPE_COMBO_BOX)
+                               {
+                               }
+               }
+
+       return TRUE;
+}
+
+/**
+ * form_check:
+ * @form: a #Form.
+ *
+ */
+gboolean
+form_check (Form *form)
+{
+       gboolean ret = FALSE;
+       gint i;
+       Field *f;
+
+       FormPrivate *priv = FORM_GET_PRIVATE (form);
+
+       for (i = 0; i < priv->nfields; i++)
+               {
+                       f = priv->fields[i];
+                       switch (f->field_type)
+                               {
+                                       case FRM_FIELD_TYPE_TEXT:
+                                               {
+                                                       if (f->obligatory && strcmp (gtk_entry_get_text (GTK_ENTRY (f->widget)), "") == 0)
+                                                               {
+                                                                       return FALSE;
+                                                               }
+                                                       break;
+                                               }
+
+                                       case FRM_FIELD_TYPE_INTEGER:
+                                       case FRM_FIELD_TYPE_FLOAT:
+                                               {
+                                                       break;
+                                               }
+                               }
+               }
+
+       return ret;
+}
+
+/**
+ * form_field_get:
+ * @form:
+ * @field:
+ * @value:
+ *
+ */
+gboolean
+form_field_get (Form *form, gint field, GValue *value)
+{
+       FormPrivate *priv = FORM_GET_PRIVATE (form);
+
+       if (field > priv->nfields)
+               {
+                       return FALSE;
+               }
+
+       Field *f = priv->fields[field];
+
+       if (f->widget_type == GTK_TYPE_LABEL)
+               {
+                       g_value_init (value, G_TYPE_STRING);
+                       g_value_set_string (value, gtk_label_get_text (GTK_LABEL (f->widget)));
+               }
+       else if (f->widget_type == GTK_TYPE_ENTRY)
+               {
+                       g_value_init (value, G_TYPE_STRING);
+                       g_value_set_string (value, gtk_entry_get_text (GTK_ENTRY (f->widget)));
+               }
+       else if (f->widget_type == GTK_TYPE_SPIN_BUTTON)
+               {
+                       if (f->field_type == FRM_FIELD_TYPE_INTEGER)
+                               {
+                                       g_value_init (value, G_TYPE_INT);
+                                       g_value_set_int (value, gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (f->widget)));
+                               }
+                       else if (f->field_type == FRM_FIELD_TYPE_FLOAT)
+                               {
+                                       g_value_init (value, G_TYPE_FLOAT);
+                                       g_value_set_float (value, gtk_spin_button_get_value_as_float (GTK_SPIN_BUTTON (f->widget)));
+                               }
+               }
+       else if (f->widget_type == GTK_TYPE_COMBO_BOX)
+               {
+               }
+
+       return TRUE;
+}
+
+/* PRIVATE */
+static Field
+*form_get_field (Form *form, const gchar *name)
+{
+       gint i;
+       Field *f = NULL;
+
+       FormPrivate *priv = FORM_GET_PRIVATE (form);
+
+       for (i = 0; i < priv->nfields; i++)
+               {
+                       f = priv->fields[i];
+                       if (strcmp (f->field_name, name) == 0)
+                               {
+                                       break;
+                               }
+               }
+
+       return f;
+}
+
+static gchar
+*form_field_get_value_sql (Field *f)
+{
+       gchar *ret = "";
+       
+       FormPrivate *priv = FORM_GET_PRIVATE (f->form);
+
+       if (f->widget_type == GTK_TYPE_LABEL)
+               {
+                       ret = (gchar *)gtk_label_get_text (GTK_LABEL (f->widget));
+               }
+       else if (f->widget_type == GTK_TYPE_ENTRY)
+               {
+                       ret = (gchar *)gtk_entry_get_text (GTK_ENTRY (f->widget));
+               }
+       else if (f->widget_type == GTK_TYPE_SPIN_BUTTON)
+               {
+                       if (f->field_type == FRM_FIELD_TYPE_INTEGER)
+                               {
+                                       ret = g_strdup_printf ("%d", gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (f->widget)));
+                               }
+                       else if (f->field_type == FRM_FIELD_TYPE_FLOAT)
+                               {
+                                       ret = g_strdup_printf ("%f", gtk_spin_button_get_value_as_float (GTK_SPIN_BUTTON (f->widget)));
+                                       ret = g_strjoinv (".", g_strsplit (ret, priv->loc->decimal_point, -1));
+                               }
+               }
+
+       switch (f->field_type)
+               {
+                       case FRM_FIELD_TYPE_TEXT:
+                               ret = g_strjoin (NULL, "'", s_strescape(ret, NULL), "'", NULL);
+                               break;
+               }
+
+       return ret;
+}
+
+static gboolean
+form_field_check_struct (Field *f)
+{
+       if (f->widget != NULL)
+               {
+                       if (f->widget_type == 0)
+                               {
+                                       f->widget_type = GTK_WIDGET_TYPE (f->widget);
+                               }
+               }
+       else
+               {
+                       return FALSE;
+               }
+
+       if (f->field_type == 0)
+               {
+                       if (f->widget_type == GTK_TYPE_LABEL || f->widget_type == GTK_TYPE_ENTRY)
+                               {
+                                       f->field_type = FRM_FIELD_TYPE_TEXT;
+                               }
+                       else if (f->widget_type == GTK_TYPE_SPIN_BUTTON)
+                               {
+                                       if (gtk_spin_button_get_digits (GTK_SPIN_BUTTON (f->widget)) > 0)
+                                               {
+                                                       f->field_type = FRM_FIELD_TYPE_FLOAT;
+                                               }
+                                       else
+                                               {
+                                                       f->field_type = FRM_FIELD_TYPE_INTEGER;
+                                               }
+                               }
+                       else if (f->widget_type == GTK_TYPE_COMBO_BOX)
+                               {
+                                       f->field_type = FRM_FIELD_TYPE_INTEGER;
+                               }
+               }
+
+       switch (f->field_type)
+               {
+                       case FRM_FIELD_TYPE_TEXT:
+                               {
+                                       if (f->default_value == NULL)
+                                               {
+                                                       if (f->widget_type == GTK_TYPE_COMBO_BOX)
+                                                               {
+                                                                       f->default_value = g_strdup ("0");
+                                                               }
+                                                       else
+                                                               {
+                                                                       f->default_value = g_strdup ("");
+                                                               }
+                                               }
+                                       break;
+                               }
+
+                       case FRM_FIELD_TYPE_INTEGER:
+                               {
+                                       if (f->default_value == NULL)
+                                               {
+                                                       f->default_value = g_strdup ("0");
+                                               }
+                                       else
+                                               {
+                                                       f->default_value = g_strdup_printf ("%d", atoi (f->default_value));
+                                               }
+                                       break;
+                               }
+
+                       case FRM_FIELD_TYPE_FLOAT:
+                               {
+                                       if (f->default_value == NULL)
+                                               {
+                                                       f->default_value = g_strdup ("0.0");
+                                               }
+                                       else
+                                               {
+                                                       f->default_value = g_strdup_printf ("%f", atof (f->default_value));
+                                               }
+                                       break;
+                               }
+
+                       case FRM_FIELD_TYPE_BOOLEAN:
+                               {
+                                       if (f->default_value == NULL)
+                                               {
+                                                       f->default_value = g_strdup ("0");
+                                               }
+                                       else
+                                               {
+                                                       f->default_value = g_strdup_printf ("%d",
+                                                                                           atoi (f->default_value) == 0 ||
+                                                                                           atoi (f->default_value) == 1 ?
+                                                                                           atoi (f->default_value) : 0);
+                                               }
+                                       break;
+                               }
+               }
+
+       if (f->key)
+               {
+                       /* a key is always obligatory */
+                       f->obligatory = TRUE;
+               }
+
+       return TRUE;
+}
diff --git a/src/old/libform.h b/src/old/libform.h
new file mode 100644 (file)
index 0000000..c147eef
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2005-2006 Andrea Zagli <azagli@inwind.it>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LIBFORM_H__
+#define __LIBFORM_H__
+
+#include <glib.h>
+#include <glade/glade.h>
+
+#include <libgdaobj.h>
+
+G_BEGIN_DECLS
+
+
+#define TYPE_FORM                 (form_get_type ())
+#define FORM(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FORM, Form))
+#define FORM_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FORM, FormClass))
+#define IS_FORM(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FORM))
+#define IS_FORM_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FORM))
+#define FORM_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FORM, FormClass))
+
+
+typedef struct _Form Form;
+typedef struct _FormClass FormClass;
+
+struct _Form
+       {
+               GObject parent;
+       };
+
+struct _FormClass
+       {
+               GObjectClass parent_class;
+       };
+
+GType form_get_type (void) G_GNUC_CONST;
+
+
+Form *form_new (void);
+
+gboolean form_set_glade (Form *form, GladeXML *glade);
+
+gboolean form_add_field (Form *form, FormField *field);
+gboolean form_remove_field (Form *form, FormField *field);
+
+typedef enum
+{
+       FRM_SQL_TYPE_SELECT,
+       FRM_SQL_TYPE_UPDATE,
+       FRM_SQL_TYPE_INSERT,
+       FRM_SQL_TYPE_DELETE
+} FormSqlType;
+
+gchar *form_get_sql (Form *form, FormSqlType type, const gchar *table, ...);
+
+gboolean form_clear (Form *form);
+gboolean form_fill_from_datamodel (Form *form, GdaDataModel *dm, gint row);
+
+gboolean form_check (Form *form);
+
+gboolean form_field_get (Form *form, gint field, GValue *value);
+
+
+G_END_DECLS
+
+#endif /* __LIBFORM_H__ */
diff --git a/src/widget.c b/src/widget.c
new file mode 100644 (file)
index 0000000..47f05ba
--- /dev/null
@@ -0,0 +1,234 @@
+/*
+ * Copyright (C) 2005-2006 Andrea Zagli <azagli@inwind.it>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <gtk/gtk.h>
+
+#include "libformwidget.h"
+
+enum
+{
+       PROP_0,
+       PROP_WIDGET,
+       PROP_NAME
+};
+
+static void form_widget_class_init (FormWidgetClass *klass);
+static void form_widget_init (FormWidget *form_widget);
+
+static void form_widget_set_property (GObject *object,
+                                      guint property_id,
+                                      const GValue *value,
+                                      GParamSpec *pspec);
+static void form_widget_get_property (GObject *object,
+                                      guint property_id,
+                                      GValue *value,
+                                      GParamSpec *pspec);
+
+#define FORM_WIDGET_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_FORM_WIDGET, FormWidgetPrivate))
+
+typedef struct _FormWidgetPrivate FormWidgetPrivate;
+struct _FormWidgetPrivate
+       {
+               GtkWidget *widget;
+               gchar *widget_name;
+       };
+
+
+GType
+form_widget_get_type (void)
+{
+       static GType form_widget_type = 0;
+
+       if (!form_widget_type)
+               {
+                       static const GTypeInfo form_widget_info =
+                       {
+                               sizeof (FormWidgetClass),
+                               NULL,           /* base_init */
+                               NULL,           /* base_finalize */
+                               (GClassInitFunc) form_widget_class_init,
+                               NULL,           /* class_finalize */
+                               NULL,           /* class_data */
+                               sizeof (FormWidget),
+                               0,              /* n_preallocs */
+                               (GInstanceInitFunc) form_widget_init,
+                               NULL
+                       };
+
+                       form_widget_type = g_type_register_static (G_TYPE_OBJECT, "FormWidget",
+                                                                  &form_widget_info, 0);
+    }
+
+       return form_widget_type;
+}
+
+static void
+form_widget_class_init (FormWidgetClass *klass)
+{
+       GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+       object_class->set_property = form_widget_set_property;
+       object_class->get_property = form_widget_get_property;
+
+       g_object_class_install_property (object_class, PROP_WIDGET,
+                                        g_param_spec_object ("widget",
+                                                             "GtkWidget",
+                                                             "The GtkWidget",
+                                                             GTK_TYPE_WIDGET,
+                                                             G_PARAM_READWRITE));
+
+       g_object_class_install_property (object_class, PROP_NAME,
+                                        g_param_spec_string ("widget-name",
+                                                             "Widget's name",
+                                                             "Widget's name",
+                                                             "",
+                                                             G_PARAM_READWRITE));
+
+       g_type_class_add_private (object_class, sizeof (FormWidgetPrivate));
+}
+
+static void
+form_widget_init (FormWidget *form_widget)
+{
+}
+
+/**
+ * form_widget_new:
+ *
+ * Returns: the newly created #FormWidget.
+ */
+FormWidget
+*form_widget_new ()
+{
+       return g_object_new (TYPE_FORM_WIDGET, NULL);
+}
+
+/**
+ * form_widget_set_from_glade:
+ * @fwidget:
+ * @glade:
+ * @widget_name:
+ *
+ */
+gboolean
+form_widget_set_from_glade (FormWidget *fwidget, GladeXML *glade, const gchar *widget_name)
+{
+       gboolean ret = FALSE;
+
+       GtkWidget *w = glade_xml_get_widget (glade, widget_name);
+       if (w != NULL)
+               {
+                       g_object_set (fwidget,
+                                     "widget", w,
+                                     "widget-name", widget_name,
+                                     NULL);
+
+                       ret = TRUE;
+               }
+
+       return ret;
+}
+
+/**
+ * form_widget_get_widget:
+ * @fwidget:
+ *
+ */
+GtkWidget
+*form_widget_get_widget (FormWidget *fwidget)
+{
+       FormWidgetPrivate *priv = FORM_WIDGET_GET_PRIVATE (fwidget);
+
+       return priv->widget;
+}
+
+/**
+ * form_widget_get_value_stringify:
+ * @fwidget:
+ *
+ */
+const gchar
+*form_widget_get_value_stringify (FormWidget *fwidget)
+{
+       FORM_WIDGET_GET_CLASS (fwidget)->get_value_stringify (fwidget);
+}
+
+/**
+ * form_widget_set_value_stringify:
+ * @fwidget:
+ * @value:
+ *
+ */
+gboolean
+form_widget_set_value_stringify (FormWidget *fwidget, const gchar *value)
+{
+       FORM_WIDGET_GET_CLASS (fwidget)->set_value_stringify (fwidget, value);
+}
+
+/* PRIVATE */
+static void
+form_widget_set_property (GObject *object,
+                          guint property_id,
+                          const GValue *value,
+                          GParamSpec *pspec)
+{
+       FormWidget *fwidget = (FormWidget *)object;
+
+       FormWidgetPrivate *priv = FORM_WIDGET_GET_PRIVATE (fwidget);
+
+       switch (property_id)
+               {
+                       case PROP_WIDGET:
+                               priv->widget = g_value_get_object (value);
+                               break;
+
+                       case PROP_NAME:
+                               priv->widget_name = g_strstrip (g_strdup (g_value_get_string (value)));
+                               break;
+
+                       default:
+                               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+                               break;
+         }
+}
+
+static void
+form_widget_get_property (GObject *object,
+                          guint property_id,
+                          GValue *value,
+                          GParamSpec *pspec)
+{
+       FormWidget *fwidget = (FormWidget *)object;
+
+       FormWidgetPrivate *priv = FORM_WIDGET_GET_PRIVATE (fwidget);
+
+       switch (property_id)
+               {
+                       case PROP_WIDGET:
+                               g_value_set_object (value, priv->widget);
+                               break;
+
+                       case PROP_NAME:
+                               g_value_set_string (value, priv->widget_name);
+                               break;
+
+                       default:
+                               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+                               break;
+         }
+}
diff --git a/src/widgetcheck.c b/src/widgetcheck.c
new file mode 100644 (file)
index 0000000..f8c6a46
--- /dev/null
@@ -0,0 +1,213 @@
+/*
+ * Copyright (C) 2005-2006 Andrea Zagli <azagli@inwind.it>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <string.h>
+
+#include <gtk/gtk.h>
+
+#include "libformwidgetcheck.h"
+
+enum
+{
+       PROP_0
+};
+
+static void form_widget_check_class_init (FormWidgetCheckClass *klass);
+static void form_widget_check_init (FormWidgetCheck *form_widget_check);
+
+static void form_widget_check_set_property (GObject *object,
+                                            guint property_id,
+                                            const GValue *value,
+                                            GParamSpec *pspec);
+static void form_widget_check_get_property (GObject *object,
+                                            guint property_id,
+                                            GValue *value,
+                                            GParamSpec *pspec);
+
+static gboolean check_value (const gchar *value);
+
+#define FORM_WIDGET_CHECK_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_FORM_WIDGET_CHECK, FormWidgetCheckPrivate))
+
+typedef struct _FormWidgetCheckPrivate FormWidgetCheckPrivate;
+struct _FormWidgetCheckPrivate
+       {
+       };
+
+
+GType
+form_widget_check_get_type (void)
+{
+       static GType form_widget_check_type = 0;
+
+       if (!form_widget_check_type)
+               {
+                       static const GTypeInfo form_widget_check_info =
+                       {
+                               sizeof (FormWidgetCheckClass),
+                               NULL,           /* base_init */
+                               NULL,           /* base_finalize */
+                               (GClassInitFunc) form_widget_check_class_init,
+                               NULL,           /* class_finalize */
+                               NULL,           /* class_data */
+                               sizeof (FormWidgetCheck),
+                               0,              /* n_preallocs */
+                               (GInstanceInitFunc) form_widget_check_init,
+                               NULL
+                       };
+
+                       form_widget_check_type = g_type_register_static (TYPE_FORM_WIDGET, "FormWidgetCheck",
+                                                                        &form_widget_check_info, 0);
+    }
+
+       return form_widget_check_type;
+}
+
+static void
+form_widget_check_class_init (FormWidgetCheckClass *klass)
+{
+       GObjectClass *object_class = G_OBJECT_CLASS (klass);
+       FormWidgetClass *widget_class = FORM_WIDGET_CLASS (klass);
+
+       object_class->set_property = form_widget_check_set_property;
+       object_class->get_property = form_widget_check_get_property;
+
+       widget_class->get_value_stringify = form_widget_check_get_value_stringify;
+       widget_class->set_value_stringify = form_widget_check_set_value_stringify;
+
+       g_type_class_add_private (object_class, sizeof (FormWidgetCheckPrivate));
+}
+
+static void
+form_widget_check_init (FormWidgetCheck *form_widget_check)
+{
+}
+
+/**
+ * form_widget_check_new:
+ *
+ * Returns: the newly created #FormWidgetCheck.
+ */
+FormWidget
+*form_widget_check_new ()
+{
+       return g_object_new (TYPE_FORM_WIDGET_CHECK, NULL);
+}
+
+/**
+ * form_widget_check_get_value_stringify:
+ * @widget:
+ *
+ */
+const gchar
+*form_widget_check_get_value_stringify (FormWidget *fwidget)
+{
+       GtkWidget *w = form_widget_get_widget (fwidget);
+
+       return g_strdup_printf ("%d", gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (w)));
+}
+
+/**
+ * form_widget_check_set_value_stringify:
+ * @fwidget:
+ * @value:
+ *
+ */
+gboolean
+form_widget_check_set_value_stringify (FormWidget *fwidget, const gchar *value)
+{
+       gboolean ret = FALSE;
+       GtkWidget *w;
+       gboolean active = FALSE;
+
+       g_object_get (G_OBJECT (fwidget),
+                     "widget", &w,
+                     NULL);
+
+       active = check_value (value);
+
+       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w), active);
+
+       ret = TRUE;
+
+       return ret;
+}
+
+/* PRIVATE */
+static void
+form_widget_check_set_property (GObject *object,
+                                guint property_id,
+                                const GValue *value,
+                                GParamSpec *pspec)
+{
+       FormWidgetCheck *widget_check = (FormWidgetCheck *)object;
+
+       FormWidgetCheckPrivate *priv = FORM_WIDGET_CHECK_GET_PRIVATE (widget_check);
+
+       switch (property_id)
+               {
+                       default:
+                               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+                               break;
+         }
+}
+
+static void
+form_widget_check_get_property (GObject *object,
+                                guint property_id,
+                                GValue *value,
+                                GParamSpec *pspec)
+{
+       FormWidgetCheck *widget_check = (FormWidgetCheck *)object;
+
+       FormWidgetCheckPrivate *priv = FORM_WIDGET_CHECK_GET_PRIVATE (widget_check);
+
+       switch (property_id)
+               {
+                       default:
+                               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+                               break;
+         }
+}
+
+static gboolean
+check_value (const gchar *value)
+{
+       gchar *str_value;
+       gboolean active = FALSE;
+
+       str_value = g_strstrip (g_strdup (value));
+
+       if (strcmp (str_value, "0") == 0
+           || strcasecmp (str_value, "f") == 0
+           || strcasecmp (str_value, "false") == 0
+           || strcasecmp (str_value, "n") == 0
+           || strcasecmp (str_value, "no") == 0)
+               {
+                       active = FALSE;
+               }
+       else if (strcmp (str_value, "1") == 0
+           || strcasecmp (str_value, "t") == 0
+           || strcasecmp (str_value, "true") == 0
+           || strcasecmp (str_value, "y") == 0
+           || strcasecmp (str_value, "yes") == 0)
+               {
+                       active = TRUE;
+               }
+
+       return active;
+}
diff --git a/src/widgetentry.c b/src/widgetentry.c
new file mode 100644 (file)
index 0000000..c91424e
--- /dev/null
@@ -0,0 +1,178 @@
+/*
+ * Copyright (C) 2005-2006 Andrea Zagli <azagli@inwind.it>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <gtk/gtk.h>
+
+#include "libformwidgetentry.h"
+
+enum
+{
+       PROP_0
+};
+
+static void form_widget_entry_class_init (FormWidgetEntryClass *klass);
+static void form_widget_entry_init (FormWidgetEntry *form_widget_entry);
+
+static void form_widget_entry_set_property (GObject *object,
+                                      guint property_id,
+                                      const GValue *value,
+                                      GParamSpec *pspec);
+static void form_widget_entry_get_property (GObject *object,
+                                      guint property_id,
+                                      GValue *value,
+                                      GParamSpec *pspec);
+
+#define FORM_WIDGET_ENTRY_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_FORM_WIDGET_ENTRY, FormWidgetEntryPrivate))
+
+typedef struct _FormWidgetEntryPrivate FormWidgetEntryPrivate;
+struct _FormWidgetEntryPrivate
+       {
+       };
+
+
+GType
+form_widget_entry_get_type (void)
+{
+       static GType form_widget_entry_type = 0;
+
+       if (!form_widget_entry_type)
+               {
+                       static const GTypeInfo form_widget_entry_info =
+                       {
+                               sizeof (FormWidgetEntryClass),
+                               NULL,           /* base_init */
+                               NULL,           /* base_finalize */
+                               (GClassInitFunc) form_widget_entry_class_init,
+                               NULL,           /* class_finalize */
+                               NULL,           /* class_data */
+                               sizeof (FormWidgetEntry),
+                               0,              /* n_preallocs */
+                               (GInstanceInitFunc) form_widget_entry_init,
+                               NULL
+                       };
+
+                       form_widget_entry_type = g_type_register_static (TYPE_FORM_WIDGET, "FormWidgetEntry",
+                                                                        &form_widget_entry_info, 0);
+    }
+
+       return form_widget_entry_type;
+}
+
+static void
+form_widget_entry_class_init (FormWidgetEntryClass *klass)
+{
+       GObjectClass *object_class = G_OBJECT_CLASS (klass);
+       FormWidgetClass *widget_class = FORM_WIDGET_CLASS (klass);
+
+       object_class->set_property = form_widget_entry_set_property;
+       object_class->get_property = form_widget_entry_get_property;
+
+       widget_class->get_value_stringify = form_widget_entry_get_value_stringify;
+       widget_class->set_value_stringify = form_widget_entry_set_value_stringify;
+
+       g_type_class_add_private (object_class, sizeof (FormWidgetEntryPrivate));
+}
+
+static void
+form_widget_entry_init (FormWidgetEntry *form_widget_entry)
+{
+}
+
+/**
+ * form_widget_entry_new:
+ *
+ * Returns: the newly created #FormWidgetEntry.
+ */
+FormWidget
+*form_widget_entry_new ()
+{
+       return g_object_new (TYPE_FORM_WIDGET_ENTRY, NULL);
+}
+
+/**
+ * form_widget_entry_get_value_stringify:
+ * @widget:
+ *
+ */
+const gchar
+*form_widget_entry_get_value_stringify (FormWidget *fwidget)
+{
+       GtkWidget *w = form_widget_get_widget (fwidget);
+
+       return gtk_entry_get_text (GTK_ENTRY (w));
+}
+
+/**
+ * form_widget_entry_set_value_stringify:
+ * @fwidget:
+ * @value:
+ *
+ */
+gboolean
+form_widget_entry_set_value_stringify (FormWidget *fwidget, const gchar *value)
+{
+       gboolean ret = FALSE;
+       GtkWidget *w;
+
+       g_object_get (G_OBJECT (fwidget),
+                     "widget", &w,
+                     NULL);
+
+       gtk_entry_set_text (GTK_ENTRY (w), value);
+
+       ret = TRUE;
+
+       return ret;
+}
+
+/* PRIVATE */
+static void
+form_widget_entry_set_property (GObject *object,
+                                guint property_id,
+                                const GValue *value,
+                                GParamSpec *pspec)
+{
+       FormWidgetEntry *widget_entry = (FormWidgetEntry *)object;
+
+       FormWidgetEntryPrivate *priv = FORM_WIDGET_ENTRY_GET_PRIVATE (widget_entry);
+
+       switch (property_id)
+               {
+                       default:
+                               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+                               break;
+         }
+}
+
+static void
+form_widget_entry_get_property (GObject *object,
+                                guint property_id,
+                                GValue *value,
+                                GParamSpec *pspec)
+{
+       FormWidgetEntry *widget_entry = (FormWidgetEntry *)object;
+
+       FormWidgetEntryPrivate *priv = FORM_WIDGET_ENTRY_GET_PRIVATE (widget_entry);
+
+       switch (property_id)
+               {
+                       default:
+                               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+                               break;
+         }
+}
diff --git a/src/widgetlabel.c b/src/widgetlabel.c
new file mode 100644 (file)
index 0000000..650a890
--- /dev/null
@@ -0,0 +1,178 @@
+/*
+ * Copyright (C) 2005-2006 Andrea Zagli <azagli@inwind.it>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <gtk/gtk.h>
+
+#include "libformwidgetlabel.h"
+
+enum
+{
+       PROP_0
+};
+
+static void form_widget_label_class_init (FormWidgetLabelClass *klass);
+static void form_widget_label_init (FormWidgetLabel *form_widget_label);
+
+static void form_widget_label_set_property (GObject *object,
+                                      guint property_id,
+                                      const GValue *value,
+                                      GParamSpec *pspec);
+static void form_widget_label_get_property (GObject *object,
+                                      guint property_id,
+                                      GValue *value,
+                                      GParamSpec *pspec);
+
+#define FORM_WIDGET_LABEL_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_FORM_WIDGET_LABEL, FormWidgetLabelPrivate))
+
+typedef struct _FormWidgetLabelPrivate FormWidgetLabelPrivate;
+struct _FormWidgetLabelPrivate
+       {
+       };
+
+
+GType
+form_widget_label_get_type (void)
+{
+       static GType form_widget_label_type = 0;
+
+       if (!form_widget_label_type)
+               {
+                       static const GTypeInfo form_widget_label_info =
+                       {
+                               sizeof (FormWidgetLabelClass),
+                               NULL,           /* base_init */
+                               NULL,           /* base_finalize */
+                               (GClassInitFunc) form_widget_label_class_init,
+                               NULL,           /* class_finalize */
+                               NULL,           /* class_data */
+                               sizeof (FormWidgetLabel),
+                               0,              /* n_preallocs */
+                               (GInstanceInitFunc) form_widget_label_init,
+                               NULL
+                       };
+
+                       form_widget_label_type = g_type_register_static (TYPE_FORM_WIDGET, "FormWidgetLabel",
+                                                                        &form_widget_label_info, 0);
+    }
+
+       return form_widget_label_type;
+}
+
+static void
+form_widget_label_class_init (FormWidgetLabelClass *klass)
+{
+       GObjectClass *object_class = G_OBJECT_CLASS (klass);
+       FormWidgetClass *widget_class = FORM_WIDGET_CLASS (klass);
+
+       object_class->set_property = form_widget_label_set_property;
+       object_class->get_property = form_widget_label_get_property;
+
+       widget_class->get_value_stringify = form_widget_label_get_value_stringify;
+       widget_class->set_value_stringify = form_widget_label_set_value_stringify;
+
+       g_type_class_add_private (object_class, sizeof (FormWidgetLabelPrivate));
+}
+
+static void
+form_widget_label_init (FormWidgetLabel *form_widget_label)
+{
+}
+
+/**
+ * form_widget_label_new:
+ *
+ * Returns: the newly created #FormWidgetLabel.
+ */
+FormWidget
+*form_widget_label_new ()
+{
+       return g_object_new (TYPE_FORM_WIDGET_LABEL, NULL);
+}
+
+/**
+ * form_widget_label_get_value_stringify:
+ * @widget:
+ *
+ */
+const gchar
+*form_widget_label_get_value_stringify (FormWidget *fwidget)
+{
+       GtkWidget *w = form_widget_get_widget (fwidget);;
+
+       return gtk_label_get_text (GTK_LABEL (w));
+}
+
+/**
+ * form_widget_label_set_value_stringify:
+ * @fwidget:
+ * @value:
+ *
+ */
+gboolean
+form_widget_label_set_value_stringify (FormWidget *fwidget, const gchar *value)
+{
+       gboolean ret = FALSE;
+       GtkWidget *w;
+
+       g_object_get (G_OBJECT (fwidget),
+                     "widget", &w,
+                     NULL);
+
+       gtk_label_set_text (GTK_LABEL (w), value);
+
+       ret = TRUE;
+
+       return ret;
+}
+
+/* PRIVATE */
+static void
+form_widget_label_set_property (GObject *object,
+                                guint property_id,
+                                const GValue *value,
+                                GParamSpec *pspec)
+{
+       FormWidgetLabel *widget_label = (FormWidgetLabel *)object;
+
+       FormWidgetLabelPrivate *priv = FORM_WIDGET_LABEL_GET_PRIVATE (widget_label);
+
+       switch (property_id)
+               {
+                       default:
+                               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+                               break;
+         }
+}
+
+static void
+form_widget_label_get_property (GObject *object,
+                                guint property_id,
+                                GValue *value,
+                                GParamSpec *pspec)
+{
+       FormWidgetLabel *widget_label = (FormWidgetLabel *)object;
+
+       FormWidgetLabelPrivate *priv = FORM_WIDGET_LABEL_GET_PRIVATE (widget_label);
+
+       switch (property_id)
+               {
+                       default:
+                               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+                               break;
+         }
+}
diff --git a/src/widgetspin.c b/src/widgetspin.c
new file mode 100644 (file)
index 0000000..dfd0882
--- /dev/null
@@ -0,0 +1,183 @@
+/*
+ * Copyright (C) 2005-2006 Andrea Zagli <azagli@inwind.it>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <stdlib.h>
+
+#include <gtk/gtk.h>
+
+#include "libformwidgetspin.h"
+
+enum
+{
+       PROP_0
+};
+
+static void form_widget_spin_class_init (FormWidgetSpinClass *klass);
+static void form_widget_spin_init (FormWidgetSpin *form_widget_spin);
+
+static void form_widget_spin_set_property (GObject *object,
+                                           guint property_id,
+                                           const GValue *value,
+                                           GParamSpec *pspec);
+static void form_widget_spin_get_property (GObject *object,
+                                           guint property_id,
+                                           GValue *value,
+                                           GParamSpec *pspec);
+
+#define FORM_WIDGET_SPIN_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_FORM_WIDGET_SPIN, FormWidgetSpinPrivate))
+
+typedef struct _FormWidgetSpinPrivate FormWidgetSpinPrivate;
+struct _FormWidgetSpinPrivate
+       {
+       };
+
+
+GType
+form_widget_spin_get_type (void)
+{
+       static GType form_widget_spin_type = 0;
+
+       if (!form_widget_spin_type)
+               {
+                       static const GTypeInfo form_widget_spin_info =
+                       {
+                               sizeof (FormWidgetSpinClass),
+                               NULL,           /* base_init */
+                               NULL,           /* base_finalize */
+                               (GClassInitFunc) form_widget_spin_class_init,
+                               NULL,           /* class_finalize */
+                               NULL,           /* class_data */
+                               sizeof (FormWidgetSpin),
+                               0,              /* n_preallocs */
+                               (GInstanceInitFunc) form_widget_spin_init,
+                               NULL
+                       };
+
+                       form_widget_spin_type = g_type_register_static (TYPE_FORM_WIDGET, "FormWidgetSpin",
+                                                                       &form_widget_spin_info, 0);
+    }
+
+       return form_widget_spin_type;
+}
+
+static void
+form_widget_spin_class_init (FormWidgetSpinClass *klass)
+{
+       GObjectClass *object_class = G_OBJECT_CLASS (klass);
+       FormWidgetClass *widget_class = FORM_WIDGET_CLASS (klass);
+
+       object_class->set_property = form_widget_spin_set_property;
+       object_class->get_property = form_widget_spin_get_property;
+
+       widget_class->get_value_stringify = form_widget_spin_get_value_stringify;
+       widget_class->set_value_stringify = form_widget_spin_set_value_stringify;
+
+       g_type_class_add_private (object_class, sizeof (FormWidgetSpinPrivate));
+}
+
+static void
+form_widget_spin_init (FormWidgetSpin *form_widget_spin)
+{
+}
+
+/**
+ * form_widget_spin_new:
+ *
+ * Returns: the newly created #FormWidgetSpin.
+ */
+FormWidget
+*form_widget_spin_new ()
+{
+       return g_object_new (TYPE_FORM_WIDGET_SPIN, NULL);
+}
+
+/**
+ * form_widget_spin_get_value_stringify:
+ * @widget:
+ *
+ */
+const gchar
+*form_widget_spin_get_value_stringify (FormWidget *fwidget)
+{
+       GtkWidget *w = form_widget_get_widget (fwidget);
+       gchar *ret = NULL;
+
+       ret = g_strdup_printf ("%f", gtk_spin_button_get_value (GTK_SPIN_BUTTON (w)));
+
+       return ret;
+}
+
+/**
+ * form_widget_spin_set_value_stringify:
+ * @fwidget:
+ * @value:
+ *
+ */
+gboolean
+form_widget_spin_set_value_stringify (FormWidget *fwidget, const gchar *value)
+{
+       gboolean ret = FALSE;
+       GtkWidget *w;
+
+       g_object_get (G_OBJECT (fwidget),
+                     "widget", &w,
+                     NULL);
+
+       gtk_spin_button_set_value (GTK_SPIN_BUTTON (w), strtod (value, NULL));
+
+       ret = TRUE;
+
+       return ret;
+}
+
+/* PRIVATE */
+static void
+form_widget_spin_set_property (GObject *object,
+                               guint property_id,
+                               const GValue *value,
+                               GParamSpec *pspec)
+{
+       FormWidgetSpin *widget_spin = (FormWidgetSpin *)object;
+
+       FormWidgetSpinPrivate *priv = FORM_WIDGET_SPIN_GET_PRIVATE (widget_spin);
+
+       switch (property_id)
+               {
+                       default:
+                               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+                               break;
+         }
+}
+
+static void
+form_widget_spin_get_property (GObject *object,
+                               guint property_id,
+                               GValue *value,
+                               GParamSpec *pspec)
+{
+       FormWidgetSpin *widget_spin = (FormWidgetSpin *)object;
+
+       FormWidgetSpinPrivate *priv = FORM_WIDGET_SPIN_GET_PRIVATE (widget_spin);
+
+       switch (property_id)
+               {
+                       default:
+                               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+                               break;
+         }
+}
diff --git a/src/widgettextview.c b/src/widgettextview.c
new file mode 100644 (file)
index 0000000..787abce
--- /dev/null
@@ -0,0 +1,190 @@
+/*
+ * Copyright (C) 2005-2006 Andrea Zagli <azagli@inwind.it>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <gtk/gtk.h>
+
+#include "libformwidgettextview.h"
+
+enum
+{
+       PROP_0
+};
+
+static void form_widget_textview_class_init (FormWidgetTextviewClass *klass);
+static void form_widget_textview_init (FormWidgetTextview *form_widget_textview);
+
+static void form_widget_textview_set_property (GObject *object,
+                                      guint property_id,
+                                      const GValue *value,
+                                      GParamSpec *pspec);
+static void form_widget_textview_get_property (GObject *object,
+                                      guint property_id,
+                                      GValue *value,
+                                      GParamSpec *pspec);
+
+#define FORM_WIDGET_TEXTVIEW_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_FORM_WIDGET_TEXTVIEW, FormWidgetTextviewPrivate))
+
+typedef struct _FormWidgetTextviewPrivate FormWidgetTextviewPrivate;
+struct _FormWidgetTextviewPrivate
+       {
+       };
+
+
+GType
+form_widget_textview_get_type (void)
+{
+       static GType form_widget_textview_type = 0;
+
+       if (!form_widget_textview_type)
+               {
+                       static const GTypeInfo form_widget_textview_info =
+                       {
+                               sizeof (FormWidgetTextviewClass),
+                               NULL,           /* base_init */
+                               NULL,           /* base_finalize */
+                               (GClassInitFunc) form_widget_textview_class_init,
+                               NULL,           /* class_finalize */
+                               NULL,           /* class_data */
+                               sizeof (FormWidgetTextview),
+                               0,              /* n_preallocs */
+                               (GInstanceInitFunc) form_widget_textview_init,
+                               NULL
+                       };
+
+                       form_widget_textview_type = g_type_register_static (TYPE_FORM_WIDGET, "FormWidgetTextview",
+                                                                           &form_widget_textview_info, 0);
+    }
+
+       return form_widget_textview_type;
+}
+
+static void
+form_widget_textview_class_init (FormWidgetTextviewClass *klass)
+{
+       GObjectClass *object_class = G_OBJECT_CLASS (klass);
+       FormWidgetClass *widget_class = FORM_WIDGET_CLASS (klass);
+
+       object_class->set_property = form_widget_textview_set_property;
+       object_class->get_property = form_widget_textview_get_property;
+
+       widget_class->get_value_stringify = form_widget_textview_get_value_stringify;
+       widget_class->set_value_stringify = form_widget_textview_set_value_stringify;
+
+       g_type_class_add_private (object_class, sizeof (FormWidgetTextviewPrivate));
+}
+
+static void
+form_widget_textview_init (FormWidgetTextview *form_widget_textview)
+{
+}
+
+/**
+ * form_widget_textview_new:
+ *
+ * Returns: the newly created #FormWidgetTextview.
+ */
+FormWidget
+*form_widget_textview_new ()
+{
+       return g_object_new (TYPE_FORM_WIDGET_TEXTVIEW, NULL);
+}
+
+/**
+ * form_widget_textview_get_value_stringify:
+ * @widget:
+ *
+ */
+const gchar
+*form_widget_textview_get_value_stringify (FormWidget *fwidget)
+{
+       gchar *ret = NULL;
+       GtkWidget *w;
+       GtkTextBuffer *buf;
+       GtkTextIter start;
+       GtkTextIter end;
+
+       w = form_widget_get_widget (fwidget);
+
+       buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (w));
+       gtk_text_buffer_get_bounds (buf, &start, &end);
+       ret = gtk_text_buffer_get_text (buf, &start, &end, FALSE);
+
+       return ret;
+}
+
+/**
+ * form_widget_textview_set_value_stringify:
+ * @fwidget:
+ * @value:
+ *
+ */
+gboolean
+form_widget_textview_set_value_stringify (FormWidget *fwidget, const gchar *value)
+{
+       gboolean ret = FALSE;
+       GtkWidget *w;
+       GtkTextBuffer *buf;
+
+       g_object_get (G_OBJECT (fwidget),
+                     "widget", &w,
+                     NULL);
+
+       buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (w));
+       gtk_text_buffer_set_text (buf, value, -1);
+
+       ret = TRUE;
+
+       return ret;
+}
+
+/* PRIVATE */
+static void
+form_widget_textview_set_property (GObject *object,
+                                   guint property_id,
+                                   const GValue *value,
+                                   GParamSpec *pspec)
+{
+       FormWidgetTextview *widget_textview = (FormWidgetTextview *)object;
+
+       FormWidgetTextviewPrivate *priv = FORM_WIDGET_TEXTVIEW_GET_PRIVATE (widget_textview);
+
+       switch (property_id)
+               {
+                       default:
+                               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+                               break;
+         }
+}
+
+static void
+form_widget_textview_get_property (GObject *object,
+                                   guint property_id,
+                                   GValue *value,
+                                   GParamSpec *pspec)
+{
+       FormWidgetTextview *widget_textview = (FormWidgetTextview *)object;
+
+       FormWidgetTextviewPrivate *priv = FORM_WIDGET_TEXTVIEW_GET_PRIVATE (widget_textview);
+
+       switch (property_id)
+               {
+                       default:
+                               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+                               break;
+         }
+}
diff --git a/test/Makefile.am b/test/Makefile.am
new file mode 100644 (file)
index 0000000..80a6cc5
--- /dev/null
@@ -0,0 +1,12 @@
+LIBS = $(FORM_LIBS) \
+       -export-dynamic
+
+AM_CPPFLAGS = $(FORM_CFLAGS) \
+              -I$(top_srcdir)/src \
+              -DGLADEDIR="\"@abs_builddir@\""
+
+noinst_PROGRAMS = test
+
+test_SOURCES = main.c
+
+test_LDADD = $(top_builddir)/src/libform.la
diff --git a/test/main.c b/test/main.c
new file mode 100644 (file)
index 0000000..08016d0
--- /dev/null
@@ -0,0 +1,249 @@
+/*
+ * Copyright (C) 2005-2006 Andrea Zagli <azagli@inwind.it>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <string.h>
+#include <time.h>
+
+#include <gtk/gtk.h>
+#include <glade/glade.h>
+
+#include <libform.h>
+#include <libformfield.h>
+#include <libformfieldtext.h>
+#include <libformfieldinteger.h>
+#include <libformfieldfloat.h>
+#include <libformfieldboolean.h>
+#include <libformfielddatetime.h>
+#include <libformwidget.h>
+#include <libformwidgetlabel.h>
+#include <libformwidgetentry.h>
+#include <libformwidgettextview.h>
+#include <libformwidgetspin.h>
+#include <libformwidgetcheck.h>
+
+Form *form;
+
+FormField *ftext;
+FormField *fint;
+FormField *ffloat;
+FormField *fbool;
+FormField *fdatetime;
+
+FormWidget *wlabel;
+FormWidget *wentry;
+FormWidget *wtxtv;
+FormWidget *wspin;
+FormWidget *wcheck;
+
+GtkWidget *w;
+GtkWidget *txtvSql;
+
+void
+on_btnClear_clicked (GtkButton *button,
+                     gpointer user_data)
+{
+       form_clear (form);
+}
+
+void
+on_btnCheck_clicked (GtkButton *button,
+                     gpointer user_data)
+{
+       if (!form_check (form))
+               {
+                       GtkWidget *diag = gtk_message_dialog_new (GTK_WINDOW (w),
+                                                                 GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+                                                                 GTK_MESSAGE_ERROR,
+                                                                 GTK_BUTTONS_OK,
+                                                                 "Some obligatory field is empty.");
+                       gtk_dialog_run (GTK_DIALOG (diag));
+                       gtk_widget_destroy (diag);
+               }
+}
+
+void
+on_btnSqlSelect_clicked (GtkButton *button,
+                         gpointer user_data)
+{
+       GtkTextBuffer *buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (txtvSql));
+       gchar *sql = form_get_sql (form, FORM_SQL_SELECT);
+
+       gtk_text_buffer_set_text (buf, sql, strlen (sql));
+}
+
+void
+on_btnSqlUpdate_clicked (GtkButton *button,
+                         gpointer user_data)
+{
+       GtkTextBuffer *buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (txtvSql));
+       gchar *sql = form_get_sql (form, FORM_SQL_UPDATE);
+
+       gtk_text_buffer_set_text (buf, sql, strlen (sql));
+}
+
+void
+on_btnSqlInsert_clicked (GtkButton *button,
+                         gpointer user_data)
+{
+       GtkTextBuffer *buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (txtvSql));
+       gchar *sql = form_get_sql (form, FORM_SQL_INSERT);
+
+       gtk_text_buffer_set_text (buf, sql, strlen (sql));
+}
+
+void
+on_btnSqlDelete_clicked (GtkButton *button,
+                         gpointer user_data)
+{
+       GtkTextBuffer *buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (txtvSql));
+       gchar *sql = form_get_sql (form, FORM_SQL_DELETE);
+
+       gtk_text_buffer_set_text (buf, sql, strlen (sql));
+}
+
+int
+main (int argc, char **argv)
+{
+       GladeXML *glade;
+       FormKey *key;
+       time_t time_now;
+       struct tm *now;
+
+       gtk_init (&argc, &argv);
+
+       glade = glade_xml_new (GLADEDIR "/test.glade", NULL, NULL);
+
+       w = glade_xml_get_widget (glade, "wMain");
+
+       form = form_new ();
+       if (form == NULL) return 0;
+
+       key = form_key_new ();
+       g_object_set (G_OBJECT (form),
+                     "table", "names",
+                     "key", key,
+                     NULL);
+
+       /* LABEL - INTEGER */
+       wlabel = form_widget_label_new ();
+       form_widget_set_from_glade (wlabel, glade, "lblID");
+
+       fint = form_field_integer_new ();
+       g_object_set (fint,
+                     "field", "id",
+                     "form-widget", wlabel,
+                     "default", 15,
+                     NULL);
+       form_add_field (form, fint);
+       form_key_add_field (key, fint);
+
+       /* LABEL - TEXT */
+       wlabel = form_widget_label_new ();
+       form_widget_set_from_glade (wlabel, glade, "lblText");
+
+       ftext = form_field_text_new ();
+       g_object_set (ftext,
+                     "field", "id",
+                     "form-widget", wlabel,
+                     "default", "default value",
+                     NULL);
+       form_add_field (form, ftext);
+
+       /* ENTRY - TEXT */
+       wentry = form_widget_entry_new ();
+       form_widget_set_from_glade (wentry, glade, "txtName");
+
+       ftext = form_field_text_new ();
+       g_object_set (ftext,
+                     "field", "name",
+                                                               "obligatory", TRUE,
+                     "form-widget", wentry,
+                     "default", "entry default value",
+                     NULL);
+       form_add_field (form, ftext);
+
+       /* SPIN - INTEGER */
+       wspin = form_widget_spin_new ();
+       form_widget_set_from_glade (wspin, glade, "spnAge");
+
+       fint = form_field_integer_new ();
+       g_object_set (fint,
+                     "field", "age",
+                     "form-widget", wspin,
+                     "default", 23,
+                     NULL);
+       form_add_field (form, fint);
+
+       /* SPIN - FLOAT */
+       wspin = form_widget_spin_new ();
+       form_widget_set_from_glade (wspin, glade, "spnAmount");
+
+       ffloat = form_field_float_new ();
+       g_object_set (ffloat,
+                     "field", "amount",
+                     "form-widget", wspin,
+                     "default", 12.45f,
+                     NULL);
+       form_add_field (form, ffloat);
+
+       /* CHECK - BOOL*/
+       wcheck = form_widget_check_new ();
+       form_widget_set_from_glade (wcheck, glade, "chkMarried");
+
+       fbool = form_field_boolean_new ();
+       g_object_set (fbool,
+                     "field", "married",
+                     "form-widget", wcheck,
+                     NULL);
+       form_add_field (form, fbool);
+
+       /* TEXTVIEW - TEXT */
+       wtxtv = form_widget_textview_new ();
+       form_widget_set_from_glade (wtxtv, glade, "txtvDescription");
+
+       ftext = form_field_text_new ();
+       g_object_set (ftext,
+                     "field", "description",
+                     "form-widget", wtxtv,
+                                                               "default", "the default value\nfor this text view\nwith also line feed\nand\tt\ta\tb",
+                     NULL);
+       form_add_field (form, ftext);
+
+       /* LABEL - DATETIME */
+       time (&time_now);
+       now = localtime (&time_now);
+
+       wlabel = form_widget_label_new ();
+       form_widget_set_from_glade (wlabel, glade, "lblDateTime");
+
+       fdatetime = form_field_datetime_new ();
+       g_object_set (fdatetime,
+                     "field", "now",
+                     "form-widget", wlabel,
+                                                               "default", now,
+                     NULL);
+       form_add_field (form, fdatetime);
+
+       txtvSql = glade_xml_get_widget (glade, "txtvSql");
+
+       glade_xml_signal_autoconnect (glade);
+
+       gtk_main ();
+
+       return 0;
+}
diff --git a/test/test.glade b/test/test.glade
new file mode 100644 (file)
index 0000000..3d8cdb5
--- /dev/null
@@ -0,0 +1,711 @@
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
+
+<glade-interface>
+
+<widget class="GtkWindow" id="wMain">
+  <property name="visible">True</property>
+  <property name="title" translatable="yes">test libform</property>
+  <property name="type">GTK_WINDOW_TOPLEVEL</property>
+  <property name="window_position">GTK_WIN_POS_NONE</property>
+  <property name="modal">False</property>
+  <property name="resizable">True</property>
+  <property name="destroy_with_parent">False</property>
+  <property name="decorated">True</property>
+  <property name="skip_taskbar_hint">False</property>
+  <property name="skip_pager_hint">False</property>
+  <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
+  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+  <property name="focus_on_map">True</property>
+  <property name="urgency_hint">False</property>
+  <signal name="delete_event" handler="gtk_main_quit" last_modification_time="Sun, 15 Jan 2006 09:08:26 GMT"/>
+
+  <child>
+    <widget class="GtkVBox" id="vbox1">
+      <property name="border_width">3</property>
+      <property name="visible">True</property>
+      <property name="homogeneous">False</property>
+      <property name="spacing">0</property>
+
+      <child>
+       <widget class="GtkTable" id="table1">
+         <property name="border_width">3</property>
+         <property name="visible">True</property>
+         <property name="n_rows">9</property>
+         <property name="n_columns">2</property>
+         <property name="homogeneous">False</property>
+         <property name="row_spacing">3</property>
+         <property name="column_spacing">3</property>
+
+         <child>
+           <widget class="GtkLabel" id="label1">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes">Label (id)</property>
+             <property name="use_underline">False</property>
+             <property name="use_markup">False</property>
+             <property name="justify">GTK_JUSTIFY_LEFT</property>
+             <property name="wrap">False</property>
+             <property name="selectable">False</property>
+             <property name="xalign">0</property>
+             <property name="yalign">0.5</property>
+             <property name="xpad">0</property>
+             <property name="ypad">0</property>
+             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+             <property name="width_chars">-1</property>
+             <property name="single_line_mode">False</property>
+             <property name="angle">0</property>
+           </widget>
+           <packing>
+             <property name="left_attach">0</property>
+             <property name="right_attach">1</property>
+             <property name="top_attach">0</property>
+             <property name="bottom_attach">1</property>
+             <property name="x_options">fill</property>
+             <property name="y_options"></property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkLabel" id="label2">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes">GtkEntry (name)</property>
+             <property name="use_underline">False</property>
+             <property name="use_markup">False</property>
+             <property name="justify">GTK_JUSTIFY_LEFT</property>
+             <property name="wrap">False</property>
+             <property name="selectable">False</property>
+             <property name="xalign">0</property>
+             <property name="yalign">0.5</property>
+             <property name="xpad">0</property>
+             <property name="ypad">0</property>
+             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+             <property name="width_chars">-1</property>
+             <property name="single_line_mode">False</property>
+             <property name="angle">0</property>
+           </widget>
+           <packing>
+             <property name="left_attach">0</property>
+             <property name="right_attach">1</property>
+             <property name="top_attach">1</property>
+             <property name="bottom_attach">2</property>
+             <property name="x_options">fill</property>
+             <property name="y_options"></property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkLabel" id="lblID">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes"></property>
+             <property name="use_underline">False</property>
+             <property name="use_markup">False</property>
+             <property name="justify">GTK_JUSTIFY_LEFT</property>
+             <property name="wrap">False</property>
+             <property name="selectable">False</property>
+             <property name="xalign">0</property>
+             <property name="yalign">0.5</property>
+             <property name="xpad">0</property>
+             <property name="ypad">0</property>
+             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+             <property name="width_chars">-1</property>
+             <property name="single_line_mode">False</property>
+             <property name="angle">0</property>
+           </widget>
+           <packing>
+             <property name="left_attach">1</property>
+             <property name="right_attach">2</property>
+             <property name="top_attach">0</property>
+             <property name="bottom_attach">1</property>
+             <property name="x_options">fill</property>
+             <property name="y_options"></property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkEntry" id="txtName">
+             <property name="visible">True</property>
+             <property name="can_focus">True</property>
+             <property name="editable">True</property>
+             <property name="visibility">True</property>
+             <property name="max_length">0</property>
+             <property name="text" translatable="yes"></property>
+             <property name="has_frame">True</property>
+             <property name="invisible_char">*</property>
+             <property name="activates_default">False</property>
+           </widget>
+           <packing>
+             <property name="left_attach">1</property>
+             <property name="right_attach">2</property>
+             <property name="top_attach">1</property>
+             <property name="bottom_attach">2</property>
+             <property name="y_options"></property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkLabel" id="label4">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes">GtkSpinButton (Integer) (age)</property>
+             <property name="use_underline">False</property>
+             <property name="use_markup">False</property>
+             <property name="justify">GTK_JUSTIFY_LEFT</property>
+             <property name="wrap">False</property>
+             <property name="selectable">False</property>
+             <property name="xalign">0</property>
+             <property name="yalign">0.5</property>
+             <property name="xpad">0</property>
+             <property name="ypad">0</property>
+             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+             <property name="width_chars">-1</property>
+             <property name="single_line_mode">False</property>
+             <property name="angle">0</property>
+           </widget>
+           <packing>
+             <property name="left_attach">0</property>
+             <property name="right_attach">1</property>
+             <property name="top_attach">2</property>
+             <property name="bottom_attach">3</property>
+             <property name="x_options">fill</property>
+             <property name="y_options"></property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkSpinButton" id="spnAge">
+             <property name="visible">True</property>
+             <property name="can_focus">True</property>
+             <property name="climb_rate">1</property>
+             <property name="digits">0</property>
+             <property name="numeric">False</property>
+             <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+             <property name="snap_to_ticks">False</property>
+             <property name="wrap">False</property>
+             <property name="adjustment">1 0 100 1 10 10</property>
+           </widget>
+           <packing>
+             <property name="left_attach">1</property>
+             <property name="right_attach">2</property>
+             <property name="top_attach">2</property>
+             <property name="bottom_attach">3</property>
+             <property name="y_options"></property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkLabel" id="label5">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes">GtkSpinButton (Float) (amount)</property>
+             <property name="use_underline">False</property>
+             <property name="use_markup">False</property>
+             <property name="justify">GTK_JUSTIFY_LEFT</property>
+             <property name="wrap">False</property>
+             <property name="selectable">False</property>
+             <property name="xalign">0</property>
+             <property name="yalign">0.5</property>
+             <property name="xpad">0</property>
+             <property name="ypad">0</property>
+             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+             <property name="width_chars">-1</property>
+             <property name="single_line_mode">False</property>
+             <property name="angle">0</property>
+           </widget>
+           <packing>
+             <property name="left_attach">0</property>
+             <property name="right_attach">1</property>
+             <property name="top_attach">3</property>
+             <property name="bottom_attach">4</property>
+             <property name="x_options">fill</property>
+             <property name="y_options"></property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkSpinButton" id="spnAmount">
+             <property name="visible">True</property>
+             <property name="can_focus">True</property>
+             <property name="climb_rate">1</property>
+             <property name="digits">2</property>
+             <property name="numeric">False</property>
+             <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+             <property name="snap_to_ticks">False</property>
+             <property name="wrap">False</property>
+             <property name="adjustment">1 0 100 1 10 10</property>
+           </widget>
+           <packing>
+             <property name="left_attach">1</property>
+             <property name="right_attach">2</property>
+             <property name="top_attach">3</property>
+             <property name="bottom_attach">4</property>
+             <property name="y_options"></property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkLabel" id="label6">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes">GtkComboBox</property>
+             <property name="use_underline">False</property>
+             <property name="use_markup">False</property>
+             <property name="justify">GTK_JUSTIFY_LEFT</property>
+             <property name="wrap">False</property>
+             <property name="selectable">False</property>
+             <property name="xalign">0</property>
+             <property name="yalign">0.5</property>
+             <property name="xpad">0</property>
+             <property name="ypad">0</property>
+             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+             <property name="width_chars">-1</property>
+             <property name="single_line_mode">False</property>
+             <property name="angle">0</property>
+           </widget>
+           <packing>
+             <property name="left_attach">0</property>
+             <property name="right_attach">1</property>
+             <property name="top_attach">4</property>
+             <property name="bottom_attach">5</property>
+             <property name="x_options">fill</property>
+             <property name="y_options"></property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkComboBox" id="cbNation">
+             <property name="visible">True</property>
+             <property name="add_tearoffs">False</property>
+             <property name="focus_on_click">True</property>
+           </widget>
+           <packing>
+             <property name="left_attach">1</property>
+             <property name="right_attach">2</property>
+             <property name="top_attach">4</property>
+             <property name="bottom_attach">5</property>
+             <property name="x_options">fill</property>
+             <property name="y_options">fill</property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkLabel" id="label8">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes">Label (?) (text)</property>
+             <property name="use_underline">False</property>
+             <property name="use_markup">False</property>
+             <property name="justify">GTK_JUSTIFY_LEFT</property>
+             <property name="wrap">False</property>
+             <property name="selectable">False</property>
+             <property name="xalign">0</property>
+             <property name="yalign">0.5</property>
+             <property name="xpad">0</property>
+             <property name="ypad">0</property>
+             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+             <property name="width_chars">-1</property>
+             <property name="single_line_mode">False</property>
+             <property name="angle">0</property>
+           </widget>
+           <packing>
+             <property name="left_attach">0</property>
+             <property name="right_attach">1</property>
+             <property name="top_attach">5</property>
+             <property name="bottom_attach">6</property>
+             <property name="x_options">fill</property>
+             <property name="y_options"></property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkLabel" id="lblText">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes"></property>
+             <property name="use_underline">False</property>
+             <property name="use_markup">False</property>
+             <property name="justify">GTK_JUSTIFY_LEFT</property>
+             <property name="wrap">False</property>
+             <property name="selectable">False</property>
+             <property name="xalign">0</property>
+             <property name="yalign">0.5</property>
+             <property name="xpad">0</property>
+             <property name="ypad">0</property>
+             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+             <property name="width_chars">-1</property>
+             <property name="single_line_mode">False</property>
+             <property name="angle">0</property>
+           </widget>
+           <packing>
+             <property name="left_attach">1</property>
+             <property name="right_attach">2</property>
+             <property name="top_attach">5</property>
+             <property name="bottom_attach">6</property>
+             <property name="x_options">fill</property>
+             <property name="y_options"></property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkLabel" id="label9">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes">GtkCheckButton (married)</property>
+             <property name="use_underline">False</property>
+             <property name="use_markup">False</property>
+             <property name="justify">GTK_JUSTIFY_LEFT</property>
+             <property name="wrap">False</property>
+             <property name="selectable">False</property>
+             <property name="xalign">0</property>
+             <property name="yalign">0.5</property>
+             <property name="xpad">0</property>
+             <property name="ypad">0</property>
+             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+             <property name="width_chars">-1</property>
+             <property name="single_line_mode">False</property>
+             <property name="angle">0</property>
+           </widget>
+           <packing>
+             <property name="left_attach">0</property>
+             <property name="right_attach">1</property>
+             <property name="top_attach">6</property>
+             <property name="bottom_attach">7</property>
+             <property name="x_options">fill</property>
+             <property name="y_options"></property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkCheckButton" id="chkMarried">
+             <property name="visible">True</property>
+             <property name="can_focus">True</property>
+             <property name="label" translatable="yes"></property>
+             <property name="use_underline">True</property>
+             <property name="relief">GTK_RELIEF_NORMAL</property>
+             <property name="focus_on_click">True</property>
+             <property name="active">False</property>
+             <property name="inconsistent">False</property>
+             <property name="draw_indicator">True</property>
+           </widget>
+           <packing>
+             <property name="left_attach">1</property>
+             <property name="right_attach">2</property>
+             <property name="top_attach">6</property>
+             <property name="bottom_attach">7</property>
+             <property name="x_options">fill</property>
+             <property name="y_options"></property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkLabel" id="label10">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes">GtkTextView (description)</property>
+             <property name="use_underline">False</property>
+             <property name="use_markup">False</property>
+             <property name="justify">GTK_JUSTIFY_LEFT</property>
+             <property name="wrap">False</property>
+             <property name="selectable">False</property>
+             <property name="xalign">0</property>
+             <property name="yalign">0.5</property>
+             <property name="xpad">0</property>
+             <property name="ypad">0</property>
+             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+             <property name="width_chars">-1</property>
+             <property name="single_line_mode">False</property>
+             <property name="angle">0</property>
+           </widget>
+           <packing>
+             <property name="left_attach">0</property>
+             <property name="right_attach">1</property>
+             <property name="top_attach">7</property>
+             <property name="bottom_attach">8</property>
+             <property name="x_options">fill</property>
+             <property name="y_options"></property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkScrolledWindow" id="scrolledwindow2">
+             <property name="visible">True</property>
+             <property name="can_focus">True</property>
+             <property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property>
+             <property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>
+             <property name="shadow_type">GTK_SHADOW_NONE</property>
+             <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+             <child>
+               <widget class="GtkTextView" id="txtvDescription">
+                 <property name="visible">True</property>
+                 <property name="can_focus">True</property>
+                 <property name="editable">True</property>
+                 <property name="overwrite">False</property>
+                 <property name="accepts_tab">True</property>
+                 <property name="justification">GTK_JUSTIFY_LEFT</property>
+                 <property name="wrap_mode">GTK_WRAP_NONE</property>
+                 <property name="cursor_visible">True</property>
+                 <property name="pixels_above_lines">0</property>
+                 <property name="pixels_below_lines">0</property>
+                 <property name="pixels_inside_wrap">0</property>
+                 <property name="left_margin">0</property>
+                 <property name="right_margin">0</property>
+                 <property name="indent">0</property>
+                 <property name="text" translatable="yes"></property>
+               </widget>
+             </child>
+           </widget>
+           <packing>
+             <property name="left_attach">1</property>
+             <property name="right_attach">2</property>
+             <property name="top_attach">7</property>
+             <property name="bottom_attach">8</property>
+             <property name="x_options">fill</property>
+             <property name="y_options">fill</property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkLabel" id="label11">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes">Label (DateTime) (now)</property>
+             <property name="use_underline">False</property>
+             <property name="use_markup">False</property>
+             <property name="justify">GTK_JUSTIFY_LEFT</property>
+             <property name="wrap">False</property>
+             <property name="selectable">False</property>
+             <property name="xalign">0</property>
+             <property name="yalign">0.5</property>
+             <property name="xpad">0</property>
+             <property name="ypad">0</property>
+             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+             <property name="width_chars">-1</property>
+             <property name="single_line_mode">False</property>
+             <property name="angle">0</property>
+           </widget>
+           <packing>
+             <property name="left_attach">0</property>
+             <property name="right_attach">1</property>
+             <property name="top_attach">8</property>
+             <property name="bottom_attach">9</property>
+             <property name="x_options">fill</property>
+             <property name="y_options"></property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkLabel" id="lblDateTime">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes"></property>
+             <property name="use_underline">False</property>
+             <property name="use_markup">False</property>
+             <property name="justify">GTK_JUSTIFY_LEFT</property>
+             <property name="wrap">False</property>
+             <property name="selectable">False</property>
+             <property name="xalign">0</property>
+             <property name="yalign">0.5</property>
+             <property name="xpad">0</property>
+             <property name="ypad">0</property>
+             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+             <property name="width_chars">-1</property>
+             <property name="single_line_mode">False</property>
+             <property name="angle">0</property>
+           </widget>
+           <packing>
+             <property name="left_attach">1</property>
+             <property name="right_attach">2</property>
+             <property name="top_attach">8</property>
+             <property name="bottom_attach">9</property>
+             <property name="x_options">fill</property>
+             <property name="y_options"></property>
+           </packing>
+         </child>
+       </widget>
+       <packing>
+         <property name="padding">0</property>
+         <property name="expand">False</property>
+         <property name="fill">True</property>
+       </packing>
+      </child>
+
+      <child>
+       <widget class="GtkHButtonBox" id="hbuttonbox1">
+         <property name="visible">True</property>
+         <property name="layout_style">GTK_BUTTONBOX_DEFAULT_STYLE</property>
+         <property name="spacing">0</property>
+
+         <child>
+           <widget class="GtkButton" id="btnClear">
+             <property name="visible">True</property>
+             <property name="can_default">True</property>
+             <property name="can_focus">True</property>
+             <property name="label">gtk-clear</property>
+             <property name="use_stock">True</property>
+             <property name="relief">GTK_RELIEF_NORMAL</property>
+             <property name="focus_on_click">True</property>
+             <signal name="clicked" handler="on_btnClear_clicked" last_modification_time="Mon, 05 Dec 2005 12:14:22 GMT"/>
+           </widget>
+         </child>
+
+         <child>
+           <widget class="GtkButton" id="btnCheck">
+             <property name="visible">True</property>
+             <property name="can_default">True</property>
+             <property name="can_focus">True</property>
+             <property name="label" translatable="yes">Check Form</property>
+             <property name="use_underline">True</property>
+             <property name="relief">GTK_RELIEF_NORMAL</property>
+             <property name="focus_on_click">True</property>
+             <signal name="clicked" handler="on_btnCheck_clicked" last_modification_time="Sat, 02 Sep 2006 08:07:32 GMT"/>
+           </widget>
+         </child>
+       </widget>
+       <packing>
+         <property name="padding">0</property>
+         <property name="expand">False</property>
+         <property name="fill">True</property>
+       </packing>
+      </child>
+
+      <child>
+       <widget class="GtkHButtonBox" id="hbuttonbox2">
+         <property name="visible">True</property>
+         <property name="layout_style">GTK_BUTTONBOX_DEFAULT_STYLE</property>
+         <property name="spacing">0</property>
+
+         <child>
+           <widget class="GtkButton" id="btnSqlUpdate">
+             <property name="visible">True</property>
+             <property name="can_default">True</property>
+             <property name="can_focus">True</property>
+             <property name="label" translatable="yes">Sql _UPDATE</property>
+             <property name="use_underline">True</property>
+             <property name="relief">GTK_RELIEF_NORMAL</property>
+             <property name="focus_on_click">True</property>
+             <signal name="clicked" handler="on_btnSqlUpdate_clicked" last_modification_time="Mon, 05 Dec 2005 14:46:11 GMT"/>
+           </widget>
+         </child>
+
+         <child>
+           <widget class="GtkButton" id="btnSqlInsert">
+             <property name="visible">True</property>
+             <property name="can_default">True</property>
+             <property name="can_focus">True</property>
+             <property name="label" translatable="yes">Sql _INSERT INTO</property>
+             <property name="use_underline">True</property>
+             <property name="relief">GTK_RELIEF_NORMAL</property>
+             <property name="focus_on_click">True</property>
+             <signal name="clicked" handler="on_btnSqlInsert_clicked" last_modification_time="Mon, 05 Dec 2005 14:46:17 GMT"/>
+           </widget>
+         </child>
+
+         <child>
+           <widget class="GtkButton" id="btnSqlDelete">
+             <property name="visible">True</property>
+             <property name="can_default">True</property>
+             <property name="can_focus">True</property>
+             <property name="label" translatable="yes">Sql _DELETE</property>
+             <property name="use_underline">True</property>
+             <property name="relief">GTK_RELIEF_NORMAL</property>
+             <property name="focus_on_click">True</property>
+             <signal name="clicked" handler="on_btnSqlDelete_clicked" last_modification_time="Mon, 05 Dec 2005 14:46:22 GMT"/>
+           </widget>
+         </child>
+
+         <child>
+           <widget class="GtkButton" id="btnSqlSelect">
+             <property name="visible">True</property>
+             <property name="can_default">True</property>
+             <property name="can_focus">True</property>
+             <property name="label" translatable="yes">Sql _SELECT</property>
+             <property name="use_underline">True</property>
+             <property name="relief">GTK_RELIEF_NORMAL</property>
+             <property name="focus_on_click">True</property>
+             <signal name="clicked" handler="on_btnSqlSelect_clicked" last_modification_time="Mon, 05 Dec 2005 15:28:58 GMT"/>
+           </widget>
+         </child>
+       </widget>
+       <packing>
+         <property name="padding">0</property>
+         <property name="expand">False</property>
+         <property name="fill">True</property>
+       </packing>
+      </child>
+
+      <child>
+       <widget class="GtkTable" id="table2">
+         <property name="visible">True</property>
+         <property name="n_rows">1</property>
+         <property name="n_columns">2</property>
+         <property name="homogeneous">False</property>
+         <property name="row_spacing">0</property>
+         <property name="column_spacing">0</property>
+
+         <child>
+           <widget class="GtkLabel" id="label7">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes">SQL</property>
+             <property name="use_underline">False</property>
+             <property name="use_markup">False</property>
+             <property name="justify">GTK_JUSTIFY_LEFT</property>
+             <property name="wrap">False</property>
+             <property name="selectable">False</property>
+             <property name="xalign">0</property>
+             <property name="yalign">0.5</property>
+             <property name="xpad">0</property>
+             <property name="ypad">0</property>
+             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+             <property name="width_chars">-1</property>
+             <property name="single_line_mode">False</property>
+             <property name="angle">0</property>
+           </widget>
+           <packing>
+             <property name="left_attach">0</property>
+             <property name="right_attach">1</property>
+             <property name="top_attach">0</property>
+             <property name="bottom_attach">1</property>
+             <property name="x_options">fill</property>
+             <property name="y_options"></property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkScrolledWindow" id="scrolledwindow1">
+             <property name="visible">True</property>
+             <property name="can_focus">True</property>
+             <property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property>
+             <property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>
+             <property name="shadow_type">GTK_SHADOW_IN</property>
+             <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+             <child>
+               <widget class="GtkTextView" id="txtvSql">
+                 <property name="visible">True</property>
+                 <property name="can_focus">True</property>
+                 <property name="editable">True</property>
+                 <property name="overwrite">False</property>
+                 <property name="accepts_tab">True</property>
+                 <property name="justification">GTK_JUSTIFY_LEFT</property>
+                 <property name="wrap_mode">GTK_WRAP_NONE</property>
+                 <property name="cursor_visible">True</property>
+                 <property name="pixels_above_lines">0</property>
+                 <property name="pixels_below_lines">0</property>
+                 <property name="pixels_inside_wrap">0</property>
+                 <property name="left_margin">0</property>
+                 <property name="right_margin">0</property>
+                 <property name="indent">0</property>
+                 <property name="text" translatable="yes"></property>
+               </widget>
+             </child>
+           </widget>
+           <packing>
+             <property name="left_attach">1</property>
+             <property name="right_attach">2</property>
+             <property name="top_attach">0</property>
+             <property name="bottom_attach">1</property>
+           </packing>
+         </child>
+       </widget>
+       <packing>
+         <property name="padding">0</property>
+         <property name="expand">True</property>
+         <property name="fill">True</property>
+       </packing>
+      </child>
+    </widget>
+  </child>
+</widget>
+
+</glade-interface>