void
zak_form_element_set_as_original_value (ZakFormElement *element)
{
- zak_form_element_set_original_value_gvalue (element, zak_form_element_get_value_gvalue (element));
+ if (ZAK_FORM_ELEMENT_GET_CLASS (element)->set_as_original_value != NULL)
+ {
+ ZAK_FORM_ELEMENT_GET_CLASS (element)->set_as_original_value (element);
+ }
+ else
+ {
+ zak_form_element_set_original_value_gvalue (element, zak_form_element_get_value_gvalue (element));
+ }
}
/**
gboolean
zak_form_element_is_changed (ZakFormElement *element)
{
- return (g_strcmp0 (zak_form_element_get_original_value (element), zak_form_element_get_value (element)) != 0);
+ if (ZAK_FORM_ELEMENT_GET_CLASS (element)->is_changed != NULL)
+ {
+ return ZAK_FORM_ELEMENT_GET_CLASS (element)->is_changed (element);
+ }
+ else
+ {
+ return (g_strcmp0 (zak_form_element_get_original_value (element), zak_form_element_get_value (element)) != 0);
+ }
}
/**
priv = zak_form_element_get_instance_private (element);
- zak_form_element_set_value_gvalue (element, priv->default_value);
+ if (ZAK_FORM_ELEMENT_GET_CLASS (element)->clear != NULL)
+ {
+ ZAK_FORM_ELEMENT_GET_CLASS (element)->clear (element);
+ }
+ else
+ {
+ zak_form_element_set_value_gvalue (element, priv->default_value);
+ }
}
/**
ret = FALSE;
}
- value = zak_form_element_get_value (element);
-
- for (i = 0; i < priv->pa_validators->len; i++)
+ if (ZAK_FORM_ELEMENT_GET_CLASS (element)->is_valid != NULL)
+ {
+ ret = ZAK_FORM_ELEMENT_GET_CLASS (element)->is_valid (element);
+ }
+ else
{
- ZakFormElementValidator *validator = (ZakFormElementValidator *)g_ptr_array_index (priv->pa_validators, i);
- if (!zak_form_element_validator_validate (validator, value))
+ value = zak_form_element_get_value (element);
+
+ for (i = 0; i < priv->pa_validators->len; i++)
{
- g_ptr_array_add (priv->pa_messages, (gpointer)g_strdup (zak_form_element_validator_get_message (validator)));
+ ZakFormElementValidator *validator = (ZakFormElementValidator *)g_ptr_array_index (priv->pa_validators, i);
+ if (!zak_form_element_validator_validate (validator, value))
+ {
+ g_ptr_array_add (priv->pa_messages, (gpointer)g_strdup (zak_form_element_validator_get_message (validator)));
- ret = FALSE;
+ ret = FALSE;
+ }
}
}
gboolean (*set_value) (ZakFormElement *element, GValue *value);
GValue *(*get_value) (ZakFormElement *element);
+ void (*set_as_original_value) (ZakFormElement *element);
+ gboolean (*is_changed) (ZakFormElement *element);
+
void (*set_visible) (ZakFormElement *element, gboolean visible);
gboolean (*get_visible) (ZakFormElement *element);
void (*set_editable) (ZakFormElement *element, gboolean editable);
gboolean (*get_editable) (ZakFormElement *element);
+ void (*clear) (ZakFormElement *element);
+
+ gboolean (*is_valid) (ZakFormElement *element);
+
guint before_validating_signal_id;
guint after_validating_signal_id;
};