1 | /*
|
---|
2 | * bltBind.h --
|
---|
3 | *
|
---|
4 | * Copyright 1993-1998 Lucent Technologies, Inc.
|
---|
5 | *
|
---|
6 | * Permission to use, copy, modify, and distribute this software and
|
---|
7 | * its documentation for any purpose and without fee is hereby
|
---|
8 | * granted, provided that the above copyright notice appear in all
|
---|
9 | * copies and that both that the copyright notice and warranty
|
---|
10 | * disclaimer appear in supporting documentation, and that the names
|
---|
11 | * of Lucent Technologies any of their entities not be used in
|
---|
12 | * advertising or publicity pertaining to distribution of the software
|
---|
13 | * without specific, written prior permission.
|
---|
14 | *
|
---|
15 | * Lucent Technologies disclaims all warranties with regard to this
|
---|
16 | * software, including all implied warranties of merchantability and
|
---|
17 | * fitness. In no event shall Lucent Technologies be liable for any
|
---|
18 | * special, indirect or consequential damages or any damages
|
---|
19 | * whatsoever resulting from loss of use, data or profits, whether in
|
---|
20 | * an action of contract, negligence or other tortuous action, arising
|
---|
21 | * out of or in connection with the use or performance of this
|
---|
22 | * software.
|
---|
23 | */
|
---|
24 |
|
---|
25 | #ifndef _BLT_BIND_H
|
---|
26 | #define _BLT_BIND_H
|
---|
27 |
|
---|
28 | #include "bltList.h"
|
---|
29 |
|
---|
30 | typedef struct Blt_BindTableStruct *Blt_BindTable;
|
---|
31 |
|
---|
32 | typedef ClientData (Blt_BindPickProc) _ANSI_ARGS_((ClientData clientData,
|
---|
33 | int x, int y, ClientData *contextPtr));
|
---|
34 |
|
---|
35 | typedef void (Blt_BindTagProc) _ANSI_ARGS_((Blt_BindTable bindTable,
|
---|
36 | ClientData object, ClientData context, Blt_List list));
|
---|
37 |
|
---|
38 |
|
---|
39 | /*
|
---|
40 | * Binding structure information:
|
---|
41 | */
|
---|
42 |
|
---|
43 | struct Blt_BindTableStruct {
|
---|
44 | unsigned int flags;
|
---|
45 | Tk_BindingTable bindingTable;
|
---|
46 | /* Table of all bindings currently defined.
|
---|
47 | * NULL means that no bindings exist, so the
|
---|
48 | * table hasn't been created. Each "object"
|
---|
49 | * used for this table is either a Tk_Uid for
|
---|
50 | * a tag or the address of an item named by
|
---|
51 | * id. */
|
---|
52 |
|
---|
53 | ClientData currentItem; /* The item currently containing the mouse
|
---|
54 | * pointer, or NULL if none. */
|
---|
55 | ClientData currentContext; /* One word indicating what kind of object
|
---|
56 | * was picked. */
|
---|
57 |
|
---|
58 | ClientData newItem; /* The item that is about to become the
|
---|
59 | * current one, or NULL. This field is
|
---|
60 | * used to detect deletions of the new
|
---|
61 | * current item pointer that occur during
|
---|
62 | * Leave processing of the previous current
|
---|
63 | * tab. */
|
---|
64 | ClientData newContext; /* One-word indicating what kind of object
|
---|
65 | * was just picked. */
|
---|
66 |
|
---|
67 | ClientData focusItem;
|
---|
68 | ClientData focusContext;
|
---|
69 |
|
---|
70 | XEvent pickEvent; /* The event upon which the current choice
|
---|
71 | * of the current tab is based. Must be saved
|
---|
72 | * so that if the current item is deleted,
|
---|
73 | * we can pick another. */
|
---|
74 | int activePick; /* The pick event has been initialized so
|
---|
75 | * that we can repick it */
|
---|
76 |
|
---|
77 | int state; /* Last known modifier state. Used to
|
---|
78 | * defer picking a new current object
|
---|
79 | * while buttons are down. */
|
---|
80 |
|
---|
81 | ClientData clientData;
|
---|
82 | Tk_Window tkwin;
|
---|
83 | Blt_BindPickProc *pickProc; /* Routine to report the item the mouse is
|
---|
84 | * currently over. */
|
---|
85 | Blt_BindTagProc *tagProc; /* Routine to report tags picked items. */
|
---|
86 | };
|
---|
87 |
|
---|
88 | EXTERN void Blt_DestroyBindingTable _ANSI_ARGS_((Blt_BindTable table));
|
---|
89 |
|
---|
90 | EXTERN Blt_BindTable Blt_CreateBindingTable _ANSI_ARGS_((Tcl_Interp *interp,
|
---|
91 | Tk_Window tkwin, ClientData clientData, Blt_BindPickProc *pickProc,
|
---|
92 | Blt_BindTagProc *tagProc));
|
---|
93 |
|
---|
94 | EXTERN int Blt_ConfigureBindings _ANSI_ARGS_((Tcl_Interp *interp,
|
---|
95 | Blt_BindTable table, ClientData item, int argc, char **argv));
|
---|
96 |
|
---|
97 | #if (TCL_MAJOR_VERSION >= 8)
|
---|
98 | EXTERN int Blt_ConfigureBindingsFromObj _ANSI_ARGS_((Tcl_Interp *interp,
|
---|
99 | Blt_BindTable table, ClientData item, int objc, Tcl_Obj *CONST *objv));
|
---|
100 | #endif
|
---|
101 |
|
---|
102 | EXTERN void Blt_PickCurrentItem _ANSI_ARGS_((Blt_BindTable table));
|
---|
103 |
|
---|
104 | EXTERN void Blt_DeleteBindings _ANSI_ARGS_((Blt_BindTable table,
|
---|
105 | ClientData object));
|
---|
106 |
|
---|
107 | EXTERN void Blt_MoveBindingTable _ANSI_ARGS_((Blt_BindTable table,
|
---|
108 | Tk_Window tkwin));
|
---|
109 |
|
---|
110 | #define Blt_SetFocusItem(bindPtr, object, context) \
|
---|
111 | ((bindPtr)->focusItem = (ClientData)(object),\
|
---|
112 | (bindPtr)->focusContext = (ClientData)(context))
|
---|
113 |
|
---|
114 | #define Blt_SetCurrentItem(bindPtr, object, context) \
|
---|
115 | ((bindPtr)->currentItem = (ClientData)(object),\
|
---|
116 | (bindPtr)->currentContext = (ClientData)(context))
|
---|
117 |
|
---|
118 | #define Blt_GetCurrentItem(bindPtr) ((bindPtr)->currentItem)
|
---|
119 | #define Blt_GetCurrentContext(bindPtr) ((bindPtr)->currentContext)
|
---|
120 | #define Blt_GetLatestItem(bindPtr) ((bindPtr)->newItem)
|
---|
121 |
|
---|
122 | #define Blt_GetBindingData(bindPtr) ((bindPtr)->clientData)
|
---|
123 |
|
---|
124 | #endif /*_BLT_BIND_H*/
|
---|