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
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 }