/* * Copyright (C) 2012 - Juan Ferrer Toribio * * 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 3 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, see . */ #ifndef VN_FIELD_H #define VN_FIELD_H #include #include #define VN_TYPE_FIELD (vn_field_get_type ()) #define VN_FIELD(obj) (G_TYPE_CHECK_INSTANCE_CAST (obj, VN_TYPE_FIELD, VnField)) #define VN_IS_FIELD(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, VN_TYPE_FIELD)) #define VN_FIELD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST (klass, VN_TYPE_FIELD, VnFieldClass)) #define VN_FIELD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS (obj, VN_TYPE_FIELD, VnFieldClass)) typedef struct _VnField VnField; typedef struct _VnFieldClass VnFieldClass; typedef void (*VnFieldSetValueFunc) (VnField * obj, const GValue * value); typedef void (*VnFieldValueChangedFunc) (VnField * obj, const GValue * value); typedef void (*VnFieldStyleFunc) (VnField * obj, GtkWidget * widget, const GValue * value); struct _VnField { GtkEventBox parent; GtkWidget * field; GValue * value; GvnParam * param; GvnParamSpec * spec; GvnParamSpec * user_spec; gboolean lock_changed_done; gboolean update_param; DbIterator * iterator; gchar * column_name; VnFieldStyleFunc style_func; }; struct _VnFieldClass { GtkEventBoxClass parent; GCallback changed; VnFieldSetValueFunc set_value; VnFieldValueChangedFunc value_changed; }; GType vn_field_get_type (); const GValue * vn_field_get_value (VnField * obj); void vn_field_set_value (VnField * obj, const GValue * value); GvnParam * vn_field_get_param (VnField * obj); void vn_field_set_param (VnField * obj, GvnParam * param); GType vn_field_get_gtype (VnField * obj); void vn_field_set_gtype (VnField * obj, GType type); gboolean vn_field_get_null (VnField * obj); void vn_field_set_null (VnField * obj, gboolean null); gboolean vn_field_get_editable (VnField * obj); void vn_field_set_editable (VnField * obj, gboolean editable); const GValue * vn_field_get_default (VnField * obj); void vn_field_set_default (VnField * obj, const GValue * def); void vn_field_set_to_default (VnField * obj); GtkWidget * vn_field_get_widget (VnField * obj); #endif