annotate src/scrollbar-msw.c @ 269:b2472a1930f2 r20-5b33

Import from CVS: tag r20-5b33
author cvs
date Mon, 13 Aug 2007 10:27:19 +0200
parents 83b3d10dcba9
children 6330739388db
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"
249
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 227
diff changeset
30 #include "scrollbar-msw.h"
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 227
diff changeset
31
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
32 #include "frame.h"
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
33 #include "window.h"
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
34 #include "events.h"
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
35
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
36 /* This has really different semantics in Windows than in Motif.
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
37 There's no corresponding method; we just do not change slider
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
38 size while dragging. It makes the scrollbar look smother and
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
39 prevents some weird behavior when scrolled near the bottom */
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
40 static int inhibit_slider_size_change = 0;
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
41
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
42 static void
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
43 mswindows_create_scrollbar_instance (struct frame *f, int vertical,
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
44 struct scrollbar_instance *sb)
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
45 {
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
46 int orientation;
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
47
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
48 sb->scrollbar_data = xnew_and_zero (struct mswindows_scrollbar_data);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
49
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
50 if (vertical)
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
51 orientation = SBS_VERT;
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
52 else
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
53 orientation = SBS_HORZ;
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
54
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
55 SCROLLBAR_MSW_HANDLE (sb) =
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
56 CreateWindowEx(0, "SCROLLBAR", 0, orientation|WS_CHILD,
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
57 CW_USEDEFAULT, CW_USEDEFAULT,
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 FRAME_MSWINDOWS_HANDLE (f),
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
60 NULL, NULL, NULL);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
61 SCROLLBAR_MSW_INFO (sb).fMask = SIF_ALL;
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
62 GetScrollInfo(SCROLLBAR_MSW_HANDLE (sb), SB_CTL,
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
63 &SCROLLBAR_MSW_INFO (sb));
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
64 SetWindowLong (SCROLLBAR_MSW_HANDLE(sb), GWL_USERDATA, (LONG)sb);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
65
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
66 #if 0
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
67 {
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
68 HWND h = SCROLLBAR_MSW_HANDLE (sb);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
69 int x = SetWindowLong (SCROLLBAR_MSW_HANDLE(sb), GWL_USERDATA, (LONG)sb);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
70 int y = GetLastError();
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
71 struct scrollbar_instance *z = (struct scrollbar_instance *)GetWindowLong (SCROLLBAR_MSW_HANDLE(sb),
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
72 GWL_USERDATA);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
73 *z = *z;
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
74 }
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
75 #endif
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
76 }
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
77
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
78 static void
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
79 mswindows_free_scrollbar_instance (struct scrollbar_instance *sb)
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
80 {
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
81 DestroyWindow (SCROLLBAR_MSW_HANDLE (sb));
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
82 if (sb->scrollbar_data)
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
83 xfree (sb->scrollbar_data);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
84 }
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
85
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
86 static void
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
87 mswindows_release_scrollbar_instance (struct scrollbar_instance *sb)
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
88 {
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
89 ShowScrollBar (SCROLLBAR_MSW_HANDLE (sb), SB_CTL, 0);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
90 SCROLLBAR_MSW_SIZE (sb) = 0;
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
91 }
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
92
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
93 #define UPDATE_POS_FIELD(field) \
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
94 if (new_##field >= 0 && SCROLLBAR_MSW_DATA (sb)->field != new_##field) { \
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
95 SCROLLBAR_MSW_DATA (sb)->field = new_##field; \
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
96 pos_changed = 1; \
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
97 }
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
98
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
99 static void
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
100 mswindows_update_scrollbar_instance_values (struct window *w,
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
101 struct scrollbar_instance *sb,
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
102 int new_line_increment,
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
103 int new_page_increment,
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
104 int new_minimum, int new_maximum,
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
105 int new_slider_size,
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
106 int new_slider_position,
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
107 int new_scrollbar_width,
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
108 int new_scrollbar_height,
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
109 int new_scrollbar_x,
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
110 int new_scrollbar_y)
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
111 {
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
112 struct frame *f;
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
113 int pos_changed = 0;
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
114
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
115 f = XFRAME (w->frame);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
116
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
117 #if 0
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
118 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
119 new_slider_size, new_slider_position,inhibit_slider_size_change);
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
120 #endif
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
121
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
122 /* These might be optimized, but since at least one will change at each
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
123 call, it's probably not worth it. */
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
124 SCROLLBAR_MSW_INFO (sb).nMin = new_minimum;
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
125 SCROLLBAR_MSW_INFO (sb).nMax = new_maximum;
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
126 SCROLLBAR_MSW_INFO (sb).nPage = new_slider_size + 1; /* for DISABLENOSCROLL */
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
127 SCROLLBAR_MSW_INFO (sb).nPos = new_slider_position;
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
128 SCROLLBAR_MSW_INFO (sb).fMask = (inhibit_slider_size_change
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
129 ? SIF_RANGE | SIF_POS
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
130 : SIF_ALL | SIF_DISABLENOSCROLL);
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
131
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
132 SetScrollInfo(SCROLLBAR_MSW_HANDLE (sb), SB_CTL, &SCROLLBAR_MSW_INFO (sb),
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
133 !pos_changed);
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
134
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
135 UPDATE_POS_FIELD (scrollbar_x);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
136 UPDATE_POS_FIELD (scrollbar_y);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
137 UPDATE_POS_FIELD (scrollbar_width);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
138 UPDATE_POS_FIELD (scrollbar_height);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
139
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
140 if (pos_changed)
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
141 {
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
142 MoveWindow(SCROLLBAR_MSW_HANDLE (sb),
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
143 new_scrollbar_x, new_scrollbar_y,
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
144 new_scrollbar_width, new_scrollbar_height,
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
145 TRUE);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
146 }
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 static void
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
150 mswindows_update_scrollbar_instance_status (struct window *w,
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
151 int active, int size,
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
152 struct scrollbar_instance *sb)
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
153 {
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
154 struct frame *f = XFRAME (w->frame);
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;
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
170 Lisp_Object win;
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);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
177 f = XFRAME (XWINDOW (win)->frame);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
178
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
179 inhibit_slider_size_change = code == SB_THUMBTRACK;
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
180
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
181 /* SB_LINEDOWN == SB_CHARLEFT etc. This is the way they will
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
182 always be - any Windows is binary compatible backward with
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
183 old programs */
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
184
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
185 switch (code)
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
186 {
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
187 case SB_LINEDOWN:
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
188 enqueue_misc_user_event(win,
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
189 vert ? Qscrollbar_line_down : Qscrollbar_char_right,
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
190 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:
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
194 enqueue_misc_user_event(win,
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
195 vert ? Qscrollbar_line_up : Qscrollbar_char_left,
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
196 win);
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
197 break;
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
198
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
199 case SB_PAGEDOWN:
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
200 enqueue_misc_user_event(win,
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
201 vert ? Qscrollbar_page_down : Qscrollbar_page_right,
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
202 vert ? Fcons (win, Qnil) : win);
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
203 break;
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
204
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
205 case SB_PAGEUP:
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
206 enqueue_misc_user_event(win,
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
207 vert ? Qscrollbar_page_up : Qscrollbar_page_left,
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
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:
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
212 enqueue_misc_user_event(win,
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
213 vert ? Qscrollbar_to_bottom : Qscrollbar_to_right,
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
214 win);
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
215 break;
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
216
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
217 case SB_TOP:
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
218 enqueue_misc_user_event(win,
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
219 vert ? Qscrollbar_to_top : Qscrollbar_to_left,
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
220 win);
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
221 break;
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
222
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
223 case SB_THUMBTRACK:
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
224 case SB_THUMBPOSITION:
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
225 scrollinfo.cbSize = sizeof(SCROLLINFO);
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
226 scrollinfo.fMask = SIF_TRACKPOS;
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
227 GetScrollInfo (hwnd, SB_CTL, &scrollinfo);
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
228 enqueue_misc_user_event (win,
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
229 (vert ? Qscrollbar_vertical_drag
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
230 : Qscrollbar_horizontal_drag),
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
231 Fcons (win, make_int (scrollinfo.nTrackPos)));
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
232 break;
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
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
236 #ifdef MEMORY_USAGE_STATS
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
237
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
238 static int
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
239 mswindows_compute_scrollbar_instance_usage (struct device *d,
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
240 struct scrollbar_instance *inst,
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
241 struct overhead_stats *ovstats)
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
242 {
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
243 int total = 0;
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
244
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
245 while (inst)
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
246 {
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
247 struct mswindows_scrollbar_data *data =
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
248 (struct mswindows_scrollbar_data *) inst->scrollbar_data;
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
249
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
250 total += malloced_storage_size (data, sizeof (*data), ovstats);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
251 inst = inst->next;
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
252 }
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
253
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
254 return total;
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
255 }
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
256
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
257 #endif /* MEMORY_USAGE_STATS */
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
258
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
259 /************************************************************************/
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
260 /* initialization */
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
261 /************************************************************************/
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
262
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
263 void
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
264 console_type_create_scrollbar_mswindows (void)
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
265 {
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
266 CONSOLE_HAS_METHOD (mswindows, create_scrollbar_instance);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
267 CONSOLE_HAS_METHOD (mswindows, free_scrollbar_instance);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
268 CONSOLE_HAS_METHOD (mswindows, release_scrollbar_instance);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
269 CONSOLE_HAS_METHOD (mswindows, update_scrollbar_instance_values);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
270 CONSOLE_HAS_METHOD (mswindows, update_scrollbar_instance_status);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
271 /* CONSOLE_HAS_METHOD (mswindows, scrollbar_width_changed_in_frame); */
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
272 #ifdef MEMORY_USAGE_STATS
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
273 CONSOLE_HAS_METHOD (mswindows, compute_scrollbar_instance_usage);
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
274 #endif
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
275 }
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
276
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
277 void
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
278 vars_of_scrollbar_mswindows(void)
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
279 {
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
280 Fprovide (intern ("mswindows-scrollbars"));
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
281 }
12579d965149 Import from CVS: tag r20-4b11
cvs
parents:
diff changeset
282