1 /* decls for boxes.
2  */
3 
4 /*
5 
6     Copyright (C) 1991-2003 The National Gallery
7 
8     This program is free software; you can redistribute it and/or modify
9     it under the terms of the GNU General Public License as published by
10     the Free Software Foundation; either version 2 of the License, or
11     (at your option) any later version.
12 
13     This program is distributed in the hope that it will be useful,
14     but WITHOUT ANY WARRANTY; without even the implied warranty of
15     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16     GNU General Public License for more details.
17 
18     You should have received a copy of the GNU General Public License along
19     with this program; if not, write to the Free Software Foundation, Inc.,
20     51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21 
22  */
23 
24 /*
25 
26     These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
27 
28  */
29 
30 void box_alert( GtkWidget *par );
31 void box_vinfo( GtkWidget *par, const char *top, const char *sub, va_list ap );
32 void box_info( GtkWidget *par, const char *top, const char *sub, ... )
33 	__attribute__((format(printf, 3, 4)));
34 iDialog *box_yesno( GtkWidget *par,
35 	iWindowFn okcb, iWindowFn cancelcb, void *client, /* Call client */
36 	iWindowNotifyFn nfn, void *sys,			  /* Call parent */
37 	const char *yes_label,
38 	const char *top, const char *sub, ... )
39 	__attribute__((format(printf, 9, 10)));
40 void box_savenosave( GtkWidget *par,
41 	iWindowFn save, iWindowFn nosave, void *client,   /* Call client */
42 	iWindowNotifyFn nfn, void *sys,			  /* Call parent */
43 	const char *top, const char *sub, ... )
44 	__attribute__((format(printf, 8, 9)));
45 void box_about( GtkWidget *par );
46 void box_help( GtkWidget *par, const char *name );
47 
48 /* A dialog showing a bunch of editable strings ... eg. name and caption for
49  * new toolkit etc. etc.
50  */
51 #define TYPE_STRINGSET (stringset_get_type())
52 #define STRINGSET( obj ) \
53 	(GTK_CHECK_CAST( (obj), TYPE_STRINGSET, Stringset ))
54 #define STRINGSET_CLASS( klass ) \
55 	(GTK_CHECK_CLASS_CAST( (klass), TYPE_STRINGSET, StringsetClass ))
56 #define IS_STRINGSET( obj ) (GTK_CHECK_TYPE( (obj), TYPE_STRINGSET ))
57 #define IS_STRINGSET_CLASS( klass ) \
58 	(GTK_CHECK_CLASS_TYPE( (klass), TYPE_STRINGSET ))
59 
60 /* A Stringset is a bunch of these.
61  */
62 typedef struct {
63 	struct _Stringset *ss;
64 
65 	GtkWidget *entry;
66 	char *label;
67 	char *text;	/* Current text value */
68 	char *tooltip;
69 } StringsetChild;
70 
71 typedef struct _Stringset {
72 	iDialog parent;
73 
74 	GSList *children;
75 	GtkSizeGroup *group;	/* Align labels with this */
76 } Stringset;
77 
78 typedef struct _StringsetClass {
79 	iDialogClass parent_class;
80 
81 	/* My methods.
82 	 */
83 } StringsetClass;
84 
85 void *stringset_child_destroy( StringsetChild *ssc );
86 StringsetChild *stringset_child_new( Stringset *ss,
87 	const char *label, const char *text, const char *tooltip );
88 GtkType stringset_get_type( void );
89 GtkWidget *stringset_new( void );
90 StringsetChild *stringset_child_get( Stringset *, const char *label );
91 
92 /* Find dialog.
93  */
94 #define TYPE_FIND (find_get_type())
95 #define FIND( obj ) \
96 	(GTK_CHECK_CAST( (obj), TYPE_FIND, Find ))
97 #define FIND_CLASS( klass ) \
98 	(GTK_CHECK_CLASS_CAST( (klass), TYPE_FIND, FindClass ))
99 #define IS_FIND( obj ) (GTK_CHECK_TYPE( (obj), TYPE_FIND ))
100 #define IS_FIND_CLASS( klass ) \
101 	(GTK_CHECK_CLASS_TYPE( (klass), TYPE_FIND ))
102 
103 typedef struct _Find {
104 	iDialog parent;
105 
106 	/* My instance vars.
107 	 */
108 	GtkWidget *search;
109 #ifdef HAVE_GREGEX
110 	GtkWidget *regexp;
111 #endif /*HAVE_GREGEX*/
112 	GtkWidget *csens;
113 	GtkWidget *fromtop;
114 } Find;
115 
116 typedef struct _FindClass {
117 	iDialogClass parent_class;
118 
119 	/* My methods.
120 	 */
121 } FindClass;
122 
123 GtkType find_get_type( void );
124 GtkWidget *find_new( void );
125 
126 void box_url( GtkWidget *par, const char *url );
127 
128 /* Font chooser window.
129  */
130 #define TYPE_FONTCHOOSER (fontchooser_get_type())
131 #define FONTCHOOSER( obj ) \
132 	(GTK_CHECK_CAST( (obj), TYPE_FONTCHOOSER, Fontchooser ))
133 #define FONTCHOOSER_CLASS( klass ) \
134 	(GTK_CHECK_CLASS_CAST( (klass), TYPE_FONTCHOOSER, FontchooserClass ))
135 #define IS_FONTCHOOSER( obj ) (GTK_CHECK_TYPE( (obj), TYPE_FONTCHOOSER ))
136 #define IS_FONTCHOOSER_CLASS( klass ) \
137 	(GTK_CHECK_CLASS_TYPE( (klass), TYPE_FONTCHOOSER ))
138 
139 typedef struct _Fontchooser {
140 	iDialog parent_object;
141 
142 	GtkWidget *fontchooser;		/* gtk font select widget */
143 } Fontchooser;
144 
145 typedef struct _FontchooserClass {
146 	iDialogClass parent_class;
147 
148 	/* My methods.
149 	 */
150 } FontchooserClass;
151 
152 GtkType fontchooser_get_type( void );
153 Fontchooser *fontchooser_new( void );
154 gboolean fontchooser_set_font_name( Fontchooser *fontchooser,
155 	const char *font_name );
156 char *fontchooser_get_font_name( Fontchooser * );
157 
158 /* Font button.
159  */
160 #define TYPE_FONTBUTTON (fontbutton_get_type())
161 #define FONTBUTTON( obj ) \
162 	(GTK_CHECK_CAST( (obj), TYPE_FONTBUTTON, Fontbutton ))
163 #define FONTBUTTON_CLASS( klass ) \
164 	(GTK_CHECK_CLASS_CAST( (klass), TYPE_FONTBUTTON, FontbuttonClass ))
165 #define IS_FONTBUTTON( obj ) (GTK_CHECK_TYPE( (obj), TYPE_FONTBUTTON ))
166 #define IS_FONTBUTTON_CLASS( klass ) \
167 	(GTK_CHECK_CLASS_TYPE( (klass), TYPE_FONTBUTTON ))
168 
169 typedef struct _Fontbutton {
170 	GtkButton parent_object;
171 
172 	char *font_name;		/* Current name */
173 
174 	Fontchooser *fontchooser;	/* Pop up dialog */
175 } Fontbutton;
176 
177 typedef struct _FontbuttonClass {
178 	GtkButtonClass parent_class;
179 
180 	void (*changed)( Fontbutton * );
181 } FontbuttonClass;
182 
183 GtkType fontbutton_get_type( void );
184 Fontbutton *fontbutton_new( void );
185 void fontbutton_set_font_name( Fontbutton *fontbutton, const char *font_name );
186 const char *fontbutton_get_font_name( Fontbutton * );
187 
188 /* Infobar subclass, with a close animation and a label.
189  */
190 #define TYPE_INFOBAR (infobar_get_type())
191 #define INFOBAR( obj ) \
192 	(GTK_CHECK_CAST( (obj), TYPE_INFOBAR, Infobar ))
193 #define INFOBAR_CLASS( klass ) \
194 	(GTK_CHECK_CLASS_CAST( (klass), TYPE_INFOBAR, InfobarClass ))
195 #define IS_INFOBAR( obj ) (GTK_CHECK_TYPE( (obj), TYPE_INFOBAR ))
196 #define IS_INFOBAR_CLASS( klass ) \
197 	(GTK_CHECK_CLASS_TYPE( (klass), TYPE_INFOBAR ))
198 
199 struct _Infobar {
200 #ifdef USE_INFOBAR
201 	GtkInfoBar parent_object;
202 #endif /*USE_INFOBAR*/
203 
204 	GtkWidget *top;
205 	GtkWidget *sub;
206 	GtkWidget *info;
207 	guint close_timeout;
208 	guint close_animation_timeout;
209 	int height;
210 };
211 
212 typedef struct _InfobarClass {
213 #ifdef USE_INFOBAR
214 	GtkInfoBarClass parent_class;
215 #endif /*USE_INFOBAR*/
216 
217 } InfobarClass;
218 
219 GtkType infobar_get_type( void );
220 Infobar *infobar_new( void );
221 void infobar_vset( Infobar *infobar, GtkMessageType type,
222 	const char *top, const char *sub, va_list ap );
223 void infobar_set( Infobar *infobar, GtkMessageType type,
224 	const char *top, const char *sub, ... );
225