annotate src/gui-msw.c @ 775:7d972c3de90a

[xemacs-hg @ 2002-03-14 11:50:12 by stephent] New 21.5 Info docs, misc. <87r8mn8j4v.fsf@tleeps18.sk.tsukuba.ac.jp>
author stephent
date Thu, 14 Mar 2002 11:50:17 +0000
parents 943eaba38521
children e38acbeb1cae
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 /* mswindows GUI code. (menubars, scrollbars, toolbars, dialogs)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 Copyright (C) 1998 Andy Piper.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4 This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6 XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 under the terms of the GNU General Public License as published by the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 Free Software Foundation; either version 2, or (at your option) any
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 along with XEmacs; see the file COPYING. If not, write to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 Boston, MA 02111-1307, USA. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 /* Synched up with: Not in FSF. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 442
diff changeset
23 /* This file essentially Mule-ized (except perhaps some Unicode splitting).
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 442
diff changeset
24 5-2000. */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 442
diff changeset
25
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 #include <config.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 #include "lisp.h"
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
28 #include "console-msw.h"
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
29 #include "redisplay.h"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 #include "gui.h"
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
31 #include "glyphs.h"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32 #include "frame.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 #include "elhash.h"
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
34 #include "events.h"
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
35 #include "buffer.h"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 * Return value is Qt if we have dispatched the command,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 * or Qnil if id has not been mapped to a callback.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 * Window procedure may try other targets to route the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 * command if we return nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 Lisp_Object
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 442
diff changeset
44 mswindows_handle_gui_wm_command (struct frame *f, HWND ctrl, LPARAM id)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 /* Try to map the command id through the proper hash table */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
47 Lisp_Object callback, callback_ex, image_instance, frame, event;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
48
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
49 XSETFRAME (frame, f);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
51 /* #### make_int should assert that --kkm */
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
52 assert (XINT (make_int (id)) == id);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
53
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
54 image_instance = Fgethash (make_int (id),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
55 FRAME_MSWINDOWS_WIDGET_HASH_TABLE1 (f), Qnil);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
56 /* It is possible for a widget action to cause it to get out of sync
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
57 with its instantiator. Thus it is necessary to signal this
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
58 possibility. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
59 if (IMAGE_INSTANCEP (image_instance))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
60 XIMAGE_INSTANCE_WIDGET_ACTION_OCCURRED (image_instance) = 1;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
61 callback = Fgethash (make_int (id),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
62 FRAME_MSWINDOWS_WIDGET_HASH_TABLE2 (f), Qnil);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
63 callback_ex = Fgethash (make_int (id),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
64 FRAME_MSWINDOWS_WIDGET_HASH_TABLE3 (f), Qnil);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
66 if (!NILP (callback_ex) && !UNBOUNDP (callback_ex))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
67 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
68 event = Fmake_event (Qnil, Qnil);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
69
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
70 XEVENT (event)->event_type = misc_user_event;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
71 XEVENT (event)->channel = frame;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
72 XEVENT (event)->timestamp = GetTickCount ();
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
73 XEVENT (event)->event.eval.function = Qeval;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
74 XEVENT (event)->event.eval.object =
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
75 list4 (Qfuncall, callback_ex, image_instance, event);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
76 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
77 else if (NILP (callback) || UNBOUNDP (callback))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
78 return Qnil;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
79 else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
80 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
81 Lisp_Object fn, arg;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
82
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
83 event = Fmake_event (Qnil, Qnil);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
84
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
85 get_gui_callback (callback, &fn, &arg);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
86 XEVENT (event)->event_type = misc_user_event;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
87 XEVENT (event)->channel = frame;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
88 XEVENT (event)->timestamp = GetTickCount ();
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
89 XEVENT (event)->event.eval.function = fn;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
90 XEVENT (event)->event.eval.object = arg;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
91 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
92
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
93 mswindows_enqueue_dispatch_event (event);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
94 /* The result of this evaluation could cause other instances to change so
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
95 enqueue an update callback to check this. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
96 enqueue_magic_eval_event (update_widget_instances, frame);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
97 return Qt;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
98 }
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
99
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
100 void
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
101 syms_of_gui_mswindows (void)
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
102 {
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
103 }