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"
|
442
|
28 #include "console-msw.h"
|
|
29 #include "redisplay.h"
|
428
|
30 #include "gui.h"
|
442
|
31 #include "glyphs.h"
|
428
|
32 #include "frame.h"
|
|
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
|
|
49 XSETFRAME (frame, f);
|
428
|
50
|
440
|
51 /* #### make_int should assert that --kkm */
|
|
52 assert (XINT (make_int (id)) == id);
|
|
53
|
442
|
54 image_instance = Fgethash (make_int (id),
|
|
55 FRAME_MSWINDOWS_WIDGET_HASH_TABLE1 (f), Qnil);
|
|
56 /* It is possible for a widget action to cause it to get out of sync
|
|
57 with its instantiator. Thus it is necessary to signal this
|
|
58 possibility. */
|
|
59 if (IMAGE_INSTANCEP (image_instance))
|
|
60 XIMAGE_INSTANCE_WIDGET_ACTION_OCCURRED (image_instance) = 1;
|
|
61 callback = Fgethash (make_int (id),
|
|
62 FRAME_MSWINDOWS_WIDGET_HASH_TABLE2 (f), Qnil);
|
|
63 callback_ex = Fgethash (make_int (id),
|
|
64 FRAME_MSWINDOWS_WIDGET_HASH_TABLE3 (f), Qnil);
|
428
|
65
|
442
|
66 if (!NILP (callback_ex) && !UNBOUNDP (callback_ex))
|
|
67 {
|
|
68 event = Fmake_event (Qnil, Qnil);
|
440
|
69
|
442
|
70 XEVENT (event)->event_type = misc_user_event;
|
|
71 XEVENT (event)->channel = frame;
|
|
72 XEVENT (event)->timestamp = GetTickCount ();
|
|
73 XEVENT (event)->event.eval.function = Qeval;
|
|
74 XEVENT (event)->event.eval.object =
|
|
75 list4 (Qfuncall, callback_ex, image_instance, event);
|
|
76 }
|
|
77 else if (NILP (callback) || UNBOUNDP (callback))
|
|
78 return Qnil;
|
|
79 else
|
|
80 {
|
|
81 Lisp_Object fn, arg;
|
440
|
82
|
442
|
83 event = Fmake_event (Qnil, Qnil);
|
440
|
84
|
442
|
85 get_gui_callback (callback, &fn, &arg);
|
|
86 XEVENT (event)->event_type = misc_user_event;
|
|
87 XEVENT (event)->channel = frame;
|
|
88 XEVENT (event)->timestamp = GetTickCount ();
|
|
89 XEVENT (event)->event.eval.function = fn;
|
|
90 XEVENT (event)->event.eval.object = arg;
|
|
91 }
|
|
92
|
|
93 mswindows_enqueue_dispatch_event (event);
|
|
94 /* The result of this evaluation could cause other instances to change so
|
|
95 enqueue an update callback to check this. */
|
|
96 enqueue_magic_eval_event (update_widget_instances, frame);
|
|
97 return Qt;
|
440
|
98 }
|
|
99
|
|
100 void
|
|
101 syms_of_gui_mswindows (void)
|
|
102 {
|
|
103 }
|