diff options
author | ericm <ericm> | 2000-11-22 01:49:37 (GMT) |
---|---|---|
committer | ericm <ericm> | 2000-11-22 01:49:37 (GMT) |
commit | 31e9ab3d0310055f094cbcfa64af7e6834555cb5 (patch) | |
tree | b3d9ff19b6b8294780db27da55671e4ef2f9fd75 /generic/tk.h | |
parent | 5fb60902d139dbaa22360245c548fbdbfa0e28fa (diff) | |
download | tk-31e9ab3d0310055f094cbcfa64af7e6834555cb5.zip tk-31e9ab3d0310055f094cbcfa64af7e6834555cb5.tar.gz tk-31e9ab3d0310055f094cbcfa64af7e6834555cb5.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/tk.h')
-rw-r--r-- | generic/tk.h | 47 |
1 files changed, 46 insertions, 1 deletions
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. |