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
|
|
23 #include <config.h>
|
|
24 #include "lisp.h"
|
442
|
25 #include "console-msw.h"
|
|
26 #include "redisplay.h"
|
428
|
27 #include "gui.h"
|
442
|
28 #include "glyphs.h"
|
428
|
29 #include "frame.h"
|
|
30 #include "elhash.h"
|
442
|
31 #include "events.h"
|
440
|
32 #include "buffer.h"
|
428
|
33
|
|
34 /*
|
|
35 * Return value is Qt if we have dispatched the command,
|
|
36 * or Qnil if id has not been mapped to a callback.
|
|
37 * Window procedure may try other targets to route the
|
|
38 * command if we return nil
|
|
39 */
|
|
40 Lisp_Object
|
442
|
41 mswindows_handle_gui_wm_command (struct frame* f, HWND ctrl, LPARAM id)
|
428
|
42 {
|
|
43 /* Try to map the command id through the proper hash table */
|
442
|
44 Lisp_Object callback, callback_ex, image_instance, frame, event;
|
|
45
|
|
46 XSETFRAME (frame, f);
|
428
|
47
|
440
|
48 /* #### make_int should assert that --kkm */
|
|
49 assert (XINT (make_int (id)) == id);
|
|
50
|
442
|
51 image_instance = Fgethash (make_int (id),
|
|
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
|
442
|
67 XEVENT (event)->event_type = misc_user_event;
|
|
68 XEVENT (event)->channel = frame;
|
|
69 XEVENT (event)->timestamp = GetTickCount ();
|
|
70 XEVENT (event)->event.eval.function = Qeval;
|
|
71 XEVENT (event)->event.eval.object =
|
|
72 list4 (Qfuncall, callback_ex, image_instance, event);
|
|
73 }
|
|
74 else if (NILP (callback) || UNBOUNDP (callback))
|
|
75 return Qnil;
|
|
76 else
|
|
77 {
|
|
78 Lisp_Object fn, arg;
|
440
|
79
|
442
|
80 event = Fmake_event (Qnil, Qnil);
|
440
|
81
|
442
|
82 get_gui_callback (callback, &fn, &arg);
|
|
83 XEVENT (event)->event_type = misc_user_event;
|
|
84 XEVENT (event)->channel = frame;
|
|
85 XEVENT (event)->timestamp = GetTickCount ();
|
|
86 XEVENT (event)->event.eval.function = fn;
|
|
87 XEVENT (event)->event.eval.object = arg;
|
|
88 }
|
|
89
|
|
90 mswindows_enqueue_dispatch_event (event);
|
|
91 /* The result of this evaluation could cause other instances to change so
|
|
92 enqueue an update callback to check this. */
|
|
93 enqueue_magic_eval_event (update_widget_instances, frame);
|
|
94 return Qt;
|
440
|
95 }
|
|
96
|
|
97 void
|
|
98 syms_of_gui_mswindows (void)
|
|
99 {
|
|
100 }
|