<!ELEMENT table (#PCDATA)>
-<!ELEMENT widget (column-field?, field?)>
+<!ELEMENT widget (column-field?, return-value?, field?)>
<!ATTLIST widget
- type (checkbox | combobox | entry | label | spin | textview) #REQUIRED
+ type (checkbox | combobox | entry | label | radio | spin | textview) #REQUIRED
name CDATA #REQUIRED
label CDATA #IMPLIED
>
<!ELEMENT column-field (#PCDATA)>
+<!ELEMENT return-value (#PCDATA)>
+
<!ELEMENT field (no-save?, obligatory?, default?, is-key?, type?, display-format?)>
<!ATTLIST field
gtk_form_add_fields
gtk_form_get_form_field_from_name
gtk_form_get_form_widget_from_name
+gtk_form_get_form_field_from_widget
+gtk_form_get_form_widget_from_widget
gtk_form_get_widgets
gtk_form_get_objects_by_name
gtk_form_clear
gtk_form_widget_entry_set_editable
</SECTION>
+<SECTION>
+<FILE>widgetradio</FILE>
+TYPE_GTK_FORM_WIDGET_RADIO
+GTK_FORM_WIDGET_RADIO
+GTK_FORM_WIDGET_RADIO_CLASS
+IS_GTK_FORM_WIDGET_RADIO
+IS_GTK_FORM_WIDGET_RADIO_CLASS
+GTK_FORM_WIDGET_RADIO_GET_CLASS
+<TITLE>GtkFormWidgetRadio</TITLE>
+GtkFormWidgetRadio
+gtk_form_widget_radio_get_type
+gtk_form_widget_radio_new
+gtk_form_widget_radio_get_value_stringify
+gtk_form_widget_radio_set_value_stringify
+gtk_form_widget_radio_set_editable
+gtk_form_widget_radio_set_return_value
+gtk_form_widget_radio_get_return_value
+</SECTION>
+
<SECTION>
<FILE>fieldinteger</FILE>
TYPE_GTK_FORM_FIELD_INTEGER
GtkForm *form, const gchar *widget_name
</FUNCTION>
<FUNCTION>
+<NAME>gtk_form_get_form_field_from_widget</NAME>
+<RETURNS>GtkFormField *</RETURNS>
+GtkForm *form, GtkWidget *widget
+</FUNCTION>
+<FUNCTION>
+<NAME>gtk_form_get_form_widget_from_widget</NAME>
+<RETURNS>GtkFormWidget *</RETURNS>
+GtkForm *form, GtkWidget *widget
+</FUNCTION>
+<FUNCTION>
<NAME>gtk_form_get_widgets</NAME>
<RETURNS>GtkWidget **</RETURNS>
GtkForm *form
GtkFormWidget *fwidget, gboolean editable
</FUNCTION>
<MACRO>
+<NAME>TYPE_GTK_FORM_WIDGET_RADIO</NAME>
+#define TYPE_GTK_FORM_WIDGET_RADIO (gtk_form_widget_radio_get_type ())
+</MACRO>
+<MACRO>
+<NAME>GTK_FORM_WIDGET_RADIO</NAME>
+#define GTK_FORM_WIDGET_RADIO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_GTK_FORM_WIDGET_RADIO, GtkFormWidgetRadio))
+</MACRO>
+<MACRO>
+<NAME>GTK_FORM_WIDGET_RADIO_CLASS</NAME>
+#define GTK_FORM_WIDGET_RADIO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_GTK_FORM_WIDGET_RADIO, GtkFormWidgetRadioClass))
+</MACRO>
+<MACRO>
+<NAME>IS_GTK_FORM_WIDGET_RADIO</NAME>
+#define IS_GTK_FORM_WIDGET_RADIO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_GTK_FORM_WIDGET_RADIO))
+</MACRO>
+<MACRO>
+<NAME>IS_GTK_FORM_WIDGET_RADIO_CLASS</NAME>
+#define IS_GTK_FORM_WIDGET_RADIO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_GTK_FORM_WIDGET_RADIO))
+</MACRO>
+<MACRO>
+<NAME>GTK_FORM_WIDGET_RADIO_GET_CLASS</NAME>
+#define GTK_FORM_WIDGET_RADIO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_GTK_FORM_WIDGET_RADIO, GtkFormWidgetRadioClass))
+</MACRO>
+<STRUCT>
+<NAME>GtkFormWidgetRadio</NAME>
+</STRUCT>
+<STRUCT>
+<NAME>GtkFormWidgetRadioClass</NAME>
+</STRUCT>
+<STRUCT>
+<NAME>GtkFormWidgetRadio</NAME>
+struct _GtkFormWidgetRadio
+ {
+ GtkFormWidget parent;
+ };
+</STRUCT>
+<STRUCT>
+<NAME>GtkFormWidgetRadioClass</NAME>
+struct _GtkFormWidgetRadioClass
+ {
+ GtkFormWidgetClass parent_class;
+ };
+</STRUCT>
+<FUNCTION>
+<NAME>gtk_form_widget_radio_get_type</NAME>
+<RETURNS>GType </RETURNS>
+void
+</FUNCTION>
+<FUNCTION>
+<NAME>gtk_form_widget_radio_new</NAME>
+<RETURNS>GtkFormWidget *</RETURNS>
+void
+</FUNCTION>
+<FUNCTION>
+<NAME>gtk_form_widget_radio_get_value_stringify</NAME>
+<RETURNS>gchar *</RETURNS>
+GtkFormWidget *widget
+</FUNCTION>
+<FUNCTION>
+<NAME>gtk_form_widget_radio_set_value_stringify</NAME>
+<RETURNS>gboolean </RETURNS>
+GtkFormWidget *fwidget, const gchar *value
+</FUNCTION>
+<FUNCTION>
+<NAME>gtk_form_widget_radio_set_editable</NAME>
+<RETURNS>void </RETURNS>
+GtkFormWidget *fwidget, gboolean editable
+</FUNCTION>
+<FUNCTION>
+<NAME>gtk_form_widget_radio_set_return_value</NAME>
+<RETURNS>void </RETURNS>
+GtkFormWidgetRadio *fwidget, const gchar *value
+</FUNCTION>
+<FUNCTION>
+<NAME>gtk_form_widget_radio_get_return_value</NAME>
+<RETURNS>gchar *</RETURNS>
+GtkFormWidgetRadio *fwidget
+</FUNCTION>
+<MACRO>
<NAME>TYPE_GTK_FORM_FIELD_INTEGER</NAME>
#define TYPE_GTK_FORM_FIELD_INTEGER (gtk_form_field_integer_get_type ())
</MACRO>
7% symbol docs coverage.
22 symbols documented.
1 symbols incomplete.
-277 not documented.
+285 not documented.
GTK_FORM
gtk_form_fill_from_datamodel
gtk_form_get_field_from_name
gtk_form_get_form_field_from_name
+gtk_form_get_form_field_from_widget
gtk_form_get_form_widget_from_name
+gtk_form_get_form_widget_from_widget
gtk_form_get_gtkbuilder
gtk_form_get_key
gtk_form_get_objects
gtk_form_widget_label_new
gtk_form_widget_label_set_value_stringify
gtk_form_widget_new
+gtk_form_widget_radio_get_return_value
+gtk_form_widget_radio_get_value_stringify
+gtk_form_widget_radio_new
+gtk_form_widget_radio_set_editable
+gtk_form_widget_radio_set_return_value
+gtk_form_widget_radio_set_value_stringify
gtk_form_widget_set_editable
gtk_form_widget_set_from_gtkbuilder
gtk_form_widget_set_label
+GTK_FORM_WIDGET_RADIO
+GTK_FORM_WIDGET_RADIO_CLASS
+GTK_FORM_WIDGET_RADIO_GET_CLASS
GtkFormClass
GtkFormFieldBooleanClass
GtkFormFieldClass
GtkFormWidgetComboBoxClass
GtkFormWidgetEntryClass
GtkFormWidgetLabelClass
+GtkFormWidgetRadio
+GtkFormWidgetRadioClass
GtkFormWidgetSpinClass
GtkFormWidgetTextviewClass
+IS_GTK_FORM_WIDGET_RADIO
+IS_GTK_FORM_WIDGET_RADIO_CLASS
+TYPE_GTK_FORM_WIDGET_RADIO
gtk_form_field_boolean_set_as_origin
gtk_form_field_boolean_str_to_boolean
gtk_form_field_datetime_get_gdate_from_tm
gtk_form_field_text_set_as_origin
gtk_form_filed_boolean_is_changed
gtk_form_get_form_field_from_name
+gtk_form_get_form_field_from_widget
gtk_form_get_form_widget_from_name
+gtk_form_get_form_widget_from_widget
gtk_form_get_gtkbuilder
gtk_form_get_key
gtk_form_get_objects_by_name
gtk_form_set_sensitive_by_name
gtk_form_set_table
gtk_form_widget_get_label
+gtk_form_widget_radio_get_return_value
+gtk_form_widget_radio_get_type
+gtk_form_widget_radio_get_value_stringify
+gtk_form_widget_radio_new
+gtk_form_widget_radio_set_editable
+gtk_form_widget_radio_set_return_value
+gtk_form_widget_radio_set_value_stringify
gtk_form_widget_set_label
-gtk_form_widget_spin_get_type
-gtk_form_widget_check_get_type
+gtk_form_get_type
+gtk_form_field_get_type
gtk_form_field_boolean_get_type
-gtk_form_widget_get_type
-gtk_form_field_text_get_type
gtk_form_field_datetime_get_type
-gtk_form_widget_label_get_type
gtk_form_field_float_get_type
+gtk_form_field_integer_get_type
+gtk_form_field_text_get_type
gtk_form_key_get_type
+gtk_form_widget_get_type
+gtk_form_widget_check_get_type
+gtk_form_widget_entry_get_type
+gtk_form_widget_label_get_type
+gtk_form_widget_radio_get_type
+gtk_form_widget_spin_get_type
gtk_form_widget_textview_get_type
-gtk_form_field_get_type
-gtk_form_get_type
gtk_form_widget_combo_box_get_type
-gtk_form_widget_entry_get_type
-gtk_form_field_integer_get_type
+
widgetcombobox.c \
widgetentry.c \
widgetlabel.c \
+ widgetradio.c \
widgetspin.c \
widgettextview.c
widgetcombobox.h \
widgetentry.h \
widgetlabel.h \
+ widgetradio.h \
widgetspin.h \
widgettextview.h
#include "widgetcombobox.h"
#include "widgetentry.h"
#include "widgetlabel.h"
+#include "widgetradio.h"
#include "widgetspin.h"
#include "widgettextview.h"
{
widget = gtk_form_widget_label_new ();
}
+ else if (g_strcmp0 (type, "radio") == 0)
+ {
+ widget = gtk_form_widget_radio_new ();
+ }
else if (g_strcmp0 (type, "spin") == 0)
{
widget = gtk_form_widget_spin_new ();
{
widget = gtk_form_widget_textview_new ();
}
+ else
+ {
+ g_warning (_("Unknown type «%s»."), type);
+ }
if (widget != NULL)
{
{
gtk_form_widget_set_label (widget, wlabel);
}
- else if (g_strcmp0 (type, "checkbox") == 0
+ else if ((g_strcmp0 (type, "checkbox") == 0
+ || g_strcmp0 (type, "radio") == 0)
&& g_strcmp0 (label, name) == 0)
{
gtk_form_widget_set_label (widget, wlabel);
g_object_set (G_OBJECT (widget), "column-field",
strtol ((gchar *)xmlNodeGetContent (node_widget), NULL, 10), NULL);
}
+ else if (xmlStrcmp (node_widget->name, (const xmlChar *)"return-value") == 0
+ && IS_GTK_FORM_WIDGET_RADIO (widget))
+ {
+ g_object_set (G_OBJECT (widget), "return-value",
+ xmlNodeGetContent (node_widget), NULL);
+ }
else if (xmlStrcmp (node_widget->name, (const xmlChar *)"field") == 0)
{
field = NULL;
GtkFormPrivate *priv;
g_return_val_if_fail (IS_GTK_FORM (form), NULL);
+ g_return_val_if_fail (field_name != NULL, NULL);
priv = GTK_FORM_GET_PRIVATE (form);
return widget_ret;
}
+/**
+ * gtk_form_get_form_field_from_widget:
+ * @form: a #GtkForm object.
+ * @widget: a #GtkWidget object.
+ *
+ */
+GtkFormField
+*gtk_form_get_form_field_from_widget (GtkForm *form, GtkWidget *widget)
+{
+ GtkFormWidget *fwidget = NULL;
+ GtkFormField *field = NULL;
+ GtkFormWidget *widget_ret = NULL;
+ GtkFormPrivate *priv;
+
+ g_return_val_if_fail (IS_GTK_FORM (form), NULL);
+ g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
+
+ priv = GTK_FORM_GET_PRIVATE (form);
+
+ GSList *fields = priv->fields;
+ while (fields != NULL)
+ {
+ fwidget = gtk_form_field_get_form_widget ((GtkFormField *)fields->data);
+
+ if (gtk_form_widget_get_widget (fwidget) == widget)
+ {
+ field = (GtkFormField *)fields->data;
+ break;
+ }
+
+ fields = g_slist_next (fields);
+ }
+
+ return field;
+}
+
+/**
+ * gtk_form_get_form_widget_from_widget:
+ * @form: a #GtkForm object.
+ * @widget: a #GtkWidget object.
+ *
+ */
+GtkFormWidget
+*gtk_form_get_form_widget_from_widget (GtkForm *form, GtkWidget *widget)
+{
+ GtkFormWidget *fwidget = NULL;
+ GtkFormWidget *widget_ret = NULL;
+ GtkFormPrivate *priv;
+
+ g_return_val_if_fail (IS_GTK_FORM (form), NULL);
+ g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
+
+ priv = GTK_FORM_GET_PRIVATE (form);
+
+ GSList *fields = priv->fields;
+ while (fields != NULL)
+ {
+ fwidget = gtk_form_field_get_form_widget ((GtkFormField *)fields->data);
+
+ if (gtk_form_widget_get_widget (fwidget) == widget)
+ {
+ widget_ret = fwidget;
+ break;
+ }
+
+ fields = g_slist_next (fields);
+ }
+
+ return widget_ret;
+}
+
/**
* gtk_form_get_objects:
* @form: a #GtkForm object.
GtkFormField *gtk_form_get_form_field_from_name (GtkForm *form, const gchar *field_name);
GtkFormWidget *gtk_form_get_form_widget_from_name (GtkForm *form, const gchar *widget_name);
+GtkFormField *gtk_form_get_form_field_from_widget (GtkForm *form, GtkWidget *widget);
+GtkFormWidget *gtk_form_get_form_widget_from_widget (GtkForm *form, GtkWidget *widget);
+
GtkWidget **gtk_form_get_widgets (GtkForm *form);
GObject **gtk_form_get_objects_by_name (GtkForm *form, ...);
--- /dev/null
+/*
+ * Copyright (C) 2005-2010 Andrea Zagli <azagli@libero.it>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <string.h>
+
+#include <gtk/gtk.h>
+
+#include "widgetradio.h"
+
+enum
+{
+ PROP_0,
+ PROP_RETURN_VALUE
+};
+
+static void gtk_form_widget_radio_class_init (GtkFormWidgetRadioClass *klass);
+static void gtk_form_widget_radio_init (GtkFormWidgetRadio *gtk_form_widget_radio);
+
+static void gtk_form_widget_radio_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void gtk_form_widget_radio_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
+
+static gboolean check_value (const gchar *value);
+
+#define GTK_FORM_WIDGET_RADIO_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_GTK_FORM_WIDGET_RADIO, GtkFormWidgetRadioPrivate))
+
+typedef struct _GtkFormWidgetRadioPrivate GtkFormWidgetRadioPrivate;
+struct _GtkFormWidgetRadioPrivate
+ {
+ gchar *value;
+ };
+
+
+G_DEFINE_TYPE (GtkFormWidgetRadio, gtk_form_widget_radio, TYPE_GTK_FORM_WIDGET)
+
+static void
+gtk_form_widget_radio_class_init (GtkFormWidgetRadioClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GtkFormWidgetClass *widget_class = GTK_FORM_WIDGET_CLASS (klass);
+
+ object_class->set_property = gtk_form_widget_radio_set_property;
+ object_class->get_property = gtk_form_widget_radio_get_property;
+
+ widget_class->get_value_stringify = gtk_form_widget_radio_get_value_stringify;
+ widget_class->set_value_stringify = gtk_form_widget_radio_set_value_stringify;
+ widget_class->set_editable = gtk_form_widget_radio_set_editable;
+
+ g_object_class_install_property (object_class, PROP_RETURN_VALUE,
+ g_param_spec_string ("return-value",
+ "Return value",
+ "Return value",
+ "",
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+
+ g_type_class_add_private (object_class, sizeof (GtkFormWidgetRadioPrivate));
+}
+
+static void
+gtk_form_widget_radio_init (GtkFormWidgetRadio *gtk_form_widget_radio)
+{
+}
+
+/**
+ * gtk_form_widget_radio_new:
+ *
+ * Returns: the newly created #GtkFormWidgetRadio.
+ */
+GtkFormWidget
+*gtk_form_widget_radio_new ()
+{
+ return g_object_new (TYPE_GTK_FORM_WIDGET_RADIO, NULL);
+}
+
+/**
+ * gtk_form_widget_radio_get_value_stringify:
+ * @widget:
+ *
+ */
+gchar
+*gtk_form_widget_radio_get_value_stringify (GtkFormWidget *fwidget)
+{
+ GSList *group;
+ GtkWidget *w;
+ gchar *ret;
+ GtkFormWidgetRadioPrivate *priv;
+
+ g_return_val_if_fail (IS_GTK_FORM_WIDGET_RADIO (fwidget), "");
+
+ priv = GTK_FORM_WIDGET_RADIO_GET_PRIVATE (fwidget);
+
+ w = gtk_form_widget_get_widget (fwidget);
+
+ ret = g_strdup ("");
+
+ /* always returns the value of the group's active radio button */
+ group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (w));
+ while (group != NULL)
+ {
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (group->data)))
+ {
+ ret = g_strdup ((const gchar*)g_object_get_data (G_OBJECT (group->data), "return-value"));
+ if (ret == NULL)
+ {
+ ret = g_strdup ("");
+ }
+ break;
+ }
+
+ group = g_slist_next (group);
+ }
+
+ return ret;
+}
+
+/**
+ * gtk_form_widget_radio_set_value_stringify:
+ * @fwidget:
+ * @value:
+ *
+ */
+gboolean
+gtk_form_widget_radio_set_value_stringify (GtkFormWidget *fwidget, const gchar *value)
+{
+ gboolean ret = FALSE;
+ GtkWidget *w;
+ gboolean active;
+
+ g_return_val_if_fail (IS_GTK_FORM_WIDGET_RADIO (fwidget), FALSE);
+
+ 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;
+}
+
+/**
+ * gtk_form_widget_radio_set_editable:
+ * @fwidget: a #GtkFormWidget object.
+ * @editable:
+ *
+ */
+void
+gtk_form_widget_radio_set_editable (GtkFormWidget *fwidget, gboolean editable)
+{
+ GtkWidget *w;
+
+ g_return_if_fail (IS_GTK_FORM_WIDGET_RADIO (fwidget));
+
+ g_object_get (G_OBJECT (fwidget),
+ "widget", &w,
+ NULL);
+
+ gtk_widget_set_sensitive (w, editable);
+}
+
+/**
+ * gtk_form_widget_radio_set_return_value:
+ * @fwidget: a #GtkFormWidgetRadio object.
+ * @value:
+ *
+ */
+void
+gtk_form_widget_radio_set_return_value (GtkFormWidgetRadio *fwidget, const gchar *value)
+{
+ GtkFormWidgetRadioPrivate *priv;
+ GtkWidget *widget;
+
+ g_return_if_fail (IS_GTK_FORM_WIDGET_RADIO (fwidget));
+
+ priv = GTK_FORM_WIDGET_RADIO_GET_PRIVATE (fwidget);
+
+ if (value == NULL)
+ {
+ priv->value = g_strdup ("");
+ }
+ else
+ {
+ priv->value = g_strdup (value);
+ }
+
+ widget = gtk_form_widget_get_widget (GTK_FORM_WIDGET (fwidget));
+ if (GTK_IS_WIDGET (widget))
+ {
+ g_object_set_data (G_OBJECT (widget), "return-value", (gpointer)priv->value);
+ }
+}
+
+/**
+ * gtk_form_widget_radio_get_return_value:
+ * @fwidget: a #GtkFormWidgetRadio object.
+ *
+ */
+gchar
+*gtk_form_widget_radio_get_return_value (GtkFormWidgetRadio *fwidget)
+{
+ GtkFormWidgetRadioPrivate *priv;
+
+ g_return_val_if_fail (IS_GTK_FORM_WIDGET_RADIO (fwidget), NULL);
+
+ priv = GTK_FORM_WIDGET_RADIO_GET_PRIVATE (fwidget);
+
+ return g_strdup (priv->value);
+}
+
+/* PRIVATE */
+static void
+gtk_form_widget_radio_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GtkFormWidgetRadio *widget_radio = (GtkFormWidgetRadio *)object;
+
+ GtkFormWidgetRadioPrivate *priv = GTK_FORM_WIDGET_RADIO_GET_PRIVATE (widget_radio);
+
+ switch (property_id)
+ {
+ case PROP_RETURN_VALUE:
+ gtk_form_widget_radio_set_return_value (widget_radio, g_value_get_string (value));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gtk_form_widget_radio_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GtkFormWidgetRadio *widget_radio = (GtkFormWidgetRadio *)object;
+
+ GtkFormWidgetRadioPrivate *priv = GTK_FORM_WIDGET_RADIO_GET_PRIVATE (widget_radio);
+
+ switch (property_id)
+ {
+ case PROP_RETURN_VALUE:
+ g_value_set_string (value, gtk_form_widget_radio_get_return_value (widget_radio));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static gboolean
+check_value (const gchar *value)
+{
+ gchar *str_value;
+ gboolean active;
+
+ 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;
+}
--- /dev/null
+/*
+ * Copyright (C) 2005-2010 Andrea Zagli <azagli@libero.it>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef __LIBGTK_FORM_WIDGET_RADIO_H__
+#define __LIBGTK_FORM_WIDGET_RADIO_H__
+
+#include "widget.h"
+
+
+G_BEGIN_DECLS
+
+
+#define TYPE_GTK_FORM_WIDGET_RADIO (gtk_form_widget_radio_get_type ())
+#define GTK_FORM_WIDGET_RADIO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_GTK_FORM_WIDGET_RADIO, GtkFormWidgetRadio))
+#define GTK_FORM_WIDGET_RADIO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_GTK_FORM_WIDGET_RADIO, GtkFormWidgetRadioClass))
+#define IS_GTK_FORM_WIDGET_RADIO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_GTK_FORM_WIDGET_RADIO))
+#define IS_GTK_FORM_WIDGET_RADIO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_GTK_FORM_WIDGET_RADIO))
+#define GTK_FORM_WIDGET_RADIO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_GTK_FORM_WIDGET_RADIO, GtkFormWidgetRadioClass))
+
+
+typedef struct _GtkFormWidgetRadio GtkFormWidgetRadio;
+typedef struct _GtkFormWidgetRadioClass GtkFormWidgetRadioClass;
+
+struct _GtkFormWidgetRadio
+ {
+ GtkFormWidget parent;
+ };
+
+struct _GtkFormWidgetRadioClass
+ {
+ GtkFormWidgetClass parent_class;
+ };
+
+GType gtk_form_widget_radio_get_type (void) G_GNUC_CONST;
+
+GtkFormWidget *gtk_form_widget_radio_new (void);
+
+gchar *gtk_form_widget_radio_get_value_stringify (GtkFormWidget *widget);
+
+gboolean gtk_form_widget_radio_set_value_stringify (GtkFormWidget *fwidget, const gchar *value);
+
+void gtk_form_widget_radio_set_editable (GtkFormWidget *fwidget, gboolean editable);
+
+void gtk_form_widget_radio_set_return_value (GtkFormWidgetRadio *fwidget, const gchar *value);
+gchar *gtk_form_widget_radio_get_return_value (GtkFormWidgetRadio *fwidget);
+
+
+G_END_DECLS
+
+
+#endif /* __LIBGTK_FORM_WIDGET_RADIO_H__ */
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="border_width">3</property>
+ <property name="orientation">vertical</property>
<child>
<object class="GtkTable" id="table1">
<property name="visible">True</property>
<object class="GtkScrolledWindow" id="scrolledwindow2">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="shadow_type">etched-in</property>
<child>
<object class="GtkTextView" id="txtvDescription">
<property name="visible">True</property>
</packing>
</child>
<child>
- <placeholder/>
+ <object class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Radio (sex)</property>
+ </object>
+ <packing>
+ <property name="top_attach">9</property>
+ <property name="bottom_attach">10</property>
+ </packing>
</child>
<child>
- <placeholder/>
+ <object class="GtkHBox" id="hbox2">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkRadioButton" id="rbtnNone">
+ <property name="label" translatable="yes">None</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkRadioButton" id="rbtnMale">
+ <property name="label" translatable="yes">Male</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">rbtnNone</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkRadioButton" id="rbtnFemale">
+ <property name="label" translatable="yes">Female</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">rbtnNone</property>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">9</property>
+ <property name="bottom_attach">10</property>
+ </packing>
</child>
</object>
<packing>
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="shadow_type">in</property>
+ <property name="shadow_type">etched-in</property>
<child>
<object class="GtkTextView" id="txtvSql">
<property name="visible">True</property>
</field>
</widget>
+ <widget type="radio" name="rbtnNone">
+ <return-value />
+ <field type="text" name="sex">
+ </field>
+ </widget>
+
+ <widget type="radio" name="rbtnMale">
+ <return-value>M</return-value>
+ <field type="text" name="sex">
+ </field>
+ </widget>
+
+ <widget type="radio" name="rbtnFemale">
+ <return-value>F</return-value>
+ <field type="text" name="sex">
+ </field>
+ </widget>
+
</gtkform>