1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
4 Copyright (C) 2004 Sebastien Granjoux
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 #ifndef __PROPERTY_H__
22 #define __PROPERTY_H__
30 typedef struct _NPWProperty NPWProperty
;
31 typedef struct _NPWPage NPWPage
;
32 typedef struct _NPWItem NPWItem
;
34 /* You should update the NPWPropertyTypeString array in the .c file,
35 * after changing the NPWPropertyType enum */
37 NPW_UNKNOWN_PROPERTY
= 0,
43 NPW_DIRECTORY_PROPERTY
,
50 /* You should update the NPWPropertyRestrictionString array in the .c file,
51 * after changing the NPWPropertyRestriction enum */
53 NPW_NO_RESTRICTION
= 0,
54 NPW_FILENAME_RESTRICTION
,
55 NPW_DIRECTORY_RESTRICTION
,
56 NPW_PRINTABLE_RESTRICTION
,
58 } NPWPropertyRestriction
;
61 NPW_MANDATORY_OPTION
= 1 << 0,
62 NPW_SUMMARY_OPTION
= 1 << 1,
63 NPW_EDITABLE_OPTION
= 1 << 2,
64 NPW_EXIST_OPTION
= 1 << 3,
65 NPW_EXIST_SET_OPTION
= 1 << 4
72 } NPWPropertyBooleanValue
;
79 } NPWPropertyRangeMark
;
81 NPWProperty
* npw_property_new (void);
82 void npw_property_free (NPWProperty
* prop
);
84 void npw_property_set_language (NPWProperty
* prop
, gint language
);
85 void npw_property_set_type (NPWProperty
* prop
, NPWPropertyType type
);
86 void npw_property_set_string_type (NPWProperty
* prop
, const gchar
* type
);
87 NPWPropertyType
npw_property_get_type (const NPWProperty
* prop
);
89 void npw_property_set_restriction (NPWProperty
* prop
, NPWPropertyRestriction restriction
);
90 void npw_property_set_string_restriction (NPWProperty
* prop
, const gchar
* restriction
);
91 NPWPropertyRestriction
npw_property_get_restriction (const NPWProperty
* prop
);
92 gboolean
npw_property_is_valid_restriction (const NPWProperty
* prop
);
94 void npw_property_set_name (NPWProperty
* prop
, const gchar
* name
, NPWPage
*page
);
95 const gchar
* npw_property_get_name (const NPWProperty
* prop
);
97 void npw_property_set_label (NPWProperty
* prop
, const gchar
* name
);
98 const gchar
* npw_property_get_label (const NPWProperty
* prop
);
100 void npw_property_set_description (NPWProperty
* prop
, const gchar
* description
);
101 const gchar
* npw_property_get_description (const NPWProperty
* prop
);
103 GtkWidget
* npw_property_create_widget (NPWProperty
* prop
);
104 void npw_property_set_widget (NPWProperty
* prop
, GtkWidget
* widget
);
105 GtkWidget
* npw_property_get_widget (const NPWProperty
* prop
);
107 void npw_property_set_default (NPWProperty
* prop
, const gchar
* value
);
109 gboolean
npw_property_set_range (NPWProperty
* prop
, NPWPropertyRangeMark mark
, const gchar
* value
);
111 gboolean
npw_property_update_value_from_widget (NPWProperty
* prop
);
112 gboolean
npw_property_save_value_from_widget (NPWProperty
* prop
);
113 gboolean
npw_property_remove_value (NPWProperty
* prop
);
114 const char* npw_property_get_value (const NPWProperty
* prop
);
116 gboolean
npw_property_add_list_item (NPWProperty
* prop
, const char* name
, const gchar
* label
, gint language
);
118 void npw_property_set_mandatory_option (NPWProperty
* prop
, gboolean value
);
119 void npw_property_set_summary_option (NPWProperty
* prop
, gboolean value
);
120 void npw_property_set_editable_option (NPWProperty
* prop
, gboolean value
);
121 NPWPropertyOptions
npw_property_get_options (const NPWProperty
* prop
);
123 void npw_property_set_exist_option (NPWProperty
* prop
, NPWPropertyBooleanValue value
);
124 NPWPropertyBooleanValue
npw_property_get_exist_option (const NPWProperty
* prop
);
127 NPWPage
* npw_page_new (GHashTable
* value
);
128 void npw_page_free (NPWPage
* page
);
130 gboolean
npw_page_set_language (NPWPage
* page
, gint language
);
132 void npw_page_set_name (NPWPage
* page
, const gchar
* name
);
133 const gchar
* npw_page_get_name (const NPWPage
* page
);
135 void npw_page_set_label (NPWPage
* page
, const gchar
* name
);
136 const gchar
* npw_page_get_label (const NPWPage
* page
);
138 void npw_page_set_description (NPWPage
* page
, const gchar
* name
);
139 const gchar
* npw_page_get_description (const NPWPage
* page
);
141 void npw_page_set_widget (NPWPage
* page
, GtkWidget
*widget
);
142 GtkWidget
*npw_page_get_widget (const NPWPage
*page
);
144 void npw_page_foreach_property (const NPWPage
* page
, GFunc func
, gpointer data
);
145 NPWProperty
*npw_page_add_property (NPWPage
* page
, NPWProperty
* prop
);