diff options
author | ericm <ericm> | 2000-09-17 21:02:38 (GMT) |
---|---|---|
committer | ericm <ericm> | 2000-09-17 21:02:38 (GMT) |
commit | 8d93216489667aad5317c07fc1dcc992b86b5b56 (patch) | |
tree | 38c791d10fe68a382b053bd668de898755e86dd4 /generic/tk.h | |
parent | 983b0c27a51acd0f5cb823a959a05058464d05e9 (diff) | |
download | tk-8d93216489667aad5317c07fc1dcc992b86b5b56.zip tk-8d93216489667aad5317c07fc1dcc992b86b5b56.tar.gz tk-8d93216489667aad5317c07fc1dcc992b86b5b56.tar.bz2 |
* generic/tk.h: Added declaration of Tk_ObjCustomOption structure,
used for TK_OPTION_CUSTOM, and typedef's of the functions
Tk_CustomOptionSetProc, Tk_CustomOptionGetProc,
Tk_CustomOptionRestoreProc, and Tk_CustomOptionFreeProc, used for
TK_OPTION_CUSTOM.
* doc/SetOptions.3: Added documentation of TK_OPTION_CUSTOM, and
section "CUSTOM OPTION TYPES" explaining how to create and use
custom options.
* tests/config.test: Added tests for custom option type.
* generic/tkTest.c: Added test support for TK_OPTION_CUSTOM to
TestobjconfigObjCmd. Added CustomOption* functions to implement a
test custom option.
* generic/tkConfig.c: Added new option type TK_OPTION_CUSTOM,
which allows the definition of custom option types by creating
parsing, printing, freeing, and restoring procedures for a custom
option. This is needed by the text and canvas widgets if they are
to be fully objectified.
Diffstat (limited to 'generic/tk.h')
-rw-r--r-- | generic/tk.h | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/generic/tk.h b/generic/tk.h index cb93773..bbecf6a 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.49 2000/09/07 00:28:38 ericm Exp $ + * RCS: @(#) $Id: tk.h,v 1.50 2000/09/17 21:02:39 ericm Exp $ */ #ifndef _TK @@ -145,7 +145,8 @@ typedef enum { TK_OPTION_SYNONYM, TK_OPTION_PIXELS, TK_OPTION_WINDOW, - TK_OPTION_END + TK_OPTION_END, + TK_OPTION_CUSTOM } Tk_OptionType; /* @@ -205,6 +206,39 @@ typedef struct Tk_OptionSpec { #define TK_OPTION_DONT_SET_DEFAULT (1 << 3) /* + * The following structure and function types are used by TK_OPTION_CUSTOM + * options; the structure holds pointers to the functions needed by the Tk + * option config code to handle a custom option. + */ + +typedef int (Tk_CustomOptionSetProc) _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj **value, + char *internalPtr, char *saveInternalPtr, int flags)); +typedef Tcl_Obj *(Tk_CustomOptionGetProc) _ANSI_ARGS_((ClientData clientData, + Tk_Window tkwin, char *internalPtr)); +typedef void (Tk_CustomOptionRestoreProc) _ANSI_ARGS_((ClientData clientData, + Tk_Window tkwin, char *internalPtr, char *saveInternalPtr)); +typedef void (Tk_CustomOptionFreeProc) _ANSI_ARGS_((ClientData clientData, + Tk_Window tkwin, char *internalPtr)); + +typedef struct Tk_ObjCustomOption { + char *name; /* Name of the custom option. */ + Tk_CustomOptionSetProc *setProc; /* Function to use to set a record's + * option value from a Tcl_Obj */ + Tk_CustomOptionGetProc *getProc; /* Function to use to get a Tcl_Obj + * representation from an internal + * representation of an option. */ + Tk_CustomOptionRestoreProc *restoreProc; /* Function to use to restore a + * saved value for the internal + * representation. */ + Tk_CustomOptionFreeProc *freeProc; /* Function to use to free the internal + * representation of an option. */ + ClientData clientData; /* Arbitrary one-word value passed to + * the handling procs. */ +} Tk_ObjCustomOption; + + +/* * Macro to use to fill in "offset" fields of the Tk_OptionSpec. * struct. Computes number of bytes from beginning of structure * to a given field. |