1 #ifndef GNOCL_H_INCLUDED
2 #define GNOCL_H_INCLUDED
3 
4 /*
5  * $Id: gnocl.h,v 1.36 2005/08/16 20:57:45 baum Exp $
6  *
7  * This file implements a Tcl interface to gnome and GTK+
8  *
9  * Copyright (c) 2001 - 2005 Peter G. Baum  http://www.dr-baum.net
10  *
11  * See the file "license.terms" for information on usage and redistribution
12  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
13  *
14  */
15 
16 /**
17 \brief  This file implements a Tcl interface to gnome and GTK+
18 **/
19 
20 #include "tcl.h"
21 #include <glib.h>
22 #include <gtk/gtk.h>
23 #include <gdk/gdkkeysyms.h>
24 #include <glib/gprintf.h>
25 #include <glade/glade.h>
26 #include <gtk-unix-print-2.0/gtk/gtkprinter.h>
27 
28 #include <ctype.h>
29 #include <stdlib.h>
30 #include <stdio.h>
31 #include <string.h>
32 #include <assert.h>
33 #include <math.h>
34 
35 /* set some padding values */
36 #define GNOCL_PAD_TINY  2
37 #define GNOCL_PAD_SMALL 4
38 #define GNOCL_PAD       8
39 #define GNOCL_PAD_BIG  12
40 
41 /* string prefix to mark stock items */
42 #define GNOCL_STOCK_PREFIX "%#"
43 /* transfer string ownership */
44 #define GNOCL_MOVE_STRING(src,dest) \
45       do{ g_free(dest); dest = src; src = NULL; } while( 0 )
46 /* transfer obj ownership */
47 #define GNOCL_MOVE_OBJ(src,dest) \
48       do{ if(dest) Tcl_DecrRefCount( dest ); \
49       dest = src; Tcl_IncrRefCount( dest ); } while( 0 )
50 
51 typedef enum GnoclStringType_
52 {
53 	GNOCL_STR_EMPTY     = 0,       /* empty string */
54 	GNOCL_STR_STR       = 1 << 0,  /* normal string */
55 	GNOCL_STR_STOCK     = 1 << 1,  /* (potentially) the name of a stock item */
56 	GNOCL_STR_FILE      = 1 << 2,  /* (potentially) the name of a file */
57 	GNOCL_STR_TRANSLATE = 1 << 3,  /* to be translated via gettext */
58 	GNOCL_STR_UNDERLINE = 1 << 4,  /* '_' marks underline and accelerator */
59 	GNOCL_STR_MARKUP    = 1 << 5,  /* markup for label */
60 	GNOCL_STR_BUFFER    = 1 << 6   /* (potentially) the name of a pixbuf */
61 } GnoclStringType;
62 
63 GnoclStringType gnoclGetStringType ( Tcl_Obj *obj );
64 char *gnoclGetString ( Tcl_Obj *op );
65 char *gnoclGetStringFromObj ( Tcl_Obj *op, int *len );
66 char *gnoclGetStringUline ( Tcl_Obj *op, char **pattern );
67 char *gnoclStringDup ( Tcl_Obj *op );
68 char *gnoclGetStockLabel ( Tcl_Obj *obj, Tcl_Interp *interp );
69 int gnoclGetStockItem ( Tcl_Obj *obj, Tcl_Interp *interp, GtkStockItem *sp );
70 Tcl_Obj *gnoclGtkToStockName ( const char *gtk );
71 const char *gnoclGetAppName ( Tcl_Interp *interp );
72 const char *gnoclGetAppVersion ( Tcl_Interp *interp );
73 char **gnoclGetArgv ( Tcl_Interp *interp, int *argc );
74 
75 int gnoclRegisterWidget ( Tcl_Interp *interp, GtkWidget *widget, Tcl_ObjCmdProc *proc );
76 
77 /* WJG Added 05-03-09 */
78 int gnoclRegisterPixbuf ( Tcl_Interp *interp, GdkPixbuf *pixbuf, Tcl_ObjCmdProc *proc );
79 
80 
81 int gnoclMemNameAndWidget ( const char *name, GtkWidget *widget );
82 int gnoclForgetWidgetFromName ( const char *name );
83 char *gnoclGetAutoWidgetId ( void );
84 const char *gnoclGetNameFromWidget ( GtkWidget *widget );
85 GtkWidget *gnoclGetWidgetFromName ( const char *name, Tcl_Interp *interp );
86 GtkWidget *gnoclChildNotPacked ( const char *name, Tcl_Interp *interp );
87 int gnoclAssertNotPacked ( GtkWidget *child, Tcl_Interp *interp,  const char *name );
88 
89 int gnoclGetBothAlign ( Tcl_Interp *interp, Tcl_Obj *obj, gfloat *xAlign,
90 						gfloat *yAlign );
91 int gnoclGetPadding ( Tcl_Interp *interp, Tcl_Obj *obj, int *pad );
92 
93 enum GnoclOptionType
94 {
95 	GNOCL_STRING,
96 	GNOCL_DOUBLE,
97 	GNOCL_INT,
98 	GNOCL_BOOL,
99 	GNOCL_OBJ,
100 	GNOCL_LIST
101 };
102 
103 typedef struct
104 {
105 	char *command;
106 	Tcl_Interp *interp;
107 	void       *data;
108 } GnoclCommandData;
109 
110 typedef struct
111 {
112 	char c;
113 	enum GnoclOptionType type;
114 	union
115 	{
116 		double     d;
117 		int        i;
118 		int        b;
119 		const char *str;
120 		Tcl_Obj    *obj;
121 	}    val;
122 } GnoclPercSubst;
123 
124 const char *gnoclPercentSubstitution ( GnoclPercSubst *p, int no,
125 									   const char *str );
126 
127 enum GnoclOptionStatus
128 {
129 	/* the order is important for gnoclClearOptions */
130 	GNOCL_STATUS_CLEAR,
131 	GNOCL_STATUS_CHANGED_ERROR,
132 	GNOCL_STATUS_CHANGED,
133 	GNOCL_STATUS_SET_ERROR,
134 	GNOCL_STATUS_SET
135 };
136 
137 enum GnoclCgetReturn
138 {
139 	GNOCL_CGET_ERROR,
140 	GNOCL_CGET_HANDLED,
141 	GNOCL_CGET_NOTHANDLED
142 };
143 
144 struct GnoclOption_;
145 typedef int ( gnoclOptFunc ) ( Tcl_Interp *, struct GnoclOption_ *, GObject *, Tcl_Obj **ret );
146 
147 typedef struct GnoclOption_
148 {
149 	const char           *optName;
150 	enum GnoclOptionType type;
151 	const char           *propName;        /* NULL for no automatic setting */
152 	gnoclOptFunc         *func;
153 	enum GnoclOptionStatus status;
154 	union
155 	{
156 		gboolean b;
157 		gint     i;
158 		gdouble  d;
159 		gchar    *str;
160 		Tcl_Obj  *obj;
161 	}          val;
162 } GnoclOption;
163 
164 
165 /* WJG STUFF */
166 
167 int gnoclOptWindowCenter ( Tcl_Interp *interp, GnoclOption *opt, GObject *obj, Tcl_Obj **ret );
168 int gnoclOptGdkBaseFont ( Tcl_Interp *interp, GnoclOption *opt, GObject *obj, Tcl_Obj **ret );
169 
170 gnoclOptFunc gnoclOptOnEvent;
171 gnoclOptFunc gnoclOptOnScroll;
172 
173 /* WJG STUFF ENDS */
174 
175 
176 int gnoclOptGeneric ( Tcl_Interp *interp, GnoclOption *opt, GObject *obj, const char *optName, const char *txt[], const int types[], Tcl_Obj **ret );
177 
178 gnoclOptFunc gnoclOptGdkColorEvenRow; /* still a stub, widget style settings */
179 
180 gnoclOptFunc gnoclOptOrientation;
181 gnoclOptFunc gnoclOptNotify;
182 gnoclOptFunc gnoclOptAnchor;
183 gnoclOptFunc gnoclOptBothAlign;
184 gnoclOptFunc gnoclOptChild;
185 gnoclOptFunc gnoclOptCommand;
186 gnoclOptFunc gnoclOptData;
187 gnoclOptFunc gnoclOptDnDTargets;
188 gnoclOptFunc gnoclOptGdkColor;
189 gnoclOptFunc gnoclOptGdkBaseFont;
190 gnoclOptFunc gnoclOptGdkColorBase;
191 gnoclOptFunc gnoclOptGdkColorBg;
192 gnoclOptFunc gnoclOptGdkColorFg;
193 gnoclOptFunc gnoclOptFrameLabelWidget;
194 gnoclOptFunc gnoclOptToolButtonLabelWidget;
195 gnoclOptFunc gnoclOptToolButtonIconWidget;
196 gnoclOptFunc gnoclOptGdkColorText;
197 gnoclOptFunc gnoclOptHalign;
198 gnoclOptFunc gnoclOptIcon;
199 gnoclOptFunc gnoclOptJustification;
200 gnoclOptFunc gnoclOptEllipsize;
201 gnoclOptFunc gnoclOptLabelFull;
202 gnoclOptFunc gnoclOptOnButton;
203 gnoclOptFunc gnoclOptOnButton2; //<--------------------------------------
204 //gnoclOptFunc gnoclOptOnSelectionChanged;
205 gnoclOptFunc gnoclOptOnFontSet;
206 gnoclOptFunc gnoclOptOnFileSet;
207 gnoclOptFunc gnoclOptOnFolderSet;
208 gnoclOptFunc gnoclOptOnConfigure;
209 gnoclOptFunc gnoclOptOnDelete;
210 gnoclOptFunc gnoclOptOnDragData;
211 gnoclOptFunc gnoclOptOnDropData;
212 gnoclOptFunc gnoclOptOnDragEnd;
213 gnoclOptFunc gnoclOptOnEnterLeave;
214 gnoclOptFunc gnoclOptOnKeyPress;
215 gnoclOptFunc gnoclOptOnKeyRelease;
216 gnoclOptFunc gnoclOptOnMotion;
217 gnoclOptFunc gnoclOptOnButtonMotion;
218 gnoclOptFunc gnoclOptCharWidth;
219 gnoclOptFunc gnoclOptOnBackSpace;
220 gnoclOptFunc gnoclOptOnClipboard;
221 gnoclOptFunc gnoclOptOnUndoRedo;
222 gnoclOptFunc gnoclOptOnTextInsert;
223 gnoclOptFunc gnoclOptOnChanged;
224 gnoclOptFunc gnoclOptOnModified;
225 gnoclOptFunc gnoclOptOnApplyTag;
226 gnoclOptFunc gnoclOptOnRemoveTag;
227 gnoclOptFunc gnoclOptOnFocus;
228 gnoclOptFunc gnoclOptOnEnterLeave;
229 gnoclOptFunc gnoclOptOnBeginUserAction;
230 gnoclOptFunc gnoclOptOnEndUserAction;
231 gnoclOptFunc gnoclOptOnInsertChildAnchor;
232 gnoclOptFunc gnoclOptOnLInkButton;
233 gnoclOptFunc gnoclOptOnDeletFromCursor;
234 gnoclOptFunc gnoclOptOnInsertAtCursor;
235 gnoclOptFunc gnoclOptOnMoveCursor;
236 gnoclOptFunc gnoclOptOnMoveFocus;
237 gnoclOptFunc gnoclOptOnMoveViewport;
238 gnoclOptFunc gnoclOptOnPageHorizontally ;
239 gnoclOptFunc gnoclOptOnPasteClipboard ;
240 gnoclOptFunc gnoclOptOnPopulatePopup;
241 gnoclOptFunc gnoclOptOnSelectAll;
242 gnoclOptFunc gnoclOptIconTooltip;
243 gnoclOptFunc gnoclOptOnPreEditChanged;
244 gnoclOptFunc gnoclOptOnIconPress;
245 gnoclOptFunc gnoclOptOnSetAnchor;
246 gnoclOptFunc gnoclOptOnScrollAdjustments;
247 gnoclOptFunc gnoclOptOnToggleOverwrite;
248 gnoclOptFunc gnoclOptIcons;
249 gnoclOptFunc gnoclOptOnPasteDone;
250 gnoclOptFunc gnoclOptOnDelete;
251 gnoclOptFunc gnoclOptOnMarkSet;
252 gnoclOptFunc gnoclOptOnMarkDelete;
253 gnoclOptFunc gnoclOptOnExpose;
254 gnoclOptFunc gnoclOptOnClicked;
255 gnoclOptFunc gnoclOptOnColorSet;
256 gnoclOptFunc gnoclOptOnButtonClicked;
257 gnoclOptFunc gnoclOptOnColumnClicked;
258 gnoclOptFunc gnoclOptOnInteractiveSearch;
259 gnoclOptFunc gnoclOptArrowTooltip;
260 gnoclOptFunc gnoclOptOnShowHelp;
261 gnoclOptFunc gnoclOptPadding;
262 gnoclOptFunc gnoclOptPangoScaledInt;
263 gnoclOptFunc gnoclOptPangoStretch;
264 gnoclOptFunc gnoclOptPangoStyle;
265 gnoclOptFunc gnoclOptPangoVariant;
266 gnoclOptFunc gnoclOptPangoWeight;
267 gnoclOptFunc gnoclOptPangoWrapMode;
268 gnoclOptFunc gnoclOptPosition;
269 gnoclOptFunc gnoclOptRelief;
270 gnoclOptFunc gnoclOptButtonRelief;
271 gnoclOptFunc gnoclOptRGBAColor;
272 gnoclOptFunc gnoclOptScale;
273 gnoclOptFunc gnoclOptShadow;
274 gnoclOptFunc gnoclOptSizeGroup;
275 gnoclOptFunc gnoclOptHWGroup;
276 gnoclOptFunc gnoclOptTooltip;
277 gnoclOptFunc gnoclOptUnderline;
278 gnoclOptFunc gnoclOptWidget;
279 gnoclOptFunc gnoclOptWindowTypeHint;
280 gnoclOptFunc gnoclOptWrapmode;
281 gnoclOptFunc gnoclOptTransientWindow;
282 gnoclOptFunc gnoclOptPopupMenu;
283 gnoclOptFunc gnoclOptMask;
284 gnoclOptFunc gnoclOptMask2;
285 gnoclOptFunc gnoclOptBackgroundImage;
286 gnoclOptFunc gnoclOptBackgroundImage2;
287 gnoclOptFunc gnoclOptHasFrame;
288 gnoclOptFunc gnoclOptShadow;
289 gnoclOptFunc gnoclOptCurrentFolder;
290 gnoclOptFunc gnoclOptArrow;
291 gnoclOptFunc gnoclOptDefaultWidget;
292 gnoclOptFunc gnoclOptCursor;
293 gnoclOptFunc gnoclOptKeepAbove;
294 gnoclOptFunc gnoclOptKeepBelow;
295 gnoclOptFunc gnoclOptOpacity;
296 gnoclOptFunc gnoclOptStick;
297 gnoclOptFunc gnoclOptFullScreen;
298 gnoclOptFunc gnoclGetParent;
299 gnoclOptFunc gnoclOptOnBackspace;
300 gnoclOptFunc gnoclOptOnDeleteFromCursor;
301 gnoclOptFunc gnoclOptOnEntryInsert;
302 gnoclOptFunc gnoclOptOnPreEditChanged;
303 gnoclOptFunc gnoclOptOnQueryToolTip;
304 gnoclOptFunc gnoclOptMoveHandle;
305 gnoclOptFunc gnoclOptHeightRequest;
306 gnoclOptFunc gnoclOptOnActivateCurrentLink;
307 gnoclOptFunc gnoclOptOnActivateLink;
308 
309 int gnoclClearOptions ( GnoclOption *opts );
310 int gnoclGetOptions ( Tcl_Interp *interp, GnoclOption *options );
311 int gnoclGetCommands ( Tcl_Interp *interp, char *cmds[] );
312 int gnoclResetSetOptions ( GnoclOption *opts );
313 int gnoclSetOptions ( Tcl_Interp *interp, GnoclOption *opts, GObject *object, int no );
314 int gnoclGetIndexFromObjStruct ( Tcl_Interp *interp, Tcl_Obj *objPtr, char **tablePtr, int offset, char *msg, int flags, int *indexPtr );
315 int gnoclParseOptions ( Tcl_Interp *interp, int objc, Tcl_Obj * const objv[], GnoclOption *opts );
316 int gnoclParseAndSetOptions ( Tcl_Interp *interp, int objc, Tcl_Obj * const objv[], GnoclOption *opts, GObject *object );
317 int gnoclCget ( Tcl_Interp *interp, int objc, Tcl_Obj * const objv[], GObject *gObj, GnoclOption *opts, int *idx );
318 int gnoclCgetOne ( Tcl_Interp *interp, Tcl_Obj *obj, GObject *gObj, GnoclOption *opts, int *idx );
319 int gnoclCgetNotImplemented ( Tcl_Interp *interp, GnoclOption *opt );
320 Tcl_Obj *gnoclCgetButtonText ( Tcl_Interp *interp, GtkButton *button );
321 int gnoclConfigButtonText ( Tcl_Interp *interp, GtkButton *button, Tcl_Obj *txtObj );
322 
323 int gnoclButtonSetSize ( Tcl_Interp  *interp, GnoclOption *opt, GObject *obj, Tcl_Obj **ret );
324 
325 int gnoclKeyFileCmd ( ClientData data, Tcl_Interp * interp, int objc, Tcl_Obj * const objv[] );
326 
327 const char *gnoclGetOptCmd ( GObject *obj, const char *signal );
328 int gnoclDisconnect ( GObject *obj, const char *signal, GCallback handler );
329 int gnoclConnectOptCmd ( Tcl_Interp *interp, GObject *object, const char *signal, GCallback handler, GnoclOption *opt, void *data, Tcl_Obj **ret );
330 
331 
332 int gnoclOptOnInsertText ( Tcl_Interp *interp, GnoclOption *opt, GObject *obj, Tcl_Obj **ret );
333 int gnoclConnectSignalCmd ( Tcl_Interp *interp, GnoclOption *opt, GObject *obj, Tcl_Obj **ret );
334 int gnoclOptOnDeleteRange ( Tcl_Interp *interp, GnoclOption *opt, GObject *obj, Tcl_Obj **ret );
335 
336 /* now handled within each specific module as signal handlers can vary */
337 //int gnoclOptOnChanged ( Tcl_Interp *interp, GnoclOption *opt, GObject *obj, Tcl_Obj **ret );
338 
339 int gnoclOptOnModified ( Tcl_Interp *interp, GnoclOption *opt, GObject *obj, Tcl_Obj **ret );
340 int gnoclOptOnApplyTag ( Tcl_Interp *interp, GnoclOption *opt, GObject *obj, Tcl_Obj **ret );
341 int gnoclOptOnBeginUserAction  ( Tcl_Interp *interp, GnoclOption *opt, GObject *obj, Tcl_Obj **ret );
342 int gnoclOptOnEndUserAction  ( Tcl_Interp *interp, GnoclOption *opt, GObject *obj, Tcl_Obj **ret );
343 int gnoclOptOnInsertChildAnchor  ( Tcl_Interp *interp, GnoclOption *opt, GObject *obj, Tcl_Obj **ret );
344 int gnoclOptOnRemoveTag ( Tcl_Interp *interp, GnoclOption *opt, GObject *obj, Tcl_Obj **ret );
345 int gnoclOptOnMarkSet ( Tcl_Interp *interp, GnoclOption *opt, GObject *obj, Tcl_Obj **ret );
346 int gnoclOptOnMarkDelete ( Tcl_Interp *interp, GnoclOption *opt, GObject *obj, Tcl_Obj **ret );
347 int gnoclOptOnChildAttached ( Tcl_Interp *interp, GnoclOption *opt, GObject *obj, Tcl_Obj **ret );
348 int gnoclOptOnChildDetached ( Tcl_Interp *interp, GnoclOption *opt, GObject *obj, Tcl_Obj **ret );
349 int gnoclOptOnLinkButton ( Tcl_Interp *interp, GnoclOption *opt, GObject *obj, Tcl_Obj **ret );
350 int gnoclOptOnValueChanged ( Tcl_Interp *interp, GnoclOption *opt, GObject *obj, Tcl_Obj **ret );
351 
352 
353 int gnoclOptOnColorWheelChanged ( Tcl_Interp *interp, GnoclOption *opt, GObject *obj, Tcl_Obj **ret );
354 int gnoclOptOnColorWheelMove ( Tcl_Interp *interp, GnoclOption *opt, GObject *obj, Tcl_Obj **ret );
355 
356 int gnoclOptOnACtivate ( Tcl_Interp *interp, GnoclOption *opt, GObject *obj, Tcl_Obj **ret );
357 
358 int gnoclDelete ( Tcl_Interp *interp, GtkWidget *widget, int objc, Tcl_Obj * const objv[] );
359 int gnoclAttachVariable ( GnoclOption *newVar, char **oldVar, const char *signal, GObject *obj, GCallback gtkFunc, Tcl_Interp *interp, Tcl_VarTraceProc tclFunc, gpointer data );
360 int gnoclAttachOptCmdAndVar ( GnoclOption *newCmd, char **oldCmd, GnoclOption *newVar, char **oldVar, const char *signal, GObject *obj, GCallback gtkFunc, Tcl_Interp *interp, Tcl_VarTraceProc tclFunc, gpointer data );
361 int gnoclGetScrollbarPolicy ( Tcl_Interp *interp, Tcl_Obj *obj, GtkPolicyType *hor, GtkPolicyType *vert );
362 int gnoclGetSelectionMode ( Tcl_Interp *interp, Tcl_Obj *obj, GtkSelectionMode *selection );
363 int gnoclGetFontTxt ( Tcl_Interp *interp, Tcl_Obj *obj, const char **font );
364 int gnoclGetGdkFont ( Tcl_Interp *interp, Tcl_Obj *obj, GdkFont **font );
365 int gnoclGetGdkColorAlloc ( Tcl_Interp *interp, Tcl_Obj *obj, GtkWidget *widget, GdkColor *color, int *a );
366 int gnoclGetAnchorStyle ( Tcl_Interp *interp, Tcl_Obj *obj, GtkAnchorType *style );
367 int gnoclGetJustification ( Tcl_Interp *interp, Tcl_Obj *obj, GtkJustification *type );
368 int gnoclGetOrientationType ( Tcl_Interp *interp, Tcl_Obj *obj, GtkOrientation *orient );
369 int gnoclGetImage ( Tcl_Interp *interp, Tcl_Obj *obj, GtkIconSize size, GtkWidget **widget );
370 GtkTooltips *gnoclGetTooltips( );
371 GtkAccelGroup *gnoclGetAccelGroup( );
372 
373 int gnoclEditablePosToIndex ( Tcl_Interp *interp, Tcl_Obj *obj, GtkEditable *editable, int *pidx );
374 int gnoclHandleEditableCmds ( int idx, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[], GtkEditable *editable );
375 
376 #ifdef GNOCL_USE_GNOME
377 int gnoclRegisterHintAppBar ( GtkWidget *widget, GnomeAppBar *appBar );
378 GnomeAppBar *gnoclGetHintAppBar ( GtkWidget *widget );
379 #endif
380 
381 /* in helperFuncs */
382 GtkWidget *gnoclFindChild ( GtkWidget *widget, GtkType type );
383 int gnoclPosOffset ( Tcl_Interp *interp, const char *txt, int *offset );
384 int gnoclPercentSubstAndEval ( Tcl_Interp *interp, GnoclPercSubst *ps, const char *orig_script, int background );
385 int gnoclGet2Boolean ( Tcl_Interp *interp, Tcl_Obj *obj, int *b1, int *b2 );
386 int gnoclGet2Int ( Tcl_Interp *interp, Tcl_Obj *obj, int *b1, int *b2 );
387 int gnoclGet2Double ( Tcl_Interp *interp, Tcl_Obj *obj, double *b1, double *b2 );
388 GdkPixbuf *gnoclPixbufFromObj ( Tcl_Interp *interp, GnoclOption *opt );
389 
390 
391 GdkPixbuf *gnoclBlendPixbufFromObj ( Tcl_Interp *interp, GnoclOption *opt );
392 
393 
394 char *gnoclGetWidgetGeometry ( GtkWidget *widget );
395 
396 /* in menu */
397 int gnoclMenuShellAddChildren ( Tcl_Interp *interp, GtkMenuShell *shell, Tcl_Obj *children, int atEnd );
398 
399 /* in menuItem */
400 Tcl_Obj *gnoclCgetMenuItemAccel ( Tcl_Interp *interp, GtkMenuItem *item );
401 int gnoclMenuItemHandleAccel ( Tcl_Interp *interp, GtkMenuItem *item, Tcl_Obj *accelObj );
402 Tcl_Obj *gnoclCgetMenuItemText ( Tcl_Interp *interp, GtkMenuItem *item );
403 int gnoclMenuItemHandleText ( Tcl_Interp *interp, GtkMenuItem *item, Tcl_Obj *textObj );
404 
405 /* in text.c */
406 int gnoclTextCommand ( GtkTextView *textView, Tcl_Interp * interp, int objc, Tcl_Obj *  const objv[], int cmdNo, int isTextWidget );
407 
408 /* in sourceVSiew.c */
409 
410 /*
411  * recentChooserDialog declarations
412  */
413 int gnoclRecentChooserDialogCmd ( ClientData data, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[] );
414 int gnoclRecentManagerCmd ( ClientData data, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[] );
415 int gnoclPageSetupDialogCmd ( ClientData data, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[] );
416 int gnoclPrintDialogCmd ( ClientData data, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[] );
417 
418 int gnoclPrinterDialogCmd ( ClientData data, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[] );
419 int gnoclPageSetupCmd ( ClientData data, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[] );
420 
421 int gnoclMenuRecentChooserCmd ( ClientData data, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[] );
422 
423 /*
424  * volumeButton declarations
425  */
426 Tcl_Obj *gnoclVolumeButtonText ( Tcl_Interp *interp, GtkWidget *widget );
427 int gnoclConfigVolumeButtonText ( Tcl_Interp *interp, GtkWidget *widget, Tcl_Obj *txtObj );
428 int gnoclVolumeButtonCmd ( ClientData data, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[] );
429 
430 
431 
432 /*
433  * scaleButton declarations
434  */
435 Tcl_Obj *gnoclCgetScaleButtonText ( Tcl_Interp *interp, GtkWidget *widget );
436 int gnoclConfigScaleButtonText ( Tcl_Interp *interp, GtkWidget *widget, Tcl_Obj *txtObj );
437 int gnoclScaleButtonCmd ( ClientData data, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[] );
438 
439 /*
440  * linkButton declarations
441  */
442 Tcl_Obj *gnoclCgetLinkButtonText ( Tcl_Interp *interp, GtkWidget *widget );
443 int gnoclConfigLinkButtonText ( Tcl_Interp *interp, GtkWidget *widget, Tcl_Obj *txtObj );
444 int gnoclLinkButtonCmd ( ClientData data, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[] );
445 int gnoclArrowButtonCmd ( ClientData data, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[] );
446 //int gnoclAcceleratorCmd ( ClientData data, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[] );
447 
448 int gnoclDialCmd ( ClientData data, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[] );
449 int gnoclSpinnerCmd ( ClientData data, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[] );
450 int gnoclLevelCmd ( ClientData data, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[] );
451 
452 int gnoclRichTextToolBarCmd ( ClientData data, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[] );
453 
454 
455 
456 //int gnoclSpinnerCmd ( ClientData data, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[] );
457 
458 /*
459  */
460 int gnoclRecentChooserCmd ( ClientData data, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[] );
461 
462 /*
463  * toggleButton declarations
464  */
465 
466 /* in toggleButton.c  for menuCheckItem and toolBar checkItem */
467 
468 typedef struct
469 {
470 	char       *name;
471 	Tcl_Interp *interp;
472 	GtkWidget  *widget;
473 	char       *onToggled;
474 	char       *variable;
475 	Tcl_Obj    *onValue;
476 	Tcl_Obj    *offValue;
477 	int        inSetVar;
478 } GnoclToggleParams;
479 
480 
481 /**
482  * AUTHOR
483  *  PGB
484  * SOURCE
485  */
486 
487 typedef struct
488 {
489 	char          *name;
490 	char          *variable;
491 	char          *onValueChanged;
492 	GtkSpinButton *spinButton;
493 	Tcl_Interp    *interp;
494 	int           inSetVar;
495 } SpinButtonParams;
496 
497 
498 typedef struct
499 {
500 	GKeyFile 	*keyFile;
501 	char        *name;
502 	char		*fname;
503 	Tcl_Interp    *interp;
504 } KeyFileParams;
505 
506 
507 
508 /*
509  * file & folderChooseButton declarations
510  */
511 int gnoclFileChooserButtonCmd ( ClientData data, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[] );
512 int gnoclFolderChooserButtonCmd ( ClientData data, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[] );
513 
514 
515 /*
516  *
517  */
518 int gnoclDrawingAreaCmd ( ClientData data, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[] );
519 
520 void gnoclToggleDestroyFunc ( GtkWidget *widget, gpointer data );
521 int gnoclToggleToggle ( Tcl_Interp *interp, int objc, Tcl_Obj * const objv[], GnoclToggleParams *para );
522 int gnoclToggleSetActive ( GnoclToggleParams *para, GnoclOption *active );
523 int gnoclToggleSetValue ( GnoclToggleParams *para, Tcl_Obj *obj );
524 void gnoclToggleToggledFunc ( GtkWidget *widget, gpointer data );
525 char *gnoclToggleTraceFunc ( ClientData data, Tcl_Interp *interp, const char *name1, const char *name2, int flags );
526 int gnoclToggleVariableValueChanged ( GnoclToggleParams *para );
527 int gnoclToggleButtonCmd ( ClientData data, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[] );
528 int gnoclHandleBoxCmd ( ClientData data, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[] );
529 int gnoclAssistantCmd ( ClientData data, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[] );
530 
531 /*
532  * VteTerminal widget stuff - this belongs to the VTE package, not gnocl!
533  *
534  */
535 int gnoclVteTerminalCmd ( ClientData data, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[] );
536 
537 
538 /*
539  * checkButton declarations
540  */
541 /* in checkButton.c  for menuCheckItem and toolBar checkItem */
542 
543 typedef struct
544 {
545 	char       *name;
546 	Tcl_Interp *interp;
547 	GtkWidget  *widget;
548 	char       *onToggled;
549 	char       *variable;
550 	Tcl_Obj    *onValue;
551 	Tcl_Obj    *offValue;
552 	int        inSetVar;
553 } GnoclCheckParams;
554 
555 typedef struct
556 {
557 	char       *name;
558 	Tcl_Interp *interp;
559 	GtkToggleAction  *item;
560 	char       *onToggled;
561 	char       *variable;
562 	Tcl_Obj    *onValue;
563 	Tcl_Obj    *offValue;
564 	int        inSetVar;
565 } GnoclToolBarCheckParams;
566 
567 
568 int gnoclCheckIsOn ( Tcl_Interp *interp, Tcl_Obj *onValue, Tcl_Obj *offValue, Tcl_Obj *val );
569 void gnoclCheckDestroyFunc ( GtkWidget *widget, gpointer data );
570 void gnoclCheckToggledFunc ( GtkWidget *widget, gpointer data );
571 char *gnoclCheckTraceFunc ( ClientData data, Tcl_Interp *interp, const char *name1, const char *name2, int flags );
572 int gnoclCheckSetValue ( GnoclCheckParams *para, Tcl_Obj *obj );
573 int gnoclCheckOnToggled ( Tcl_Interp *interp, int objc, Tcl_Obj * const objv[], GnoclCheckParams *para );
574 int gnoclCheckSetActive ( GnoclCheckParams *para, GnoclOption *opt );
575 int gnoclCheckVariableValueChanged ( GnoclCheckParams *para );
576 
577 /* in radioButton.c  for menuRadioItem */
578 
579 typedef struct
580 {
581 	Tcl_Interp *interp;
582 	GArray     *widgets;
583 	int        inSetVar;
584 	char       *variable;
585 	//GSList     *list;
586 	/* grouping for toolbar item */
587 } GnoclRadioGroup;
588 
589 /*
590  * radioButton declarations
591  */
592 typedef struct
593 {
594 	char            *name;
595 	GnoclRadioGroup *group;
596 	GtkWidget       *widget;
597 	char            *onToggled;
598 	Tcl_Obj         *onValue;
599 } GnoclRadioParams;
600 
601 
602 /*
603  * radioButton declarations
604  */
605 
606 GnoclRadioGroup *gnoclRadioGroupNewGroup ( const char *var, Tcl_Interp *interp );
607 int gnoclRadioGroupAddWidgetToGroup ( GnoclRadioGroup *group, GnoclRadioParams *para );
608 int gnoclRadioRemoveWidgetFromGroup ( GnoclRadioGroup *group, GnoclRadioParams *para );
609 GnoclRadioParams *gnoclRadioGetActivePara ( GnoclRadioGroup *group );
610 GnoclRadioGroup *gnoclRadioGetGroupFromVariable ( const char *var );
611 GnoclRadioParams *gnoclRadioGetParam ( GnoclRadioGroup *group, int n );
612 int gnoclRadioSetValueActive ( GnoclRadioParams *para, GnoclOption *value, GnoclOption *active );
613 void gnoclRadioDestroyFunc ( GtkWidget *widget, gpointer data );
614 void gnoclRadioToggledFunc ( GtkWidget *widget, gpointer data );
615 char *gnoclRadioTraceFunc ( ClientData data, Tcl_Interp *interp, const char *name1, const char *name2, int flags );
616 Tcl_Obj *gnoclRadioGetValue ( GnoclRadioParams *para );
617 int gnoclRadioSetValue ( GnoclRadioParams *para, Tcl_Obj *val );
618 int gnoclRadioOnToggled ( Tcl_Interp *interp, int objc, Tcl_Obj * const objv[], GnoclRadioParams *para );
619 
620 Tcl_ObjCmdProc gnoclDebugCmd;
621 Tcl_ObjCmdProc gnoclCallbackCmd;
622 Tcl_ObjCmdProc gnoclClipboardCmd;
623 Tcl_ObjCmdProc gnoclConfigureCmd;
624 Tcl_ObjCmdProc gnoclInfoCmd;
625 Tcl_ObjCmdProc gnoclMainLoop;
626 Tcl_ObjCmdProc gnoclUpdateCmd;
627 Tcl_ObjCmdProc gnoclResourceFileCmd;
628 Tcl_ObjCmdProc gnoclGetStyleCmd;
629 Tcl_ObjCmdProc gnoclSetStyleCmd;
630 Tcl_ObjCmdProc gnoclWinfoCmd;
631 Tcl_ObjCmdProc gnoclScreenCmd;
632 Tcl_ObjCmdProc gnoclPrintCmd;
633 Tcl_ObjCmdProc gnoclPixBufCmd;
634 Tcl_ObjCmdProc gnoclPixMapCmd;
635 Tcl_ObjCmdProc gnoclClr2RGBCmd;
636 Tcl_ObjCmdProc gnoclRGB2HexCmd;
637 Tcl_ObjCmdProc gnoclParseColorCmd;
638 Tcl_ObjCmdProc gnoclStatusIconCmd;
639 Tcl_ObjCmdProc gnoclSplashScreenCmd;
640 Tcl_ObjCmdProc gnoclAboutDialogCmd;
641 Tcl_ObjCmdProc gnoclActionCmd;
642 Tcl_ObjCmdProc gnoclButtonCmd;
643 Tcl_ObjCmdProc gnoclBoxCmd;
644 
645 Tcl_ObjCmdProc gnoclHBoxCmd;
646 Tcl_ObjCmdProc gnoclVBoxCmd;
647 
648 Tcl_ObjCmdProc gnoclFixedCmd;
649 Tcl_ObjCmdProc gnoclCheckButtonCmd;
650 Tcl_ObjCmdProc gnoclColorButtonCmd;
651 Tcl_ObjCmdProc gnoclColorSelectionCmd;
652 Tcl_ObjCmdProc gnoclColorWheelCmd;
653 Tcl_ObjCmdProc gnoclComboBoxCmd;
654 Tcl_ObjCmdProc gnoclComboEntryCmd;
655 Tcl_ObjCmdProc gnoclComboCmd;
656 Tcl_ObjCmdProc gnoclDialogCmd;
657 Tcl_ObjCmdProc gnoclEntryCmd;
658 Tcl_ObjCmdProc gnoclEventBoxCmd;
659 Tcl_ObjCmdProc gnoclExpanderCmd;
660 Tcl_ObjCmdProc gnoclFileSelectionCmd;
661 Tcl_ObjCmdProc gnoclFileChooserCmd;
662 
663 Tcl_ObjCmdProc gnoclAcceleratorCmd;
664 
665 
666 /* move megawidgets into a separate package? */
667 Tcl_ObjCmdProc gnoclLabelEntryCmd;
668 
669 
670 /* anticipate some problems with this clashing old codes */
671 Tcl_ObjCmdProc gnoclFileChooserDialogCmd;
672 Tcl_ObjCmdProc gnoclFontSelectionDialogCmd;
673 Tcl_ObjCmdProc gnoclColorSelectionDialogCmd;
674 Tcl_ObjCmdProc gnoclFontButtonCmd;
675 Tcl_ObjCmdProc gnoclFontSelectionCmd;
676 Tcl_ObjCmdProc gnoclImageCmd;
677 Tcl_ObjCmdProc gnoclLabelCmd;
678 Tcl_ObjCmdProc gnoclListCmd;
679 Tcl_ObjCmdProc gnoclMenuCmd;
680 Tcl_ObjCmdProc gnoclMenuBarCmd;
681 Tcl_ObjCmdProc gnoclMenuItemCmd;
682 Tcl_ObjCmdProc gnoclMenuCheckItemCmd;
683 Tcl_ObjCmdProc gnoclMenuRadioItemCmd;
684 Tcl_ObjCmdProc gnoclMenuSeparatorCmd;
685 Tcl_ObjCmdProc gnoclNotebookCmd;
686 Tcl_ObjCmdProc gnoclOptionMenuCmd;
687 Tcl_ObjCmdProc gnoclPanedCmd;
688 Tcl_ObjCmdProc gnoclToolPaletteCmd;
689 Tcl_ObjCmdProc gnoclToolItemGroupCmd;
690 Tcl_ObjCmdProc gnoclPlugCmd;
691 Tcl_ObjCmdProc gnoclProgressBarCmd;
692 
693 Tcl_ObjCmdProc gnoclPBarCmd;
694 
695 Tcl_ObjCmdProc gnoclRadioButtonCmd;
696 Tcl_ObjCmdProc gnoclScaleCmd;
697 Tcl_ObjCmdProc gnoclScrolledWindowCmd;
698 Tcl_ObjCmdProc gnoclSeparatorCmd;
699 Tcl_ObjCmdProc gnoclSocketCmd;
700 Tcl_ObjCmdProc gnoclSpinButtonCmd;
701 Tcl_ObjCmdProc gnoclStatusBarCmd;
702 Tcl_ObjCmdProc gnoclTableCmd;
703 Tcl_ObjCmdProc gnoclTextCmd;
704 Tcl_ObjCmdProc gnoclTextViewCmd;
705 //Tcl_ObjCmdProc gnoclClockCmd;
706 Tcl_ObjCmdProc gnoclTickerTapeCmd;
707 Tcl_ObjCmdProc gnoclToolBarCmd;
708 Tcl_ObjCmdProc gnoclTreeCmd;
709 Tcl_ObjCmdProc gnoclWindowCmd;
710 Tcl_ObjCmdProc gnoclCalendarCmd;
711 Tcl_ObjCmdProc gnoclCurveCmd;
712 Tcl_ObjCmdProc gnoclGammaCurveCmd;
713 Tcl_ObjCmdProc gnoclRulerCmd;
714 Tcl_ObjCmdProc gnoclInfoBarCmd;
715 Tcl_ObjCmdProc gnoclLayoutCmd;
716 Tcl_ObjCmdProc gnoclAspectFrameCmd;
717 Tcl_ObjCmdProc gnoclIconViewCmd;
718 Tcl_ObjCmdProc gnoclAssistantCmd;
719 
720 /* some simple megawidgets */
721 Tcl_ObjCmdProc gnoclLabelEntryCmd;
722 
723 /* extra debugging func */
724 Tcl_ObjCmdProc gnoclPutsOb;
725 
726 /* some miscellaneous functions */
727 Tcl_ObjCmdProc gnoclSignalStopCmd;
728 Tcl_ObjCmdProc gnoclSignalEmitCmd;
729 Tcl_ObjCmdProc gnoclBeepCmd;
730 Tcl_ObjCmdProc gnoclCommandsCmd;
731 Tcl_ObjCmdProc gnoclHsv2RgbCmd;
732 Tcl_ObjCmdProc gnoclStringCmd;
733 Tcl_ObjCmdProc gnoclBindCmd;
734 Tcl_ObjCmdProc gnoclStockItemCmd;
735 Tcl_ObjCmdProc gnoclSoundCmd;
736 Tcl_ObjCmdProc gnoclPointerCmd;
737 Tcl_ObjCmdProc gnoclExecCmd;
738 Tcl_ObjCmdProc gnoclToggleCmd;
739 Tcl_ObjCmdProc gnoclSetPropertyCmd;
740 Tcl_ObjCmdProc gnoclSetOpts;
741 Tcl_ObjCmdProc gnoclShowUriCmd;
742 //Tcl_ObjCmdProc gnoclCairoCmd;
743 Tcl_ObjCmdProc gnoclToolTip;
744 
745 Tcl_ObjCmdProc gnoclGrabCmd;
746 
747 #ifdef GNOCL_USE_GNOME
748 Tcl_ObjCmdProc gnoclAboutCmd;
749 Tcl_ObjCmdProc gnoclAppCmd;
750 Tcl_ObjCmdProc gnoclAppBarCmd;
751 #endif
752 
753 #endif
754 
755 /* the following constructors now need to be made public in order to run glade */
756 
757 int setGtkWidgetFunc ( Tcl_Interp *interp, GtkWidget *widget, int idx, Tcl_Obj *resList , gchar *gladeName, char *name );
758 
759 typedef int ( gnoclWidgetFunc ) ( ClientData data, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[] );
760 
761 gnoclWidgetFunc windowFunc;
762 gnoclWidgetFunc textViewFunc;
763 gnoclWidgetFunc labelFunc;
764 gnoclWidgetFunc toolButtonFunc;
765 gnoclWidgetFunc statusBarFuc;
766 gnoclWidgetFunc toolBarFunc;
767 gnoclWidgetFunc buttonFunc;
768 gnoclWidgetFunc entryFunc;
769 gnoclWidgetFunc toggleButtonFunc;
770 gnoclWidgetFunc boxFunc;
771 gnoclWidgetFunc menuBarFunc;
772 gnoclWidgetFunc menuFunc;
773 gnoclWidgetFunc menuItemFunc;
774 gnoclWidgetFunc checkButtonFunc;
775 gnoclWidgetFunc spinButtonFunc;
776 gnoclWidgetFunc radioButtonFunc;
777 gnoclWidgetFunc fileChooserButtonFunc;
778 gnoclWidgetFunc clrButtonFunc;
779 gnoclWidgetFunc fontButtonFunc;
780 gnoclWidgetFunc linkButtonFunc;
781 gnoclWidgetFunc scaleButtonFunc;
782 gnoclWidgetFunc volumeButtonFunc;
783 gnoclWidgetFunc imageFunc;
784 gnoclWidgetFunc scaleFunc;
785 gnoclWidgetFunc scrollFunc;
786 gnoclWidgetFunc comboBoxFunc;
787 gnoclWidgetFunc progressBarFunc;
788 gnoclWidgetFunc treeListFunc;
789 gnoclWidgetFunc iconViewFunc;
790 gnoclWidgetFunc handleBoxFunc;
791 gnoclWidgetFunc calendarFunc;
792 gnoclWidgetFunc separatorFunc;
793 gnoclWidgetFunc arrowButtonFunc;
794 gnoclWidgetFunc drawingAreaFunc;
795 gnoclWidgetFunc recentChooserFunc;
796 gnoclWidgetFunc aboutDialogFunc;
797 gnoclWidgetFunc dialogFunc;
798 gnoclWidgetFunc colorSelDialogFunc;
799 gnoclWidgetFunc colorSelectionFunc;
800 gnoclWidgetFunc fileDialogFunc;
801 gnoclWidgetFunc expanderFunc;
802 gnoclWidgetFunc scrlWindowFunc;
803 gnoclWidgetFunc fontSelDialogFunc;
804 gnoclWidgetFunc inputDialogFunc;
805 gnoclWidgetFunc recentChooserDialogFunc;
806 gnoclWidgetFunc assistantFunc;
807 gnoclWidgetFunc accelaratorFunc;
808 gnoclWidgetFunc panedFunc;
809 gnoclWidgetFunc notebookFunc;
810 gnoclWidgetFunc eventBoxFunc;
811 gnoclWidgetFunc fileChooserFunc;
812 
813 /* whole block removed into gnoclparams.h */
814 
815 
816 /* appended by module-assistant-pkg */
817 Tcl_ObjCmdProc gnoclTextBufferCmd;
818 
819 /* used in creating lists from widget and pixbuf hashtables */
820 void hash_to_list ( gpointer key, gpointer value, gpointer user_data );
821 gint sorter ( gconstpointer a, gconstpointer b );
822 
823 int pixBufFunc ( ClientData data, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[] );
824 
825 void gtk_text_buffer_insert_markup ( GtkTextBuffer *buffer, GtkTextIter *iter, const gchar *markup );
826 
827