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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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
,
52 NPW_MANDATORY_OPTION
= 1 << 0,
53 NPW_SUMMARY_OPTION
= 1 << 1,
54 NPW_EDITABLE_OPTION
= 1 << 2,
55 NPW_EXIST_OPTION
= 1 << 3,
56 NPW_EXIST_SET_OPTION
= 1 << 4
63 } NPWPropertyBooleanValue
;
65 NPWProperty
* npw_property_new (NPWPage
* owner
);
66 void npw_property_free (NPWProperty
* this);
68 void npw_property_set_type (NPWProperty
* this, NPWPropertyType type
);
69 void npw_property_set_string_type (NPWProperty
* this, const gchar
* type
);
70 NPWPropertyType
npw_property_get_type (const NPWProperty
* this);
72 void npw_property_set_name (NPWProperty
* this, const gchar
* name
);
73 const gchar
* npw_property_get_name (const NPWProperty
* this);
75 void npw_property_set_label (NPWProperty
* this, const gchar
* name
);
76 const gchar
* npw_property_get_label (const NPWProperty
* this);
78 void npw_property_set_description (NPWProperty
* this, const gchar
* description
);
79 const gchar
* npw_property_get_description (const NPWProperty
* this);
81 GtkWidget
* npw_property_create_widget (NPWProperty
* this);
82 void npw_property_set_widget (NPWProperty
* this, GtkWidget
* widget
);
83 GtkWidget
* npw_property_get_widget (const NPWProperty
* this);
85 void npw_property_set_default (NPWProperty
* this, const gchar
* value
);
87 gboolean
npw_property_update_value_from_widget (NPWProperty
* this);
88 gboolean
npw_property_save_value_from_widget (NPWProperty
* this);
89 gboolean
npw_property_remove_value (NPWProperty
* this);
90 const char* npw_property_get_value (const NPWProperty
* this);
92 gboolean
npw_property_add_list_item (NPWProperty
* this, const char* name
, const gchar
* label
);
94 void npw_property_set_mandatory_option (NPWProperty
* this, gboolean value
);
95 void npw_property_set_summary_option (NPWProperty
* this, gboolean value
);
96 void npw_property_set_editable_option (NPWProperty
* this, gboolean value
);
97 NPWPropertyOptions
npw_property_get_options (const NPWProperty
* this);
99 void npw_property_set_exist_option (NPWProperty
* this, NPWPropertyBooleanValue value
);
100 NPWPropertyBooleanValue
npw_property_get_exist_option (const NPWProperty
* this);
103 NPWPage
* npw_page_new (NPWValueHeap
* value
);
104 void npw_page_free (NPWPage
* this);
106 typedef void (*NPWPropertyForeachFunc
) (NPWProperty
* head
, gpointer data
);
108 void npw_page_set_name (NPWPage
* this, const gchar
* name
);
109 const gchar
* npw_page_get_name (const NPWPage
* this);
111 void npw_page_set_label (NPWPage
* this, const gchar
* name
);
112 const gchar
* npw_page_get_label (const NPWPage
* this);
114 void npw_page_set_description (NPWPage
* this, const gchar
* name
);
115 const gchar
* npw_page_get_description (const NPWPage
* this);
117 void npw_page_foreach_property (const NPWPage
* this, NPWPropertyForeachFunc func
, gpointer data
);