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__
32 typedef struct _NPWProperty NPWProperty
;
33 typedef struct _NPWPage NPWPage
;
34 typedef struct _NPWItem NPWItem
;
36 /* You should update the NPWPropertyTypeString array in the .c file,
37 * after changing the NPWPropertyType enum */
39 NPW_UNKNOWN_PROPERTY
= 0,
45 NPW_DIRECTORY_PROPERTY
,
51 /* You should update the NPWPropertyRestrictionString array in the .c file,
52 * after changing the NPWPropertyRestriction enum */
54 NPW_NO_RESTRICTION
= 0,
55 NPW_FILENAME_RESTRICTION
,
57 } NPWPropertyRestriction
;
60 NPW_MANDATORY_OPTION
= 1 << 0,
61 NPW_SUMMARY_OPTION
= 1 << 1,
62 NPW_EDITABLE_OPTION
= 1 << 2,
63 NPW_EXIST_OPTION
= 1 << 3,
64 NPW_EXIST_SET_OPTION
= 1 << 4
71 } NPWPropertyBooleanValue
;
73 NPWProperty
* npw_property_new (NPWPage
* owner
);
74 void npw_property_free (NPWProperty
* this);
76 void npw_property_set_type (NPWProperty
* this, NPWPropertyType type
);
77 void npw_property_set_string_type (NPWProperty
* this, const gchar
* type
);
78 NPWPropertyType
npw_property_get_type (const NPWProperty
* this);
80 void npw_property_set_restriction (NPWProperty
* this, NPWPropertyRestriction restriction
);
81 void npw_property_set_string_restriction (NPWProperty
* this, const gchar
* restriction
);
82 NPWPropertyRestriction
npw_property_get_restriction (const NPWProperty
* this);
83 gboolean
npw_property_is_valid_restriction (const NPWProperty
* this);
85 void npw_property_set_name (NPWProperty
* this, const gchar
* name
);
86 const gchar
* npw_property_get_name (const NPWProperty
* this);
88 void npw_property_set_label (NPWProperty
* this, const gchar
* name
);
89 const gchar
* npw_property_get_label (const NPWProperty
* this);
91 void npw_property_set_description (NPWProperty
* this, const gchar
* description
);
92 const gchar
* npw_property_get_description (const NPWProperty
* this);
94 GtkWidget
* npw_property_create_widget (NPWProperty
* this);
95 void npw_property_set_widget (NPWProperty
* this, GtkWidget
* widget
);
96 GtkWidget
* npw_property_get_widget (const NPWProperty
* this);
98 void npw_property_set_default (NPWProperty
* this, const gchar
* value
);
100 gboolean
npw_property_update_value_from_widget (NPWProperty
* this);
101 gboolean
npw_property_save_value_from_widget (NPWProperty
* this);
102 gboolean
npw_property_remove_value (NPWProperty
* this);
103 const char* npw_property_get_value (const NPWProperty
* this);
105 gboolean
npw_property_add_list_item (NPWProperty
* this, const char* name
, const gchar
* label
);
107 void npw_property_set_mandatory_option (NPWProperty
* this, gboolean value
);
108 void npw_property_set_summary_option (NPWProperty
* this, gboolean value
);
109 void npw_property_set_editable_option (NPWProperty
* this, gboolean value
);
110 NPWPropertyOptions
npw_property_get_options (const NPWProperty
* this);
112 void npw_property_set_exist_option (NPWProperty
* this, NPWPropertyBooleanValue value
);
113 NPWPropertyBooleanValue
npw_property_get_exist_option (const NPWProperty
* this);
116 NPWPage
* npw_page_new (NPWValueHeap
* value
);
117 void npw_page_free (NPWPage
* this);
119 typedef void (*NPWPropertyForeachFunc
) (NPWProperty
* head
, gpointer data
);
121 void npw_page_set_name (NPWPage
* this, const gchar
* name
);
122 const gchar
* npw_page_get_name (const NPWPage
* this);
124 void npw_page_set_label (NPWPage
* this, const gchar
* name
);
125 const gchar
* npw_page_get_label (const NPWPage
* this);
127 void npw_page_set_description (NPWPage
* this, const gchar
* name
);
128 const gchar
* npw_page_get_description (const NPWPage
* this);
130 void npw_page_foreach_property (const NPWPage
* this, NPWPropertyForeachFunc func
, gpointer data
);