1 /* mswindows GUI code. (menubars, scrollbars, toolbars, dialogs)
2 Copyright (C) 1998 Andy Piper.
4 This file is part of XEmacs.
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
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
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. */
21 /* Synched up with: Not in FSF. */
25 #include "console-msw.h"
26 #include "redisplay.h"
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
41 mswindows_handle_gui_wm_command (struct frame* f, HWND ctrl, LPARAM id)
43 /* Try to map the command id through the proper hash table */
44 Lisp_Object callback, callback_ex, image_instance, frame, event;
48 /* #### make_int should assert that --kkm */
49 assert (XINT (make_int (id)) == id);
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
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);
63 if (!NILP (callback_ex) && !UNBOUNDP (callback_ex))
65 event = Fmake_event (Qnil, Qnil);
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);
74 else if (NILP (callback) || UNBOUNDP (callback))
80 event = Fmake_event (Qnil, Qnil);
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;
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);
98 syms_of_gui_mswindows (void)