annotate src/scrollbar-msw.c @ 311:b4ad76366919

Added tag r21-0b53 for changeset 851ff35f137f
author cvs
date Mon, 13 Aug 2007 10:43:30 +0200
parents c9fe270a4101
children 19dcec799385
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. */
290
c9fe270a4101 Import from CVS: tag r21-0b43
cvs
parents: 288
diff changeset
125 SCROLLBAR_MSW_INFO (sb).cbSize = sizeof(SCROLLINFO);
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
126 SCROLLBAR_MSW_INFO (sb).nMin = new_minimum;
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
127 SCROLLBAR_MSW_INFO (sb).nMax = new_maximum;
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
128 SCROLLBAR_MSW_INFO (sb).nPage = new_slider_size + 1; /* for DISABLENOSCROLL */
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
129 SCROLLBAR_MSW_INFO (sb).nPos = new_slider_position;
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
130 SCROLLBAR_MSW_INFO (sb).fMask = (inhibit_slider_size_change
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
131 ? SIF_RANGE | SIF_POS
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
132 : SIF_ALL | SIF_DISABLENOSCROLL);
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
133
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
134 SetScrollInfo(SCROLLBAR_MSW_HANDLE (sb), SB_CTL, &SCROLLBAR_MSW_INFO (sb),
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
135 !pos_changed);
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
136
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
137 UPDATE_POS_FIELD (scrollbar_x);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
138 UPDATE_POS_FIELD (scrollbar_y);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
139 UPDATE_POS_FIELD (scrollbar_width);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
140 UPDATE_POS_FIELD (scrollbar_height);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
141
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
142 if (pos_changed)
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
143 {
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
144 MoveWindow(SCROLLBAR_MSW_HANDLE (sb),
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
145 new_scrollbar_x, new_scrollbar_y,
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
146 new_scrollbar_width, new_scrollbar_height,
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
147 TRUE);
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
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
151 static void
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
152 mswindows_update_scrollbar_instance_status (struct window *w,
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
153 int active, int size,
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
154 struct scrollbar_instance *sb)
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
155 {
269
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 249
diff changeset
156 if (SCROLLBAR_MSW_SIZE (sb) != size)
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 249
diff changeset
157 {
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 249
diff changeset
158 SCROLLBAR_MSW_SIZE (sb) = size;
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 249
diff changeset
159 ShowScrollBar (SCROLLBAR_MSW_HANDLE (sb), SB_CTL,
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 249
diff changeset
160 SCROLLBAR_MSW_SIZE (sb));
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 249
diff changeset
161 SCROLLBAR_MSW_INFO(sb).fMask |= SIF_DISABLENOSCROLL;
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 249
diff changeset
162 SetScrollInfo(SCROLLBAR_MSW_HANDLE (sb), SB_CTL, &SCROLLBAR_MSW_INFO (sb), TRUE);
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 249
diff changeset
163 }
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
164 }
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
165
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
166 void
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
167 mswindows_handle_scrollbar_event (HWND hwnd, int code, int pos)
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
168 {
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
169 struct frame *f;
288
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 286
diff changeset
170 Lisp_Object win, frame;
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
171 struct scrollbar_instance *sb;
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
172 SCROLLINFO scrollinfo;
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
173 int vert = GetWindowLong (hwnd, GWL_STYLE) & SBS_VERT;
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
174
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
175 sb = (struct scrollbar_instance *)GetWindowLong (hwnd, GWL_USERDATA);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
176 win = real_window (sb->mirror, 1);
288
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 286
diff changeset
177 frame = XWINDOW (win)->frame;
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 286
diff changeset
178 f = XFRAME (frame);
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
179
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
180 inhibit_slider_size_change = code == SB_THUMBTRACK;
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
181
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
182 /* SB_LINEDOWN == SB_CHARLEFT etc. This is the way they will
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
183 always be - any Windows is binary compatible backward with
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
184 old programs */
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
185
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
186 switch (code)
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
187 {
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
188 case SB_LINEDOWN:
288
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 286
diff changeset
189 mswindows_enqueue_misc_user_event
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 286
diff changeset
190 (frame, vert ? Qscrollbar_line_down : Qscrollbar_char_right, win);
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
191 break;
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
192
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
193 case SB_LINEUP:
288
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 286
diff changeset
194 mswindows_enqueue_misc_user_event
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 286
diff changeset
195 (frame, vert ? Qscrollbar_line_up : Qscrollbar_char_left, 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:
288
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 286
diff changeset
199 mswindows_enqueue_misc_user_event
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 286
diff changeset
200 (win, vert ? Qscrollbar_page_down : Qscrollbar_page_right,
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 286
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:
288
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 286
diff changeset
205 mswindows_enqueue_misc_user_event
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 286
diff changeset
206 (frame,
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 286
diff changeset
207 vert ? Qscrollbar_page_up : Qscrollbar_page_left,
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 286
diff changeset
208 vert ? Fcons (win, Qnil) : win);
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
209 break;
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
210
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
211 case SB_BOTTOM:
288
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 286
diff changeset
212 mswindows_enqueue_misc_user_event
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 286
diff changeset
213 (frame, vert ? Qscrollbar_to_bottom : Qscrollbar_to_right, 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:
288
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 286
diff changeset
217 mswindows_enqueue_misc_user_event
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 286
diff changeset
218 (frame, vert ? Qscrollbar_to_top : Qscrollbar_to_left, win);
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
219 break;
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
220
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
221 case SB_THUMBTRACK:
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
222 case SB_THUMBPOSITION:
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
223 scrollinfo.cbSize = sizeof(SCROLLINFO);
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
224 scrollinfo.fMask = SIF_TRACKPOS;
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
225 GetScrollInfo (hwnd, SB_CTL, &scrollinfo);
288
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 286
diff changeset
226 mswindows_enqueue_misc_user_event
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 286
diff changeset
227 (frame,
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 286
diff changeset
228 vert ? Qscrollbar_vertical_drag : Qscrollbar_horizontal_drag,
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 286
diff changeset
229 Fcons (win, make_int (scrollinfo.nTrackPos)));
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
230 break;
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
231 }
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 #ifdef MEMORY_USAGE_STATS
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
235
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
236 static int
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
237 mswindows_compute_scrollbar_instance_usage (struct device *d,
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
238 struct scrollbar_instance *inst,
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
239 struct overhead_stats *ovstats)
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
240 {
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
241 int total = 0;
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
242
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
243 while (inst)
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
244 {
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
245 struct mswindows_scrollbar_data *data =
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
246 (struct mswindows_scrollbar_data *) inst->scrollbar_data;
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
247
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
248 total += malloced_storage_size (data, sizeof (*data), ovstats);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
249 inst = inst->next;
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
250 }
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
251
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
252 return total;
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
253 }
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
254
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
255 #endif /* MEMORY_USAGE_STATS */
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
256
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 /* Device-specific ghost specifiers initialization */
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
259 /************************************************************************/
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
260
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
261 DEFUN ("mswindows-init-scrollbar-metrics", Fmswindows_init_scrollbar_metrics, 1, 1, 0, /*
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
262 */
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
263 (locale))
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
264 {
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
265 if (DEVICEP (locale))
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
266 {
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
267 add_spec_to_ghost_specifier (Vscrollbar_width,
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
268 make_int (GetSystemMetrics (SM_CXVSCROLL)),
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
269 locale, Qmswindows, Qnil);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
270 add_spec_to_ghost_specifier (Vscrollbar_height,
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
271 make_int (GetSystemMetrics (SM_CYHSCROLL)),
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
272 locale, Qmswindows, Qnil);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
273 }
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
274 return Qnil;
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
275 }
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
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
278 /************************************************************************/
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
279 /* initialization */
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
280 /************************************************************************/
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
281
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
282 void
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
283 console_type_create_scrollbar_mswindows (void)
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
284 {
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
285 CONSOLE_HAS_METHOD (mswindows, create_scrollbar_instance);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
286 CONSOLE_HAS_METHOD (mswindows, free_scrollbar_instance);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
287 CONSOLE_HAS_METHOD (mswindows, release_scrollbar_instance);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
288 CONSOLE_HAS_METHOD (mswindows, update_scrollbar_instance_values);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
289 CONSOLE_HAS_METHOD (mswindows, update_scrollbar_instance_status);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
290 /* CONSOLE_HAS_METHOD (mswindows, scrollbar_width_changed_in_frame); */
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
291 #ifdef MEMORY_USAGE_STATS
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
292 CONSOLE_HAS_METHOD (mswindows, compute_scrollbar_instance_usage);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
293 #endif
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
294 }
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
295
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
296 void
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
297 syms_of_scrollbar_mswindows(void)
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
298 {
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
299 DEFSUBR (Fmswindows_init_scrollbar_metrics);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 269
diff changeset
300 }
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 void
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
303 vars_of_scrollbar_mswindows(void)
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
304 {
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
305 Fprovide (intern ("mswindows-scrollbars"));
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
306 }
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
307