annotate src/scrollbar-msw.c @ 286:57709be46d1b r21-0b41

Import from CVS: tag r21-0b41
author cvs
date Mon, 13 Aug 2007 10:35:03 +0200
parents 6330739388db
children e11d67e05968
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
1 /* scrollbar implementation -- mswindows interface.
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
2 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois.
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
3 Copyright (C) 1994 Amdhal Corporation.
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
4 Copyright (C) 1995 Sun Microsystems, Inc.
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
5 Copyright (C) 1995 Darrell Kindred <dkindred+@cmu.edu>.
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
6
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
7 This file is part of XEmacs.
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
8
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
9 XEmacs is free software; you can redistribute it and/or modify it
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
10 under the terms of the GNU General Public License as published by the
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
11 Free Software Foundation; either version 2, or (at your option) any
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
12 later version.
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
13
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
14 XEmacs is distributed in the hope that it will be useful, but WITHOUT
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
17 for more details.
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
18
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
19 You should have received a copy of the GNU General Public License
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
20 along with XEmacs; see the file COPYING. If not, write to
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
21 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
22 Boston, MA 02111-1307, USA. */
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
23
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
24 /* Synched up with: Not in FSF. */
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
25
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
26 #include <config.h>
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
27 #include "lisp.h"
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
28
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
29 #include "console-msw.h"
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
30 #include "events.h"
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
31 #include "frame.h"
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
32 #include "scrollbar-msw.h"
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
33 #include "scrollbar.h"
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
34 #include "specifier.h"
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
35 #include "window.h"
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
36
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
37 /* This has really different semantics in Windows than in Motif.
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
38 There's no corresponding method; we just do not change slider
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
39 size while dragging. It makes the scrollbar look smother and
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
40 prevents some weird behavior when scrolled near the bottom */
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
41 static int inhibit_slider_size_change = 0;
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
42
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
43 static void
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
44 mswindows_create_scrollbar_instance (struct frame *f, int vertical,
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
45 struct scrollbar_instance *sb)
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
46 {
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
47 int orientation;
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
48
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
49 sb->scrollbar_data = xnew_and_zero (struct mswindows_scrollbar_data);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
50
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
51 if (vertical)
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
52 orientation = SBS_VERT;
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
53 else
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
54 orientation = SBS_HORZ;
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
55
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
56 SCROLLBAR_MSW_HANDLE (sb) =
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
57 CreateWindowEx(0, "SCROLLBAR", 0, orientation|WS_CHILD,
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
58 CW_USEDEFAULT, CW_USEDEFAULT,
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
59 CW_USEDEFAULT, CW_USEDEFAULT,
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
60 FRAME_MSWINDOWS_HANDLE (f),
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
61 NULL, NULL, NULL);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
62 SCROLLBAR_MSW_INFO (sb).fMask = SIF_ALL;
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
63 GetScrollInfo(SCROLLBAR_MSW_HANDLE (sb), SB_CTL,
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
64 &SCROLLBAR_MSW_INFO (sb));
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
65 SetWindowLong (SCROLLBAR_MSW_HANDLE(sb), GWL_USERDATA, (LONG)sb);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
66
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
67 #if 0
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
68 {
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
69 HWND h = SCROLLBAR_MSW_HANDLE (sb);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
70 int x = SetWindowLong (SCROLLBAR_MSW_HANDLE(sb), GWL_USERDATA, (LONG)sb);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
71 int y = GetLastError();
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
72 struct scrollbar_instance *z = (struct scrollbar_instance *)GetWindowLong (SCROLLBAR_MSW_HANDLE(sb),
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
73 GWL_USERDATA);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
74 *z = *z;
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
75 }
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
76 #endif
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
77 }
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
78
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
79 static void
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
80 mswindows_free_scrollbar_instance (struct scrollbar_instance *sb)
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
81 {
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
82 DestroyWindow (SCROLLBAR_MSW_HANDLE (sb));
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
83 if (sb->scrollbar_data)
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
84 xfree (sb->scrollbar_data);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
85 }
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
86
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
87 static void
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
88 mswindows_release_scrollbar_instance (struct scrollbar_instance *sb)
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
89 {
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
90 ShowScrollBar (SCROLLBAR_MSW_HANDLE (sb), SB_CTL, 0);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
91 SCROLLBAR_MSW_SIZE (sb) = 0;
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
92 }
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
93
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
94 #define UPDATE_POS_FIELD(field) \
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
95 if (new_##field >= 0 && SCROLLBAR_MSW_DATA (sb)->field != new_##field) { \
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
96 SCROLLBAR_MSW_DATA (sb)->field = new_##field; \
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
97 pos_changed = 1; \
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
98 }
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
99
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
100 static void
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
101 mswindows_update_scrollbar_instance_values (struct window *w,
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
102 struct scrollbar_instance *sb,
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
103 int new_line_increment,
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
104 int new_page_increment,
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
105 int new_minimum, int new_maximum,
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
106 int new_slider_size,
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
107 int new_slider_position,
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
108 int new_scrollbar_width,
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
109 int new_scrollbar_height,
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
110 int new_scrollbar_x,
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
111 int new_scrollbar_y)
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
112 {
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
113 struct frame *f;
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
114 int pos_changed = 0;
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
115
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
116 f = XFRAME (w->frame);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
117
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
118 #if 0
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
119 stderr_out ("[%d, %d], page = %d, pos = %d, inhibit = %d\n", new_minimum, new_maximum,
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
120 new_slider_size, new_slider_position,inhibit_slider_size_change);
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
121 #endif
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
122
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
123 /* These might be optimized, but since at least one will change at each
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
124 call, it's probably not worth it. */
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
125 SCROLLBAR_MSW_INFO (sb).nMin = new_minimum;
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
126 SCROLLBAR_MSW_INFO (sb).nMax = new_maximum;
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
127 SCROLLBAR_MSW_INFO (sb).nPage = new_slider_size + 1; /* for DISABLENOSCROLL */
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
128 SCROLLBAR_MSW_INFO (sb).nPos = new_slider_position;
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
129 SCROLLBAR_MSW_INFO (sb).fMask = (inhibit_slider_size_change
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
130 ? SIF_RANGE | SIF_POS
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
131 : SIF_ALL | SIF_DISABLENOSCROLL);
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
132
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
133 SetScrollInfo(SCROLLBAR_MSW_HANDLE (sb), SB_CTL, &SCROLLBAR_MSW_INFO (sb),
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
134 !pos_changed);
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
135
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
136 UPDATE_POS_FIELD (scrollbar_x);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
137 UPDATE_POS_FIELD (scrollbar_y);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
138 UPDATE_POS_FIELD (scrollbar_width);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
139 UPDATE_POS_FIELD (scrollbar_height);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
140
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
141 if (pos_changed)
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
142 {
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
143 MoveWindow(SCROLLBAR_MSW_HANDLE (sb),
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
144 new_scrollbar_x, new_scrollbar_y,
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
145 new_scrollbar_width, new_scrollbar_height,
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
146 TRUE);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
147 }
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
148 }
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
149
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
150 static void
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
151 mswindows_update_scrollbar_instance_status (struct window *w,
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
152 int active, int size,
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
153 struct scrollbar_instance *sb)
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
154 {
269
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 249
diff changeset
155 if (SCROLLBAR_MSW_SIZE (sb) != size)
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 249
diff changeset
156 {
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 249
diff changeset
157 SCROLLBAR_MSW_SIZE (sb) = size;
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 249
diff changeset
158 ShowScrollBar (SCROLLBAR_MSW_HANDLE (sb), SB_CTL,
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 249
diff changeset
159 SCROLLBAR_MSW_SIZE (sb));
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 249
diff changeset
160 SCROLLBAR_MSW_INFO(sb).fMask |= SIF_DISABLENOSCROLL;
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 249
diff changeset
161 SetScrollInfo(SCROLLBAR_MSW_HANDLE (sb), SB_CTL, &SCROLLBAR_MSW_INFO (sb), TRUE);
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 249
diff changeset
162 }
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
163 }
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
164
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
165 void
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
166 mswindows_handle_scrollbar_event (HWND hwnd, int code, int pos)
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
167 {
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
168 struct frame *f;
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
169 Lisp_Object win;
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
170 struct scrollbar_instance *sb;
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
171 SCROLLINFO scrollinfo;
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
172 int vert = GetWindowLong (hwnd, GWL_STYLE) & SBS_VERT;
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
173
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
174 sb = (struct scrollbar_instance *)GetWindowLong (hwnd, GWL_USERDATA);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
175 win = real_window (sb->mirror, 1);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
176 f = XFRAME (XWINDOW (win)->frame);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
177
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
178 inhibit_slider_size_change = code == SB_THUMBTRACK;
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
179
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
180 /* SB_LINEDOWN == SB_CHARLEFT etc. This is the way they will
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
181 always be - any Windows is binary compatible backward with
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
182 old programs */
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
183
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
184 switch (code)
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
185 {
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
186 case SB_LINEDOWN:
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
187 enqueue_misc_user_event(win,
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
188 vert ? Qscrollbar_line_down : Qscrollbar_char_right,
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
189 win);
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
190 break;
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
191
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
192 case SB_LINEUP:
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
193 enqueue_misc_user_event(win,
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
194 vert ? Qscrollbar_line_up : Qscrollbar_char_left,
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
195 win);
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
196 break;
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
197
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
198 case SB_PAGEDOWN:
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
199 enqueue_misc_user_event(win,
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
200 vert ? Qscrollbar_page_down : Qscrollbar_page_right,
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
201 vert ? Fcons (win, Qnil) : win);
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
202 break;
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
203
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
204 case SB_PAGEUP:
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
205 enqueue_misc_user_event(win,
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
206 vert ? Qscrollbar_page_up : Qscrollbar_page_left,
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
207 vert ? Fcons (win, Qnil) : win);
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
208 break;
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
209
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
210 case SB_BOTTOM:
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
211 enqueue_misc_user_event(win,
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
212 vert ? Qscrollbar_to_bottom : Qscrollbar_to_right,
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
213 win);
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
214 break;
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
215
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
216 case SB_TOP:
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
217 enqueue_misc_user_event(win,
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
218 vert ? Qscrollbar_to_top : Qscrollbar_to_left,
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
219 win);
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
220 break;
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
221
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
222 case SB_THUMBTRACK:
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
223 case SB_THUMBPOSITION:
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
224 scrollinfo.cbSize = sizeof(SCROLLINFO);
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
225 scrollinfo.fMask = SIF_TRACKPOS;
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
226 GetScrollInfo (hwnd, SB_CTL, &scrollinfo);
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
227 enqueue_misc_user_event (win,
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
228 (vert ? Qscrollbar_vertical_drag
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
229 : Qscrollbar_horizontal_drag),
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
230 Fcons (win, make_int (scrollinfo.nTrackPos)));
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
231 break;
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
232 }
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
233 }
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
234
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
235 #ifdef MEMORY_USAGE_STATS
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
236
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
237 static int
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
238 mswindows_compute_scrollbar_instance_usage (struct device *d,
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
239 struct scrollbar_instance *inst,
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
240 struct overhead_stats *ovstats)
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
241 {
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
242 int total = 0;
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
243
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
244 while (inst)
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
245 {
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
246 struct mswindows_scrollbar_data *data =
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
247 (struct mswindows_scrollbar_data *) inst->scrollbar_data;
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
248
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
249 total += malloced_storage_size (data, sizeof (*data), ovstats);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
250 inst = inst->next;
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
251 }
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
252
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
253 return total;
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
254 }
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
255
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
256 #endif /* MEMORY_USAGE_STATS */
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
257
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
258 /************************************************************************/
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
259 /* Device-specific ghost specifiers initialization */
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
260 /************************************************************************/
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
261
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
262 DEFUN ("mswindows-init-scrollbar-metrics", Fmswindows_init_scrollbar_metrics, 1, 1, 0, /*
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
263 */
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
264 (locale))
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
265 {
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
266 if (DEVICEP (locale))
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
267 {
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
268 add_spec_to_ghost_specifier (Vscrollbar_width,
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
269 make_int (GetSystemMetrics (SM_CXVSCROLL)),
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
270 locale, Qmswindows, Qnil);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
271 add_spec_to_ghost_specifier (Vscrollbar_height,
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
272 make_int (GetSystemMetrics (SM_CYHSCROLL)),
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
273 locale, Qmswindows, Qnil);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
274 }
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
275 return Qnil;
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
276 }
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
277
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
278
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
279 /************************************************************************/
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
280 /* initialization */
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
281 /************************************************************************/
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
282
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
283 void
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
284 console_type_create_scrollbar_mswindows (void)
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
285 {
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
286 CONSOLE_HAS_METHOD (mswindows, create_scrollbar_instance);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
287 CONSOLE_HAS_METHOD (mswindows, free_scrollbar_instance);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
288 CONSOLE_HAS_METHOD (mswindows, release_scrollbar_instance);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
289 CONSOLE_HAS_METHOD (mswindows, update_scrollbar_instance_values);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
290 CONSOLE_HAS_METHOD (mswindows, update_scrollbar_instance_status);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
291 /* CONSOLE_HAS_METHOD (mswindows, scrollbar_width_changed_in_frame); */
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
292 #ifdef MEMORY_USAGE_STATS
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
293 CONSOLE_HAS_METHOD (mswindows, compute_scrollbar_instance_usage);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
294 #endif
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
295 }
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
296
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
297 void
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
298 syms_of_scrollbar_mswindows(void)
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
299 {
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
300 DEFSUBR (Fmswindows_init_scrollbar_metrics);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
301 }
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
302
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
303 void
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
304 vars_of_scrollbar_mswindows(void)
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
305 {
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
306 Fprovide (intern ("mswindows-scrollbars"));
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
307 }
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
308