428
|
1 /* mswindows GUI code. (menubars, scrollbars, toolbars, dialogs)
|
|
2 Copyright (C) 1998 Andy Piper.
|
|
3
|
|
4 This file is part of XEmacs.
|
|
5
|
|
6 XEmacs is free software; you can redistribute it and/or modify it
|
|
7 under the terms of the GNU General Public License as published by the
|
|
8 Free Software Foundation; either version 2, or (at your option) any
|
|
9 later version.
|
|
10
|
|
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
14 for more details.
|
|
15
|
|
16 You should have received a copy of the GNU General Public License
|
|
17 along with XEmacs; see the file COPYING. If not, write to
|
|
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
19 Boston, MA 02111-1307, USA. */
|
|
20
|
|
21 /* Synched up with: Not in FSF. */
|
|
22
|
771
|
23 /* This file essentially Mule-ized (except perhaps some Unicode splitting).
|
|
24 5-2000. */
|
|
25
|
428
|
26 #include <config.h>
|
|
27 #include "lisp.h"
|
872
|
28 #include "console-msw-impl.h"
|
442
|
29 #include "redisplay.h"
|
428
|
30 #include "gui.h"
|
442
|
31 #include "glyphs.h"
|
872
|
32 #include "frame-impl.h"
|
428
|
33 #include "elhash.h"
|
442
|
34 #include "events.h"
|
440
|
35 #include "buffer.h"
|
428
|
36
|
|
37 /*
|
|
38 * Return value is Qt if we have dispatched the command,
|
|
39 * or Qnil if id has not been mapped to a callback.
|
|
40 * Window procedure may try other targets to route the
|
|
41 * command if we return nil
|
|
42 */
|
|
43 Lisp_Object
|
771
|
44 mswindows_handle_gui_wm_command (struct frame *f, HWND ctrl, LPARAM id)
|
428
|
45 {
|
|
46 /* Try to map the command id through the proper hash table */
|
442
|
47 Lisp_Object callback, callback_ex, image_instance, frame, event;
|
|
48
|
793
|
49 frame = wrap_frame (f);
|
428
|
50
|
826
|
51 image_instance = Fgethash (make_int_verify (id),
|
442
|
52 FRAME_MSWINDOWS_WIDGET_HASH_TABLE1 (f), Qnil);
|
|
53 /* It is possible for a widget action to cause it to get out of sync
|
|
54 with its instantiator. Thus it is necessary to signal this
|
|
55 possibility. */
|
|
56 if (IMAGE_INSTANCEP (image_instance))
|
|
57 XIMAGE_INSTANCE_WIDGET_ACTION_OCCURRED (image_instance) = 1;
|
|
58 callback = Fgethash (make_int (id),
|
|
59 FRAME_MSWINDOWS_WIDGET_HASH_TABLE2 (f), Qnil);
|
|
60 callback_ex = Fgethash (make_int (id),
|
|
61 FRAME_MSWINDOWS_WIDGET_HASH_TABLE3 (f), Qnil);
|
428
|
62
|
442
|
63 if (!NILP (callback_ex) && !UNBOUNDP (callback_ex))
|
|
64 {
|
|
65 event = Fmake_event (Qnil, Qnil);
|
440
|
66
|
964
|
67 #ifdef USE_KKCC
|
|
68 XSET_EVENT_TYPE (event, misc_user_event);
|
|
69 XSET_EVENT_CHANNEL (event, frame);
|
|
70 XSET_EVENT_TIMESTAMP (event, GetTickCount());
|
|
71 XSET_MISC_USER_DATA_FUNCTION (XEVENT_DATA (event), Qeval);
|
|
72 XSET_MISC_USER_DATA_OBJECT (XEVENT_DATA (event),
|
|
73 list4 (Qfuncall, callback_ex, image_instance, event));
|
|
74 #else /* not USE_KKCC */
|
442
|
75 XEVENT (event)->event_type = misc_user_event;
|
|
76 XEVENT (event)->channel = frame;
|
|
77 XEVENT (event)->timestamp = GetTickCount ();
|
|
78 XEVENT (event)->event.eval.function = Qeval;
|
|
79 XEVENT (event)->event.eval.object =
|
|
80 list4 (Qfuncall, callback_ex, image_instance, event);
|
964
|
81 #endif /* not USE_KKCC */
|
442
|
82 }
|
|
83 else if (NILP (callback) || UNBOUNDP (callback))
|
|
84 return Qnil;
|
|
85 else
|
|
86 {
|
|
87 Lisp_Object fn, arg;
|
440
|
88
|
442
|
89 event = Fmake_event (Qnil, Qnil);
|
440
|
90
|
442
|
91 get_gui_callback (callback, &fn, &arg);
|
964
|
92 #ifdef USE_KKCC
|
|
93 XSET_EVENT_TYPE (event, misc_user_event);
|
|
94 XSET_EVENT_CHANNEL (event, frame);
|
|
95 XSET_EVENT_TIMESTAMP (event, GetTickCount());
|
|
96 XSET_MISC_USER_DATA_FUNCTION (XEVENT_DATA (event), fn);
|
|
97 XSET_MISC_USER_DATA_OBJECT (XEVENT_DATA (event), arg);
|
|
98 #else /* not USE_KKCC */
|
442
|
99 XEVENT (event)->event_type = misc_user_event;
|
|
100 XEVENT (event)->channel = frame;
|
|
101 XEVENT (event)->timestamp = GetTickCount ();
|
|
102 XEVENT (event)->event.eval.function = fn;
|
|
103 XEVENT (event)->event.eval.object = arg;
|
964
|
104 #endif /* not USE_KKCC */
|
442
|
105 }
|
|
106
|
|
107 mswindows_enqueue_dispatch_event (event);
|
|
108 /* The result of this evaluation could cause other instances to change so
|
|
109 enqueue an update callback to check this. */
|
|
110 enqueue_magic_eval_event (update_widget_instances, frame);
|
|
111 return Qt;
|
440
|
112 }
|
|
113
|
|
114 void
|
|
115 syms_of_gui_mswindows (void)
|
|
116 {
|
|
117 }
|