OSDN Git Service

Please enter the commit message for your changes. Lines starting
[eos/base.git] / util / src / TclTk / tk8.6.12 / doc / SetClassProcs.3
1 '\"
2 '\" Copyright (c) 2000 Ajuba Solutions.
3 '\"
4 '\" See the file "license.terms" for information on usage and redistribution
5 '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
6 '\"
7 .TH Tk_SetClassProcs 3 8.4 Tk "Tk Library Procedures"
8 .so man.macros
9 .BS
10 .SH NAME
11 Tk_SetClassProcs \- register widget specific procedures
12 .SH SYNOPSIS
13 .nf
14 \fB#include <tk.h>\fR
15 .sp
16 \fBTk_SetClassProcs\fR(\fItkwin, procs, instanceData\fR)
17 .SH ARGUMENTS
18 .AS Tk_ClassProc instanceData
19 .AP Tk_Window tkwin in
20 Token for window to modify.
21 .AP "const Tk_ClassProcs" *procs in
22 Pointer to data structure containing widget specific procedures.
23 The data structure pointed to by \fIprocs\fR must be static:
24 Tk keeps a reference to it as long as the window exists.
25 .AP ClientData instanceData in
26 Arbitrary one-word value to pass to widget callbacks.
27 .BE
28 .SH DESCRIPTION
29 .PP
30 \fBTk_SetClassProcs\fR is called to register a set of procedures that
31 are used as callbacks in different places.
32 .PP
33 The structure pointed to by \fIprocs\fR contains the following:
34 .CS
35 typedef struct Tk_ClassProcs {
36     unsigned int \fIsize\fR;
37     Tk_ClassWorldChangedProc *\fIworldChangedProc\fR;
38     Tk_ClassCreateProc *\fIcreateProc\fR;
39     Tk_ClassModalProc *\fImodalProc\fR;
40 } \fBTk_ClassProcs\fR;
41 .CE
42 The \fIsize\fR field is used to simplify future expansion of the
43 structure. It should always be set to (literally) \fBsizeof(Tk_ClassProcs)\fR.
44 .PP
45 \fIworldChangedProc\fR is invoked when the system has altered
46 in some way that requires some reaction from the widget.  For example,
47 when a font alias (see the \fBfont\fR manual entry) is reconfigured,
48 widgets configured to use that font alias must update their display
49 accordingly.  \fIworldChangedProc\fR should have arguments and results
50 that match the type \fBTk_ClassWorldChangedProc\fR:
51 .CS
52 typedef void \fBTk_ClassWorldChangedProc\fR(
53         ClientData \fIinstanceData\fR);
54 .CE
55 The \fIinstanceData\fR parameter passed to the \fIworldChangedProc\fR
56 will be identical to the \fIinstanceData\fR parameter passed to
57 \fBTk_SetClassProcs\fR.
58 .PP
59 \fIcreateProc\fR is used to create platform-dependent windows.  It is
60 invoked by \fBTk_MakeWindowExist\fR.  \fIcreateProc\fR should have
61 arguments and results that match the type \fBTk_ClassCreateProc\fR:
62 .CS
63 typedef Window \fBTk_ClassCreateProc\fR(
64         Tk_Window \fItkwin\fR,
65         Window \fIparent\fR,
66         ClientData \fIinstanceData\fR);
67 .CE
68 The \fItkwin\fR and \fIinstanceData\fR parameters will be identical to
69 the \fItkwin\fR and \fIinstanceData\fR parameters passed to
70 \fBTk_SetClassProcs\fR.  The \fIparent\fR parameter will be the parent
71 of the window to be created.  The \fIcreateProc\fR should return the
72 created window.
73 .PP
74 \fImodalProc\fR is invoked after all bindings on a widget have been
75 triggered in order to handle a modal loop.  \fImodalProc\fR should
76 have arguments and results that match the type \fBTk_ClassModalProc\fR:
77 .CS
78 typedef void \fBTk_ClassModalProc\fR(
79         Tk_Window \fItkwin\fR,
80         XEvent *\fIeventPtr\fR);
81 .CE
82 The \fItkwin\fR parameter to \fImodalProc\fR will be identical to the
83 \fItkwin\fR parameter passed to \fBTk_SetClassProcs\fR.  The
84 \fIeventPtr\fR parameter will be a pointer to an XEvent structure
85 describing the event being processed.
86 .SH KEYWORDS
87 callback, class