diff options
author | ericm <ericm> | 2000-11-22 01:49:37 (GMT) |
---|---|---|
committer | ericm <ericm> | 2000-11-22 01:49:37 (GMT) |
commit | de39e31b0e2fe25bdace0f7cc595bf23c3b50647 (patch) | |
tree | b3d9ff19b6b8294780db27da55671e4ef2f9fd75 /generic | |
parent | 5f087931231b7d843af1631a08f139365b35975c (diff) | |
download | tk-de39e31b0e2fe25bdace0f7cc595bf23c3b50647.zip tk-de39e31b0e2fe25bdace0f7cc595bf23c3b50647.tar.gz tk-de39e31b0e2fe25bdace0f7cc595bf23c3b50647.tar.bz2 |
Overall change: Implemented TIP 5, which exports
TkClassProcs/TkSetClassProcs as Tk_ClassProcs/Tk_SetClassProcs,
adding a size field to Tk_ClassProcs to allow for future
expansion, and renaming the geometryProc to worldChangedProc,
which is more in keeping with the actual use of the callback.
See ChangeLog for details.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tk.decls | 7 | ||||
-rw-r--r-- | generic/tk.h | 47 | ||||
-rw-r--r-- | generic/tkBind.c | 9 | ||||
-rw-r--r-- | generic/tkButton.c | 4 | ||||
-rw-r--r-- | generic/tkButton.h | 4 | ||||
-rw-r--r-- | generic/tkCanvas.c | 11 | ||||
-rw-r--r-- | generic/tkDecls.h | 11 | ||||
-rw-r--r-- | generic/tkEntry.c | 13 | ||||
-rw-r--r-- | generic/tkFont.c | 28 | ||||
-rw-r--r-- | generic/tkFrame.c | 4 | ||||
-rw-r--r-- | generic/tkInt.decls | 11 | ||||
-rw-r--r-- | generic/tkInt.h | 30 | ||||
-rw-r--r-- | generic/tkIntDecls.h | 14 | ||||
-rw-r--r-- | generic/tkListbox.c | 11 | ||||
-rw-r--r-- | generic/tkMenu.c | 12 | ||||
-rw-r--r-- | generic/tkMenubutton.c | 4 | ||||
-rw-r--r-- | generic/tkMenubutton.h | 4 | ||||
-rw-r--r-- | generic/tkMessage.c | 13 | ||||
-rw-r--r-- | generic/tkScale.c | 11 | ||||
-rw-r--r-- | generic/tkScrollbar.c | 4 | ||||
-rw-r--r-- | generic/tkScrollbar.h | 4 | ||||
-rw-r--r-- | generic/tkStubInit.c | 5 | ||||
-rw-r--r-- | generic/tkText.c | 11 | ||||
-rw-r--r-- | generic/tkWindow.c | 16 |
24 files changed, 166 insertions, 122 deletions
diff --git a/generic/tk.decls b/generic/tk.decls index ef1057d..d9b4a32 100644 --- a/generic/tk.decls +++ b/generic/tk.decls @@ -11,7 +11,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: tk.decls,v 1.13 2000/10/21 21:22:42 ericm Exp $ +# RCS: @(#) $Id: tk.decls,v 1.14 2000/11/22 01:49:37 ericm Exp $ library tk @@ -1142,7 +1142,10 @@ declare 241 generic { Tk_Window Tk_CreateAnonymousWindow (Tcl_Interp *interp, \ Tk_Window parent, char *screenName) } - +declare 242 generic { + void Tk_SetClassProcs (Tk_Window tkwin, \ + Tk_ClassProcs *procs, ClientData instanceData) +} # Define the platform specific public Tk interface. These functions are # only available on the designated platform. diff --git a/generic/tk.h b/generic/tk.h index 206c864..d91da04 100644 --- a/generic/tk.h +++ b/generic/tk.h @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tk.h,v 1.52 2000/10/05 18:31:25 ericm Exp $ + * RCS: @(#) $Id: tk.h,v 1.53 2000/11/22 01:49:37 ericm Exp $ */ #ifndef _TK @@ -548,6 +548,51 @@ typedef struct Tk_FontMetrics { #define TK_IGNORE_NEWLINES 16 /* + * Widget class procedures used to implement platform specific widget + * behavior. + */ + +typedef Window (Tk_ClassCreateProc) _ANSI_ARGS_((Tk_Window tkwin, + Window parent, ClientData instanceData)); +typedef void (Tk_ClassWorldChangedProc) _ANSI_ARGS_((ClientData instanceData)); +typedef void (Tk_ClassModalProc) _ANSI_ARGS_((Tk_Window tkwin, + XEvent *eventPtr)); + +typedef struct Tk_ClassProcs { + unsigned int size; + Tk_ClassWorldChangedProc *worldChangedProc; + /* Procedure to invoke when the widget needs to + * respond in some way to a change in the + * world (font changes, etc.) */ + Tk_ClassCreateProc *createProc; + /* Procedure to invoke when the + * platform-dependent window needs to be + * created. */ + Tk_ClassModalProc *modalProc; + /* Procedure to invoke after all bindings on a + * widget have been triggered in order to + * handle a modal loop. */ +} Tk_ClassProcs; + +/* + * Simple accessor for Tk_ClassProcs structure. Checks that the structure + * is not NULL, then checks the size field and returns either the requested + * field, if present, or NULL if the structure is too small to have the field + * (or NULL if the structure is NULL). + * + * A more general version of this function may be useful if other + * size-versioned structure pop up in the future: + * + * #define Tk_GetField(name, who, which) \ + * (((who) == NULL) ? NULL : + * (((who)->size <= Tk_Offset(name, which)) ? NULL :(name)->which)) + */ + +#define Tk_GetClassProc(procs, which) \ + (((procs) == NULL) ? NULL : \ + (((procs)->size <= Tk_Offset(Tk_ClassProcs, which)) ? NULL:(procs)->which)) + +/* * Each geometry manager (the packer, the placer, etc.) is represented * by a structure of the following form, which indicates procedures * to invoke in the geometry manager to carry out certain functions. diff --git a/generic/tkBind.c b/generic/tkBind.c index e105d4d..71e5db1 100644 --- a/generic/tkBind.c +++ b/generic/tkBind.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkBind.c,v 1.13 2000/04/19 01:06:50 ericm Exp $ + * RCS: @(#) $Id: tkBind.c,v 1.14 2000/11/22 01:49:37 ericm Exp $ */ #include "tkPort.h" @@ -1426,7 +1426,7 @@ Tk_BindEvent(bindingTable, eventPtr, tkwin, numObjects, objectPtr) PendingBinding staticPending; TkWindow *winPtr = (TkWindow *)tkwin; PatternTableKey key; - + Tk_ClassModalProc *modalProc; /* * Ignore events on windows that don't have names: these are windows * like wrapper windows that shouldn't be visible to the @@ -1805,7 +1805,10 @@ Tk_BindEvent(bindingTable, eventPtr, tkwin, numObjects, objectPtr) winPtr->flags = (winPtr->flags & (unsigned int) ~TK_DEFER_MODAL) | (flags & TK_DEFER_MODAL); if (deferModal) { - (*winPtr->classProcsPtr->modalProc)(tkwin, eventPtr); + modalProc = Tk_GetClassProc(winPtr->classProcsPtr, modalProc); + if (modalProc != NULL) { + (*modalProc)(tkwin, eventPtr); + } } } diff --git a/generic/tkButton.c b/generic/tkButton.c index ea2c10a..23bc057 100644 --- a/generic/tkButton.c +++ b/generic/tkButton.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkButton.c,v 1.11 2000/10/01 21:35:27 ericm Exp $ + * RCS: @(#) $Id: tkButton.c,v 1.12 2000/11/22 01:49:37 ericm Exp $ */ #include "tkButton.h" @@ -658,7 +658,7 @@ ButtonCreate(clientData, interp, objc, objv, type) Tk_SetClass(tkwin, classNames[type]); butPtr = TkpCreateButton(tkwin); - TkSetClassProcs(tkwin, &tkpButtonProcs, (ClientData) butPtr); + Tk_SetClassProcs(tkwin, &tkpButtonProcs, (ClientData) butPtr); /* * Initialize the data structure for the button. diff --git a/generic/tkButton.h b/generic/tkButton.h index 97cc1f0..6469d46 100644 --- a/generic/tkButton.h +++ b/generic/tkButton.h @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkButton.h,v 1.7 2000/05/17 21:17:20 ericm Exp $ + * RCS: @(#) $Id: tkButton.h,v 1.8 2000/11/22 01:49:37 ericm Exp $ */ #ifndef _TKBUTTON @@ -287,7 +287,7 @@ typedef struct { * Declaration of variables shared between the files in the button module. */ -extern TkClassProcs tkpButtonProcs; +extern Tk_ClassProcs tkpButtonProcs; /* * Declaration of procedures used in the implementation of the button diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c index 709375a..0820e02 100644 --- a/generic/tkCanvas.c +++ b/generic/tkCanvas.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkCanvas.c,v 1.14 2000/04/14 08:33:15 hobbs Exp $ + * RCS: @(#) $Id: tkCanvas.c,v 1.15 2000/11/22 01:49:37 ericm Exp $ */ /* #define USE_OLD_TAG_SEARCH 1 */ @@ -330,10 +330,9 @@ static Tk_Item * TagSearchNext _ANSI_ARGS_((TagSearch *searchPtr)); * that can be invoked from generic window code. */ -static TkClassProcs canvasClass = { - NULL, /* createProc. */ - CanvasWorldChanged, /* geometryProc. */ - NULL /* modalProc. */ +static Tk_ClassProcs canvasClass = { + sizeof(Tk_ClassProcs), /* size */ + CanvasWorldChanged, /* worldChangedProc */ }; @@ -467,7 +466,7 @@ Tk_CanvasObjCmd(clientData, interp, argc, argv) Tcl_InitHashTable(&canvasPtr->idTable, TCL_ONE_WORD_KEYS); Tk_SetClass(canvasPtr->tkwin, "Canvas"); - TkSetClassProcs(canvasPtr->tkwin, &canvasClass, (ClientData) canvasPtr); + Tk_SetClassProcs(canvasPtr->tkwin, &canvasClass, (ClientData) canvasPtr); Tk_CreateEventHandler(canvasPtr->tkwin, ExposureMask|StructureNotifyMask|FocusChangeMask, CanvasEventProc, (ClientData) canvasPtr); diff --git a/generic/tkDecls.h b/generic/tkDecls.h index 31f5808..e4753e1 100644 --- a/generic/tkDecls.h +++ b/generic/tkDecls.h @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkDecls.h,v 1.13 2000/10/05 18:31:25 ericm Exp $ + * RCS: @(#) $Id: tkDecls.h,v 1.14 2000/11/22 01:49:37 ericm Exp $ */ #ifndef _TKDECLS @@ -830,6 +830,10 @@ EXTERN void Tk_DeleteClientMessageHandler _ANSI_ARGS_(( EXTERN Tk_Window Tk_CreateAnonymousWindow _ANSI_ARGS_(( Tcl_Interp * interp, Tk_Window parent, char * screenName)); +/* 242 */ +EXTERN void Tk_SetClassProcs _ANSI_ARGS_((Tk_Window tkwin, + Tk_ClassProcs * procs, + ClientData instanceData)); typedef struct TkStubHooks { struct TkPlatStubs *tkPlatStubs; @@ -1084,6 +1088,7 @@ typedef struct TkStubs { void (*tk_CreateClientMessageHandler) _ANSI_ARGS_((Tk_ClientMessageProc * proc)); /* 239 */ void (*tk_DeleteClientMessageHandler) _ANSI_ARGS_((Tk_ClientMessageProc * proc)); /* 240 */ Tk_Window (*tk_CreateAnonymousWindow) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window parent, char * screenName)); /* 241 */ + void (*tk_SetClassProcs) _ANSI_ARGS_((Tk_Window tkwin, Tk_ClassProcs * procs, ClientData instanceData)); /* 242 */ } TkStubs; #ifdef __cplusplus @@ -2062,6 +2067,10 @@ extern TkStubs *tkStubsPtr; #define Tk_CreateAnonymousWindow \ (tkStubsPtr->tk_CreateAnonymousWindow) /* 241 */ #endif +#ifndef Tk_SetClassProcs +#define Tk_SetClassProcs \ + (tkStubsPtr->tk_SetClassProcs) /* 242 */ +#endif #endif /* defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS) */ diff --git a/generic/tkEntry.c b/generic/tkEntry.c index f9031b9..4a01d12 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkEntry.c,v 1.17 2000/05/29 01:43:14 hobbs Exp $ + * RCS: @(#) $Id: tkEntry.c,v 1.18 2000/11/22 01:49:37 ericm Exp $ */ #include "tkInt.h" @@ -736,10 +736,9 @@ static int ComputeFormat _ANSI_ARGS_((Spinbox *sbPtr)); * that can be invoked from generic window code. */ -static TkClassProcs entryClass = { - NULL, /* createProc. */ - EntryWorldChanged, /* geometryProc. */ - NULL /* modalProc. */ +static Tk_ClassProcs entryClass = { + sizeof(Tk_ClassProcs), /* size */ + EntryWorldChanged, /* worldChangedProc */ }; @@ -839,7 +838,7 @@ Tk_EntryObjCmd(clientData, interp, objc, objv) entryPtr->validate = VALIDATE_NONE; Tk_SetClass(entryPtr->tkwin, "Entry"); - TkSetClassProcs(entryPtr->tkwin, &entryClass, (ClientData) entryPtr); + Tk_SetClassProcs(entryPtr->tkwin, &entryClass, (ClientData) entryPtr); Tk_CreateEventHandler(entryPtr->tkwin, ExposureMask|StructureNotifyMask|FocusChangeMask, EntryEventProc, (ClientData) entryPtr); @@ -3740,7 +3739,7 @@ Tk_SpinboxObjCmd(clientData, interp, objc, objv) sbPtr->buRelief = TK_RELIEF_FLAT; Tk_SetClass(entryPtr->tkwin, "Spinbox"); - TkSetClassProcs(entryPtr->tkwin, &entryClass, (ClientData) entryPtr); + Tk_SetClassProcs(entryPtr->tkwin, &entryClass, (ClientData) entryPtr); Tk_CreateEventHandler(entryPtr->tkwin, PointerMotionMask|ExposureMask|StructureNotifyMask|FocusChangeMask, EntryEventProc, (ClientData) entryPtr); diff --git a/generic/tkFont.c b/generic/tkFont.c index 913c335..b5a4c2c 100644 --- a/generic/tkFont.c +++ b/generic/tkFont.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkFont.c,v 1.10 2000/02/03 21:27:26 ericm Exp $ + * RCS: @(#) $Id: tkFont.c,v 1.11 2000/11/22 01:49:38 ericm Exp $ */ #include "tkPort.h" @@ -831,10 +831,30 @@ static void RecomputeWidgets(winPtr) TkWindow *winPtr; /* Window to which command is sent. */ { - if ((winPtr->classProcsPtr != NULL) - && (winPtr->classProcsPtr->geometryProc != NULL)) { - (*winPtr->classProcsPtr->geometryProc)(winPtr->instanceData); + Tk_ClassWorldChangedProc *proc; + proc = Tk_GetClassProc(winPtr->classProcsPtr, worldChangedProc); + if (proc != NULL) { + (*proc)(winPtr->instanceData); } + + /* + * Notify all the descendants of this window that the world has changed. + * + * This could be done recursively or iteratively. The recursive version + * is easier to implement and understand, and typically, windows with a + * -font option will be leaf nodes in the widget heirarchy (buttons, + * labels, etc.), so the recursion depth will be shallow. + * + * However, the additional overhead of the recursive calls may become + * a performance problem if typical usage alters such that -font'ed widgets + * appear high in the heirarchy, causing deep recursion. This could happen + * with text widgets, or more likely with the (not yet existant) labeled + * frame widget. With these widgets it is possible, even likely, that a + * -font'ed widget (text or labeled frame) will not be a leaf node, but + * will instead have many descendants. If this is ever found to cause + * a performance problem, it may be worth investigating an iterative + * version of the code below. + */ for (winPtr = winPtr->childList; winPtr != NULL; winPtr = winPtr->nextPtr) { RecomputeWidgets(winPtr); } diff --git a/generic/tkFrame.c b/generic/tkFrame.c index 3ebe0f2..cf356ce 100644 --- a/generic/tkFrame.c +++ b/generic/tkFrame.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkFrame.c,v 1.6 2000/02/10 08:52:32 hobbs Exp $ + * RCS: @(#) $Id: tkFrame.c,v 1.7 2000/11/22 01:49:38 ericm Exp $ */ #include "default.h" @@ -451,7 +451,7 @@ CreateFrame(clientData, interp, objc, objv, toplevel, appName) /* * Store backreference to frame widget in window structure. */ - TkSetClassProcs(new, NULL, (ClientData) framePtr); + Tk_SetClassProcs(new, NULL, (ClientData) framePtr); mask = ExposureMask | StructureNotifyMask | FocusChangeMask; if (toplevel) { diff --git a/generic/tkInt.decls b/generic/tkInt.decls index 94112c1..c3405dc 100644 --- a/generic/tkInt.decls +++ b/generic/tkInt.decls @@ -9,7 +9,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: tkInt.decls,v 1.18 2000/11/21 16:18:05 dkf Exp $ +# RCS: @(#) $Id: tkInt.decls,v 1.19 2000/11/22 01:49:38 ericm Exp $ library tk @@ -396,10 +396,11 @@ declare 83 generic { void TkSelPropProc (XEvent *eventPtr) } -declare 84 generic { - void TkSetClassProcs (Tk_Window tkwin, \ - TkClassProcs *procs, ClientData instanceData) -} +# Exported publically as Tk_SetClassProcs in 8.4a2 +#declare 84 generic { +# void TkSetClassProcs (Tk_Window tkwin, \ +# TkClassProcs *procs, ClientData instanceData) +#} declare 85 generic { void TkSetWindowMenuBar (Tcl_Interp *interp, \ diff --git a/generic/tkInt.h b/generic/tkInt.h index de0c907..bd7764f 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: $Id: tkInt.h,v 1.33 2000/08/08 19:21:19 ericm Exp $ + * RCS: $Id: tkInt.h,v 1.34 2000/11/22 01:49:38 ericm Exp $ */ #ifndef _TKINT @@ -46,32 +46,6 @@ typedef int (TkBindEvalProc) _ANSI_ARGS_((ClientData clientData, Tcl_Interp *interp, XEvent *eventPtr, Tk_Window tkwin, KeySym keySym)); typedef void (TkBindFreeProc) _ANSI_ARGS_((ClientData clientData)); -typedef Window (TkClassCreateProc) _ANSI_ARGS_((Tk_Window tkwin, - Window parent, ClientData instanceData)); -typedef void (TkClassGeometryProc) _ANSI_ARGS_((ClientData instanceData)); -typedef void (TkClassModalProc) _ANSI_ARGS_((Tk_Window tkwin, - XEvent *eventPtr)); - - -/* - * Widget class procedures used to implement platform specific widget - * behavior. - */ - -typedef struct TkClassProcs { - TkClassCreateProc *createProc; - /* Procedure to invoke when the - platform-dependent window needs to be - created. */ - TkClassGeometryProc *geometryProc; - /* Procedure to invoke when the geometry of a - window needs to be recalculated as a result - of some change in the system. */ - TkClassModalProc *modalProc; - /* Procedure to invoke after all bindings on a - widget have been triggered in order to - handle a modal loop. */ -} TkClassProcs; /* * One of the following structures is maintained for each cursor in @@ -782,7 +756,7 @@ typedef struct TkWindow { * Information used by widget classes. */ - TkClassProcs *classProcsPtr; + Tk_ClassProcs *classProcsPtr; ClientData instanceData; /* diff --git a/generic/tkIntDecls.h b/generic/tkIntDecls.h index 4ae9367..e8e4250 100644 --- a/generic/tkIntDecls.h +++ b/generic/tkIntDecls.h @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkIntDecls.h,v 1.11 2000/11/21 16:18:05 dkf Exp $ + * RCS: @(#) $Id: tkIntDecls.h,v 1.12 2000/11/22 01:49:38 ericm Exp $ */ #ifndef _TKINTDECLS @@ -289,10 +289,7 @@ EXTERN void TkSelEventProc _ANSI_ARGS_((Tk_Window tkwin, EXTERN void TkSelInit _ANSI_ARGS_((Tk_Window tkwin)); /* 83 */ EXTERN void TkSelPropProc _ANSI_ARGS_((XEvent * eventPtr)); -/* 84 */ -EXTERN void TkSetClassProcs _ANSI_ARGS_((Tk_Window tkwin, - TkClassProcs * procs, - ClientData instanceData)); +/* Slot 84 is reserved */ /* 85 */ EXTERN void TkSetWindowMenuBar _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, char * oldMenuName, @@ -606,7 +603,7 @@ typedef struct TkIntStubs { void (*tkSelEventProc) _ANSI_ARGS_((Tk_Window tkwin, XEvent * eventPtr)); /* 81 */ void (*tkSelInit) _ANSI_ARGS_((Tk_Window tkwin)); /* 82 */ void (*tkSelPropProc) _ANSI_ARGS_((XEvent * eventPtr)); /* 83 */ - void (*tkSetClassProcs) _ANSI_ARGS_((Tk_Window tkwin, TkClassProcs * procs, ClientData instanceData)); /* 84 */ + void *reserved84; void (*tkSetWindowMenuBar) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, char * oldMenuName, char * menuName)); /* 85 */ KeySym (*tkStringToKeysym) _ANSI_ARGS_((char * name)); /* 86 */ int (*tkThickPolyLineToArea) _ANSI_ARGS_((double * coordPtr, int numPoints, double width, int capStyle, int joinStyle, double * rectPtr)); /* 87 */ @@ -1175,10 +1172,7 @@ extern TkIntStubs *tkIntStubsPtr; #define TkSelPropProc \ (tkIntStubsPtr->tkSelPropProc) /* 83 */ #endif -#ifndef TkSetClassProcs -#define TkSetClassProcs \ - (tkIntStubsPtr->tkSetClassProcs) /* 84 */ -#endif +/* Slot 84 is reserved */ #ifndef TkSetWindowMenuBar #define TkSetWindowMenuBar \ (tkIntStubsPtr->tkSetWindowMenuBar) /* 85 */ diff --git a/generic/tkListbox.c b/generic/tkListbox.c index d931ad7..25e8563 100644 --- a/generic/tkListbox.c +++ b/generic/tkListbox.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkListbox.c,v 1.18 2000/07/28 16:41:40 ericm Exp $ + * RCS: @(#) $Id: tkListbox.c,v 1.19 2000/11/22 01:49:38 ericm Exp $ */ #include "tkPort.h" @@ -434,10 +434,9 @@ static void MigrateHashEntries _ANSI_ARGS_ ((Tcl_HashTable *table, * that can be invoked from generic window code. */ -static TkClassProcs listboxClass = { - NULL, /* createProc. */ - ListboxWorldChanged, /* geometryProc. */ - NULL /* modalProc. */ +static Tk_ClassProcs listboxClass = { + sizeof(Tk_ClassProcs), /* size */ + ListboxWorldChanged, /* worldChangedProc */ }; @@ -576,7 +575,7 @@ Tk_ListboxObjCmd(clientData, interp, objc, objv) listPtr->flags = 0; Tk_SetClass(listPtr->tkwin, "Listbox"); - TkSetClassProcs(listPtr->tkwin, &listboxClass, (ClientData) listPtr); + Tk_SetClassProcs(listPtr->tkwin, &listboxClass, (ClientData) listPtr); Tk_CreateEventHandler(listPtr->tkwin, ExposureMask|StructureNotifyMask|FocusChangeMask, ListboxEventProc, (ClientData) listPtr); diff --git a/generic/tkMenu.c b/generic/tkMenu.c index 0aac47e..b539186 100644 --- a/generic/tkMenu.c +++ b/generic/tkMenu.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMenu.c,v 1.8 2000/08/03 20:36:16 ericm Exp $ + * RCS: @(#) $Id: tkMenu.c,v 1.9 2000/11/22 01:49:38 ericm Exp $ */ /* @@ -363,15 +363,15 @@ static void UnhookCascadeEntry _ANSI_ARGS_((TkMenuEntry *mePtr)); * the geometry proc to be called. */ -static TkClassProcs menuClass = { - NULL, /* createProc. */ - MenuWorldChanged /* geometryProc. */ +static Tk_ClassProcs menuClass = { + sizeof(Tk_ClassProcs), /* size */ + MenuWorldChanged /* worldChangedProc */ }; /* *-------------------------------------------------------------- * - * Tk_CreateMenuCmd -- + * TkCreateMenuCmd -- * * Called by Tk at initialization time to create the menu * command. @@ -523,7 +523,7 @@ MenuCmd(clientData, interp, objc, objv) TkMenuInitializeDrawingFields(menuPtr); Tk_SetClass(menuPtr->tkwin, "Menu"); - TkSetClassProcs(menuPtr->tkwin, &menuClass, (ClientData) menuPtr); + Tk_SetClassProcs(menuPtr->tkwin, &menuClass, (ClientData) menuPtr); if (Tk_InitOptions(interp, (char *) menuPtr, menuPtr->optionTablesPtr->menuOptionTable, menuPtr->tkwin) != TCL_OK) { diff --git a/generic/tkMenubutton.c b/generic/tkMenubutton.c index 6599269..bfe43d3 100644 --- a/generic/tkMenubutton.c +++ b/generic/tkMenubutton.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMenubutton.c,v 1.4 1999/04/24 01:50:49 stanton Exp $ + * RCS: @(#) $Id: tkMenubutton.c,v 1.5 2000/11/22 01:49:38 ericm Exp $ */ #include "tkMenubutton.h" @@ -240,7 +240,7 @@ Tk_MenubuttonObjCmd(clientData, interp, objc, objv) Tk_SetClass(tkwin, "Menubutton"); mbPtr = TkpCreateMenuButton(tkwin); - TkSetClassProcs(tkwin, &tkpMenubuttonClass, (ClientData) mbPtr); + Tk_SetClassProcs(tkwin, &tkpMenubuttonClass, (ClientData) mbPtr); /* * Initialize the data structure for the button. diff --git a/generic/tkMenubutton.h b/generic/tkMenubutton.h index eb7e030..979f23d 100644 --- a/generic/tkMenubutton.h +++ b/generic/tkMenubutton.h @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMenubutton.h,v 1.5 1999/04/16 01:51:19 stanton Exp $ + * RCS: @(#) $Id: tkMenubutton.h,v 1.6 2000/11/22 01:49:38 ericm Exp $ */ #ifndef _TKMENUBUTTON @@ -211,7 +211,7 @@ typedef struct { * Declaration of variables shared between the files in the button module. */ -extern TkClassProcs tkpMenubuttonClass; +extern Tk_ClassProcs tkpMenubuttonClass; /* * Declaration of procedures used in the implementation of the button diff --git a/generic/tkMessage.c b/generic/tkMessage.c index e42b581..5a3b3e1 100644 --- a/generic/tkMessage.c +++ b/generic/tkMessage.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMessage.c,v 1.8 2000/09/06 19:02:01 hobbs Exp $ + * RCS: @(#) $Id: tkMessage.c,v 1.9 2000/11/22 01:49:38 ericm Exp $ */ #include "tkPort.h" @@ -195,17 +195,16 @@ static void DisplayMessage _ANSI_ARGS_((ClientData clientData)); * that can be invoked from generic window code. */ -static TkClassProcs messageClass = { - NULL, /* createProc. */ - MessageWorldChanged, /* geometryProc. */ - NULL /* modalProc. */ +static Tk_ClassProcs messageClass = { + sizeof(Tk_ClassProcs), /* size */ + MessageWorldChanged, /* worldChangedProc */ }; /* *-------------------------------------------------------------- * - * Tk_MessageCmd -- + * Tk_MessageObjCmd -- * * This procedure is invoked to process the "message" Tcl * command. See the user documentation for details on what @@ -282,7 +281,7 @@ Tk_MessageObjCmd(clientData, interp, objc, objv) msgPtr->cursor = None; Tk_SetClass(msgPtr->tkwin, "Message"); - TkSetClassProcs(msgPtr->tkwin, &messageClass, (ClientData) msgPtr); + Tk_SetClassProcs(msgPtr->tkwin, &messageClass, (ClientData) msgPtr); Tk_CreateEventHandler(msgPtr->tkwin, ExposureMask|StructureNotifyMask|FocusChangeMask, MessageEventProc, (ClientData) msgPtr); diff --git a/generic/tkScale.c b/generic/tkScale.c index d81afb8..8327ab7 100644 --- a/generic/tkScale.c +++ b/generic/tkScale.c @@ -18,7 +18,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkScale.c,v 1.12 2000/04/14 08:33:16 hobbs Exp $ + * RCS: @(#) $Id: tkScale.c,v 1.13 2000/11/22 01:49:38 ericm Exp $ */ #include "tkPort.h" @@ -185,10 +185,9 @@ static void ScaleSetVariable _ANSI_ARGS_((TkScale *scalePtr)); * that can be invoked from generic window code. */ -static TkClassProcs scaleClass = { - NULL, /* createProc. */ - ScaleWorldChanged, /* geometryProc. */ - NULL /* modalProc. */ +static Tk_ClassProcs scaleClass = { + sizeof(Tk_ClassProcs), /* size */ + ScaleWorldChanged, /* worldChangedProc */ }; @@ -314,7 +313,7 @@ Tk_ScaleObjCmd(clientData, interp, objc, objv) scalePtr->takeFocusPtr = NULL; scalePtr->flags = NEVER_SET; - TkSetClassProcs(scalePtr->tkwin, &scaleClass, (ClientData) scalePtr); + Tk_SetClassProcs(scalePtr->tkwin, &scaleClass, (ClientData) scalePtr); Tk_CreateEventHandler(scalePtr->tkwin, ExposureMask|StructureNotifyMask|FocusChangeMask, ScaleEventProc, (ClientData) scalePtr); diff --git a/generic/tkScrollbar.c b/generic/tkScrollbar.c index eec060e..71e4e21 100644 --- a/generic/tkScrollbar.c +++ b/generic/tkScrollbar.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkScrollbar.c,v 1.4 1999/12/14 06:52:30 hobbs Exp $ + * RCS: @(#) $Id: tkScrollbar.c,v 1.5 2000/11/22 01:49:38 ericm Exp $ */ #include "tkPort.h" @@ -153,7 +153,7 @@ Tk_ScrollbarCmd(clientData, interp, argc, argv) Tk_SetClass(new, "Scrollbar"); scrollPtr = TkpCreateScrollbar(new); - TkSetClassProcs(new, &tkpScrollbarProcs, (ClientData) scrollPtr); + Tk_SetClassProcs(new, &tkpScrollbarProcs, (ClientData) scrollPtr); /* * Initialize fields that won't be initialized by ConfigureScrollbar, diff --git a/generic/tkScrollbar.h b/generic/tkScrollbar.h index 4e119e1..f16880a 100644 --- a/generic/tkScrollbar.h +++ b/generic/tkScrollbar.h @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkScrollbar.h,v 1.5 1999/12/14 06:52:30 hobbs Exp $ + * RCS: @(#) $Id: tkScrollbar.h,v 1.6 2000/11/22 01:49:38 ericm Exp $ */ #ifndef _TKSCROLLBAR @@ -171,7 +171,7 @@ typedef struct TkScrollbar { * Declaration of scrollbar class procedures structure. */ -extern TkClassProcs tkpScrollbarProcs; +extern Tk_ClassProcs tkpScrollbarProcs; /* * Declaration of scrollbar configuration options. diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c index 560fbb2..94263c5 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkStubInit.c,v 1.25 2000/11/21 16:18:05 dkf Exp $ + * RCS: @(#) $Id: tkStubInit.c,v 1.26 2000/11/22 01:49:38 ericm Exp $ */ #include "tkInt.h" @@ -131,7 +131,7 @@ TkIntStubs tkIntStubs = { TkSelEventProc, /* 81 */ TkSelInit, /* 82 */ TkSelPropProc, /* 83 */ - TkSetClassProcs, /* 84 */ + NULL, /* 84 */ TkSetWindowMenuBar, /* 85 */ TkStringToKeysym, /* 86 */ TkThickPolyLineToArea, /* 87 */ @@ -953,6 +953,7 @@ TkStubs tkStubs = { Tk_CreateClientMessageHandler, /* 239 */ Tk_DeleteClientMessageHandler, /* 240 */ Tk_CreateAnonymousWindow, /* 241 */ + Tk_SetClassProcs, /* 242 */ }; /* !END!: Do not edit above this line. */ diff --git a/generic/tkText.c b/generic/tkText.c index 2ab2e2a..ef1ae4d 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkText.c,v 1.17 2000/07/25 00:05:40 ericm Exp $ + * RCS: @(#) $Id: tkText.c,v 1.18 2000/11/22 01:49:38 ericm Exp $ */ #include "default.h" @@ -310,10 +310,9 @@ static int DumpSegment _ANSI_ARGS_((Tcl_Interp *interp, char *key, * that can be invoked from generic window code. */ -static TkClassProcs textClass = { - NULL, /* createProc. */ - TextWorldChanged, /* geometryProc. */ - NULL /* modalProc. */ +static Tk_ClassProcs textClass = { + sizeof(Tk_ClassProcs), /* size */ + TextWorldChanged, /* worldChangedProc */ }; @@ -440,7 +439,7 @@ Tk_TextCmd(clientData, interp, argc, argv) textPtr->insertMarkPtr = TkTextSetMark(textPtr, "insert", &startIndex); Tk_SetClass(textPtr->tkwin, "Text"); - TkSetClassProcs(textPtr->tkwin, &textClass, (ClientData) textPtr); + Tk_SetClassProcs(textPtr->tkwin, &textClass, (ClientData) textPtr); Tk_CreateEventHandler(textPtr->tkwin, ExposureMask|StructureNotifyMask|FocusChangeMask, TextEventProc, (ClientData) textPtr); diff --git a/generic/tkWindow.c b/generic/tkWindow.c index d20ffc8..e6fccf9 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWindow.c,v 1.28 2000/11/03 19:38:25 hobbs Exp $ + * RCS: @(#) $Id: tkWindow.c,v 1.29 2000/11/22 01:49:38 ericm Exp $ */ #include "tkPort.h" @@ -1578,6 +1578,7 @@ Tk_MakeWindowExist(tkwin) TkWindow *winPtr2; Window parent; Tcl_HashEntry *hPtr; + Tk_ClassCreateProc *createProc; int new; if (winPtr->window != None) { @@ -1593,10 +1594,9 @@ Tk_MakeWindowExist(tkwin) parent = winPtr->parentPtr->window; } - if (winPtr->classProcsPtr != NULL - && winPtr->classProcsPtr->createProc != NULL) { - winPtr->window = (*winPtr->classProcsPtr->createProc)(tkwin, parent, - winPtr->instanceData); + createProc = Tk_GetClassProc(winPtr->classProcsPtr, createProc); + if (createProc != NULL) { + winPtr->window = (*createProc)(tkwin, parent, winPtr->instanceData); } else { winPtr->window = TkpMakeWindow(winPtr, parent); } @@ -2149,7 +2149,7 @@ Tk_SetClass(tkwin, className) /* *---------------------------------------------------------------------- * - * TkSetClassProcs -- + * Tk_SetClassProcs -- * * This procedure is used to set the class procedures and * instance data for a window. @@ -2165,9 +2165,9 @@ Tk_SetClass(tkwin, className) */ void -TkSetClassProcs(tkwin, procs, instanceData) +Tk_SetClassProcs(tkwin, procs, instanceData) Tk_Window tkwin; /* Token for window to modify. */ - TkClassProcs *procs; /* Class procs structure. */ + Tk_ClassProcs *procs; /* Class procs structure. */ ClientData instanceData; /* Data to be passed to class procedures. */ { register TkWindow *winPtr = (TkWindow *) tkwin; |