| 45 |
45 |
* </p>
|
| 46 |
46 |
*/
|
| 47 |
47 |
public class TripleRangeSlider extends Canvas {
|
| 48 |
|
|
| 49 |
|
public enum SELECTED_KNOB {NONE, UPPER, LOWER, MIDDLE };
|
| 50 |
|
|
|
48 |
|
|
49 |
public enum SELECTED_KNOB {
|
|
50 |
NONE, UPPER, LOWER, MIDDLE
|
|
51 |
};
|
|
52 |
|
| 51 |
53 |
private int minimum;
|
|
54 |
|
| 52 |
55 |
private int maximum;
|
|
56 |
|
| 53 |
57 |
private int lowerValue;
|
|
58 |
|
| 54 |
59 |
private int middleValue;
|
|
60 |
|
| 55 |
61 |
private int upperValue;
|
|
62 |
|
| 56 |
63 |
private final List<SelectionListener> listeners;
|
|
64 |
|
| 57 |
65 |
private final Image slider, sliderHover, sliderDrag, sliderSelected;
|
|
66 |
|
| 58 |
67 |
private final Image vSlider, vSliderHover, vSliderDrag, vSliderSelected;
|
|
68 |
|
| 59 |
69 |
private int orientation;
|
|
70 |
|
| 60 |
71 |
private int increment;
|
|
72 |
|
| 61 |
73 |
private int pageIncrement;
|
|
74 |
|
| 62 |
75 |
private SELECTED_KNOB lastSelected;
|
|
76 |
|
| 63 |
77 |
private boolean dragInProgress;
|
|
78 |
|
| 64 |
79 |
private Point coordUpper;
|
|
80 |
|
| 65 |
81 |
private boolean upperHover;
|
|
82 |
|
| 66 |
83 |
private Point coordMiddle;
|
|
84 |
|
| 67 |
85 |
private boolean middleHover;
|
|
86 |
|
| 68 |
87 |
private Point coordLower;
|
|
88 |
|
| 69 |
89 |
private boolean lowerHover;
|
|
90 |
|
| 70 |
91 |
private int previousUpperValue;
|
|
92 |
|
| 71 |
93 |
private int previousMiddleValue;
|
|
94 |
|
| 72 |
95 |
private int previousLowerValue;
|
| 73 |
|
|
|
96 |
|
| 74 |
97 |
/**
|
| 75 |
98 |
* Constructs a new instance of this class given its parent and a style
|
| 76 |
99 |
* value describing its behavior and appearance.
|
| ... | ... | |
| 87 |
110 |
* instance (cannot be null)
|
| 88 |
111 |
* @param style the style of control to construct
|
| 89 |
112 |
*
|
| 90 |
|
* @exception IllegalArgumentException <ul>
|
|
113 |
* @exception IllegalArgumentException
|
|
114 |
* <ul>
|
| 91 |
115 |
* <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
|
| 92 |
116 |
* </ul>
|
| 93 |
|
* @exception SWTException <ul>
|
|
117 |
* @exception SWTException
|
|
118 |
* <ul>
|
| 94 |
119 |
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the
|
| 95 |
120 |
* thread that created the parent</li>
|
| 96 |
121 |
* </ul>
|
| ... | ... | |
| 109 |
134 |
this.sliderHover = new Image(getDisplay(), this.getClass().getClassLoader().getResourceAsStream("images/slider-hover.png")); //$NON-NLS-1$
|
| 110 |
135 |
this.sliderDrag = new Image(getDisplay(), this.getClass().getClassLoader().getResourceAsStream("images/slider-drag.png")); //$NON-NLS-1$
|
| 111 |
136 |
this.sliderSelected = new Image(getDisplay(), this.getClass().getClassLoader().getResourceAsStream("images/slider-selected.png")); //$NON-NLS-1$
|
| 112 |
|
|
|
137 |
|
| 113 |
138 |
this.vSlider = new Image(getDisplay(), this.getClass().getClassLoader().getResourceAsStream("images/h-slider-normal.png")); //$NON-NLS-1$
|
| 114 |
139 |
this.vSliderHover = new Image(getDisplay(), this.getClass().getClassLoader().getResourceAsStream("images/h-slider-hover.png")); //$NON-NLS-1$
|
| 115 |
140 |
this.vSliderDrag = new Image(getDisplay(), this.getClass().getClassLoader().getResourceAsStream("images/h-slider-drag.png")); //$NON-NLS-1$
|
| 116 |
141 |
this.vSliderSelected = new Image(getDisplay(), this.getClass().getClassLoader().getResourceAsStream("images/h-slider-selected.png")); //$NON-NLS-1$
|
| 117 |
|
|
|
142 |
|
| 118 |
143 |
if ((style & SWT.VERTICAL) == SWT.VERTICAL) {
|
| 119 |
144 |
this.orientation = SWT.VERTICAL;
|
| 120 |
|
} else {
|
|
145 |
}
|
|
146 |
else {
|
| 121 |
147 |
this.orientation = SWT.HORIZONTAL;
|
| 122 |
148 |
}
|
| 123 |
|
|
|
149 |
|
| 124 |
150 |
this.addListener(SWT.Dispose, new Listener() {
|
|
151 |
|
| 125 |
152 |
@Override
|
| 126 |
153 |
public void handleEvent(final Event event) {
|
| 127 |
154 |
SWTGraphicUtil.dispose(TripleRangeSlider.this.slider);
|
| 128 |
155 |
SWTGraphicUtil.dispose(TripleRangeSlider.this.sliderHover);
|
| 129 |
156 |
SWTGraphicUtil.dispose(TripleRangeSlider.this.sliderDrag);
|
| 130 |
157 |
SWTGraphicUtil.dispose(TripleRangeSlider.this.sliderSelected);
|
| 131 |
|
|
|
158 |
|
| 132 |
159 |
SWTGraphicUtil.dispose(TripleRangeSlider.this.vSlider);
|
| 133 |
160 |
SWTGraphicUtil.dispose(TripleRangeSlider.this.vSliderHover);
|
| 134 |
161 |
SWTGraphicUtil.dispose(TripleRangeSlider.this.vSliderDrag);
|
| 135 |
162 |
SWTGraphicUtil.dispose(TripleRangeSlider.this.vSliderSelected);
|
| 136 |
163 |
}
|
| 137 |
164 |
});
|
| 138 |
|
|
|
165 |
|
| 139 |
166 |
addMouseListeners();
|
| 140 |
167 |
addListener(SWT.KeyDown, new Listener() {
|
| 141 |
|
|
|
168 |
|
| 142 |
169 |
@Override
|
| 143 |
170 |
public void handleEvent(final Event event) {
|
| 144 |
171 |
handleKeyDown(event);
|
| 145 |
172 |
}
|
| 146 |
173 |
});
|
| 147 |
174 |
addPaintListener(new PaintListener() {
|
|
175 |
|
| 148 |
176 |
@Override
|
| 149 |
177 |
public void paintControl(final PaintEvent e) {
|
| 150 |
178 |
drawWidget(e);
|
| 151 |
|
|
|
179 |
|
| 152 |
180 |
}
|
| 153 |
181 |
});
|
| 154 |
|
|
|
182 |
|
| 155 |
183 |
}
|
| 156 |
|
|
|
184 |
|
| 157 |
185 |
/**
|
| 158 |
186 |
* Add the mouse listeners (mouse up, mouse down, mouse move, mouse wheel)
|
| 159 |
187 |
*/
|
| 160 |
188 |
private void addMouseListeners() {
|
| 161 |
189 |
addListener(SWT.MouseDown, new Listener() {
|
|
190 |
|
| 162 |
191 |
@Override
|
| 163 |
192 |
public void handleEvent(final Event e) {
|
| 164 |
193 |
handleMouseDown(e);
|
| 165 |
194 |
}
|
| 166 |
195 |
});
|
| 167 |
|
|
|
196 |
|
| 168 |
197 |
addListener(SWT.MouseUp, new Listener() {
|
|
198 |
|
| 169 |
199 |
@Override
|
| 170 |
200 |
public void handleEvent(final Event e) {
|
| 171 |
201 |
handleMouseUp(e);
|
| 172 |
202 |
}
|
| 173 |
203 |
});
|
| 174 |
|
|
|
204 |
|
| 175 |
205 |
addListener(SWT.MouseMove, new Listener() {
|
|
206 |
|
| 176 |
207 |
@Override
|
| 177 |
208 |
public void handleEvent(final Event e) {
|
| 178 |
209 |
handleMouseMove(e);
|
| 179 |
210 |
}
|
| 180 |
211 |
});
|
| 181 |
|
|
|
212 |
|
| 182 |
213 |
addListener(SWT.MouseWheel, new Listener() {
|
|
214 |
|
| 183 |
215 |
@Override
|
| 184 |
216 |
public void handleEvent(final Event e) {
|
| 185 |
217 |
handleMouseWheel(e);
|
| 186 |
218 |
}
|
| 187 |
219 |
});
|
| 188 |
|
|
|
220 |
|
| 189 |
221 |
}
|
| 190 |
|
|
|
222 |
|
| 191 |
223 |
/**
|
| 192 |
224 |
* Code executed when the mouse is down
|
| 193 |
225 |
*
|
| ... | ... | |
| 199 |
231 |
this.dragInProgress = true;
|
| 200 |
232 |
this.lastSelected = SELECTED_KNOB.UPPER;
|
| 201 |
233 |
this.previousUpperValue = this.upperValue;
|
| 202 |
|
} else if (this.lowerHover) {
|
|
234 |
}
|
|
235 |
else if (this.lowerHover) {
|
| 203 |
236 |
this.dragInProgress = true;
|
| 204 |
237 |
this.lastSelected = SELECTED_KNOB.LOWER;
|
| 205 |
238 |
this.previousLowerValue = this.lowerValue;
|
| 206 |
|
} else if (this.middleHover) {
|
|
239 |
}
|
|
240 |
else if (this.middleHover) {
|
| 207 |
241 |
this.dragInProgress = true;
|
| 208 |
242 |
this.lastSelected = SELECTED_KNOB.MIDDLE;
|
| 209 |
243 |
this.previousMiddleValue = this.middleValue;
|
| 210 |
|
} else {
|
|
244 |
}
|
|
245 |
else {
|
| 211 |
246 |
this.dragInProgress = true;
|
| 212 |
|
//this.lastSelected = SELECTED_KNOB.NONE;
|
|
247 |
// this.lastSelected = SELECTED_KNOB.NONE;
|
| 213 |
248 |
this.lastSelected = SELECTED_KNOB.MIDDLE;
|
| 214 |
249 |
this.previousMiddleValue = this.middleValue;
|
| 215 |
250 |
handleMouseMove(e);
|
| 216 |
251 |
}
|
| 217 |
|
//System.out.println("MouseDown : "+lastSelected);
|
|
252 |
// System.out.println("MouseDown : "+lastSelected);
|
| 218 |
253 |
}
|
| 219 |
|
|
|
254 |
|
| 220 |
255 |
/**
|
| 221 |
256 |
* Code executed when the mouse is up
|
| 222 |
257 |
*
|
| ... | ... | |
| 231 |
266 |
if (this.lastSelected == SELECTED_KNOB.UPPER) {
|
| 232 |
267 |
this.upperValue = this.previousUpperValue;
|
| 233 |
268 |
if (this.middleValue > this.upperValue) this.middleValue = upperValue;
|
| 234 |
|
} else if (this.lastSelected == SELECTED_KNOB.LOWER) {
|
|
269 |
}
|
|
270 |
else if (this.lastSelected == SELECTED_KNOB.LOWER) {
|
| 235 |
271 |
this.lowerValue = this.previousLowerValue;
|
| 236 |
272 |
if (this.middleValue < this.lowerValue) this.middleValue = lowerValue;
|
| 237 |
|
} else {
|
|
273 |
}
|
|
274 |
else {
|
| 238 |
275 |
this.middleValue = this.previousMiddleValue;
|
| 239 |
276 |
}
|
| 240 |
277 |
redraw();
|
| 241 |
278 |
}
|
| 242 |
279 |
}
|
| 243 |
|
|
|
280 |
|
| 244 |
281 |
/**
|
| 245 |
282 |
* Fire all selection listeners
|
| 246 |
283 |
*
|
| ... | ... | |
| 258 |
295 |
}
|
| 259 |
296 |
return true;
|
| 260 |
297 |
}
|
| 261 |
|
|
|
298 |
|
| 262 |
299 |
/**
|
| 263 |
300 |
* Code executed when the mouse pointer is moving
|
| 264 |
301 |
*
|
| ... | ... | |
| 270 |
307 |
this.upperHover = x >= this.coordUpper.x && x <= this.coordUpper.x + img.getBounds().width && y >= this.coordUpper.y && y <= this.coordUpper.y + img.getBounds().height;
|
| 271 |
308 |
this.middleHover = x >= this.coordMiddle.x && x <= this.coordMiddle.x + img.getBounds().width && y >= this.coordMiddle.y && y <= this.coordMiddle.y + img.getBounds().height;
|
| 272 |
309 |
this.lowerHover = x >= this.coordLower.x && x <= this.coordLower.x + img.getBounds().width && y >= this.coordLower.y && y <= this.coordLower.y + img.getBounds().height;
|
| 273 |
|
|
|
310 |
|
| 274 |
311 |
if (this.dragInProgress) {
|
| 275 |
312 |
if (this.orientation == SWT.HORIZONTAL) {
|
| 276 |
313 |
final int mouseValue = (int) ((x - 9f) / computePixelSizeForHorizonalSlider()) + this.minimum;
|
| 277 |
314 |
if (this.lastSelected == SELECTED_KNOB.UPPER) {
|
| 278 |
315 |
this.upperValue = (int) (Math.ceil(mouseValue / this.increment) * this.increment) - this.increment;
|
| 279 |
316 |
checkUpperValue();
|
| 280 |
|
} else if (this.lastSelected == SELECTED_KNOB.LOWER) {
|
|
317 |
}
|
|
318 |
else if (this.lastSelected == SELECTED_KNOB.LOWER) {
|
| 281 |
319 |
this.lowerValue = (int) (Math.ceil(mouseValue / this.increment) * this.increment) - this.increment;
|
| 282 |
320 |
checkLowerValue();
|
| 283 |
|
} else {
|
|
321 |
}
|
|
322 |
else {
|
| 284 |
323 |
this.middleValue = (int) (Math.ceil(mouseValue / this.increment) * this.increment) - this.increment;
|
| 285 |
324 |
checkMiddleValue();
|
| 286 |
325 |
}
|
| 287 |
|
|
| 288 |
|
} else {
|
|
326 |
|
|
327 |
}
|
|
328 |
else {
|
| 289 |
329 |
final int mouseValue = (int) ((y - 9f) / computePixelSizeForVerticalSlider()) + this.minimum;
|
| 290 |
330 |
if (this.lastSelected == SELECTED_KNOB.UPPER) {
|
| 291 |
331 |
this.upperValue = (int) (Math.ceil(mouseValue / this.increment) * this.increment) - this.increment;
|
| 292 |
332 |
checkUpperValue();
|
| 293 |
|
} else if (this.lastSelected == SELECTED_KNOB.LOWER) {
|
|
333 |
}
|
|
334 |
else if (this.lastSelected == SELECTED_KNOB.LOWER) {
|
| 294 |
335 |
this.lowerValue = (int) (Math.ceil(mouseValue / this.increment) * this.increment) - this.increment;
|
| 295 |
336 |
checkLowerValue();
|
| 296 |
|
} else {
|
|
337 |
}
|
|
338 |
else {
|
| 297 |
339 |
this.middleValue = (int) (Math.ceil(mouseValue / this.increment) * this.increment) - this.increment;
|
| 298 |
340 |
checkMiddleValue();
|
| 299 |
341 |
}
|
| 300 |
342 |
}
|
| 301 |
343 |
}
|
| 302 |
|
|
|
344 |
|
| 303 |
345 |
redraw();
|
| 304 |
346 |
}
|
| 305 |
|
|
|
347 |
|
| 306 |
348 |
/**
|
| 307 |
349 |
* Code executed when the mouse wheel is activated
|
| 308 |
350 |
*
|
| ... | ... | |
| 312 |
354 |
if (this.lastSelected == SELECTED_KNOB.NONE) {
|
| 313 |
355 |
return;
|
| 314 |
356 |
}
|
| 315 |
|
|
|
357 |
|
| 316 |
358 |
if (this.lastSelected == SELECTED_KNOB.LOWER) {
|
| 317 |
359 |
this.lowerValue += e.count * this.increment;
|
| 318 |
360 |
checkLowerValue();
|
| 319 |
361 |
redraw();
|
| 320 |
|
} else if (this.lastSelected == SELECTED_KNOB.UPPER) {
|
|
362 |
}
|
|
363 |
else if (this.lastSelected == SELECTED_KNOB.UPPER) {
|
| 321 |
364 |
this.upperValue += e.count * this.increment;
|
| 322 |
365 |
checkUpperValue();
|
| 323 |
366 |
redraw();
|
| 324 |
|
} else {
|
|
367 |
}
|
|
368 |
else {
|
| 325 |
369 |
this.middleValue += e.count * this.increment;
|
| 326 |
370 |
checkMiddleValue();
|
| 327 |
371 |
redraw();
|
| 328 |
372 |
}
|
| 329 |
373 |
}
|
| 330 |
|
|
|
374 |
|
| 331 |
375 |
/**
|
| 332 |
376 |
* Check if the lower value is in ranges
|
| 333 |
377 |
*/
|
| ... | ... | |
| 354 |
398 |
this.middleValue = this.upperValue;
|
| 355 |
399 |
}
|
| 356 |
400 |
}
|
| 357 |
|
|
|
401 |
|
| 358 |
402 |
/**
|
| 359 |
403 |
* Check if the upper value is in ranges
|
| 360 |
404 |
*/
|
| ... | ... | |
| 369 |
413 |
this.upperValue = this.lowerValue;
|
| 370 |
414 |
}
|
| 371 |
415 |
}
|
| 372 |
|
|
|
416 |
|
| 373 |
417 |
/**
|
| 374 |
418 |
* Draws the widget
|
| 375 |
419 |
*
|
| ... | ... | |
| 384 |
428 |
e.gc.setAntialias(SWT.ON);
|
| 385 |
429 |
if (this.orientation == SWT.HORIZONTAL) {
|
| 386 |
430 |
drawHorizontalRangeSlider(e.gc);
|
| 387 |
|
} else {
|
|
431 |
}
|
|
432 |
else {
|
| 388 |
433 |
drawVerticalRangeSlider(e.gc);
|
| 389 |
434 |
}
|
| 390 |
|
|
|
435 |
|
| 391 |
436 |
}
|
| 392 |
|
|
|
437 |
|
| 393 |
438 |
/**
|
| 394 |
439 |
* Draw the range slider (horizontal)
|
| 395 |
440 |
*
|
| ... | ... | |
| 402 |
447 |
this.coordMiddle = drawHorizontalKnob(gc, this.middleValue, SELECTED_KNOB.MIDDLE);
|
| 403 |
448 |
this.coordLower = drawHorizontalKnob(gc, this.lowerValue, SELECTED_KNOB.LOWER);
|
| 404 |
449 |
}
|
| 405 |
|
|
|
450 |
|
| 406 |
451 |
/**
|
| 407 |
452 |
* Draw the background
|
| 408 |
453 |
*
|
| ... | ... | |
| 410 |
455 |
*/
|
| 411 |
456 |
private void drawBackgroundHorizontal(final GC gc) {
|
| 412 |
457 |
final Rectangle clientArea = this.getClientArea();
|
| 413 |
|
|
|
458 |
|
| 414 |
459 |
gc.setBackground(getBackground());
|
| 415 |
460 |
gc.fillRectangle(clientArea);
|
| 416 |
|
|
|
461 |
|
| 417 |
462 |
if (isEnabled()) {
|
| 418 |
463 |
gc.setForeground(getForeground());
|
| 419 |
|
} else {
|
|
464 |
}
|
|
465 |
else {
|
| 420 |
466 |
gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_GRAY));
|
| 421 |
467 |
}
|
| 422 |
468 |
gc.drawRoundRectangle(9, 9, clientArea.width - 20, clientArea.height - 20, 3, 3);
|
| 423 |
|
|
|
469 |
|
| 424 |
470 |
final float pixelSize = computePixelSizeForHorizonalSlider();
|
| 425 |
471 |
final int startX = (int) (pixelSize * this.lowerValue);
|
| 426 |
472 |
final int endX = (int) (pixelSize * this.upperValue);
|
| 427 |
473 |
if (isEnabled()) {
|
| 428 |
474 |
gc.setBackground(getForeground());
|
| 429 |
|
} else {
|
|
475 |
}
|
|
476 |
else {
|
| 430 |
477 |
gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_GRAY));
|
| 431 |
478 |
}
|
| 432 |
479 |
gc.fillRectangle(12 + startX, 9, endX - startX - 6, clientArea.height - 20);
|
| 433 |
|
|
|
480 |
|
| 434 |
481 |
}
|
| 435 |
|
|
|
482 |
|
| 436 |
483 |
/**
|
| 437 |
484 |
* @return how many pixels corresponds to 1 point of value
|
| 438 |
485 |
*/
|
| 439 |
486 |
private float computePixelSizeForHorizonalSlider() {
|
| 440 |
487 |
return (getClientArea().width - 20f) / (this.maximum - this.minimum);
|
| 441 |
488 |
}
|
| 442 |
|
|
|
489 |
|
| 443 |
490 |
/**
|
| 444 |
491 |
* Draw the bars
|
| 445 |
492 |
*
|
| ... | ... | |
| 449 |
496 |
final Rectangle clientArea = this.getClientArea();
|
| 450 |
497 |
if (isEnabled()) {
|
| 451 |
498 |
gc.setForeground(getForeground());
|
| 452 |
|
} else {
|
|
499 |
}
|
|
500 |
else {
|
| 453 |
501 |
gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_GRAY));
|
| 454 |
502 |
}
|
| 455 |
|
|
|
503 |
|
| 456 |
504 |
final float pixelSize = computePixelSizeForHorizonalSlider();
|
| 457 |
505 |
for (int i = 1; i < 10; i++) {
|
| 458 |
506 |
final int x = (int) (9 + pixelSize * (this.maximum - this.minimum) / 10 * i);
|
| 459 |
507 |
gc.drawLine(x, 4, x, 7);
|
| 460 |
508 |
gc.drawLine(x, clientArea.height - 6, x, clientArea.height - 9);
|
| 461 |
509 |
}
|
| 462 |
|
|
|
510 |
|
| 463 |
511 |
}
|
| 464 |
|
|
|
512 |
|
| 465 |
513 |
/**
|
| 466 |
514 |
* Draws an horizontal knob
|
| 467 |
515 |
*
|
| ... | ... | |
| 478 |
526 |
if (knob == SELECTED_KNOB.UPPER) {
|
| 479 |
527 |
if (this.upperHover) {
|
| 480 |
528 |
image = this.dragInProgress ? this.sliderDrag : this.sliderHover;
|
| 481 |
|
} else if (this.lastSelected == SELECTED_KNOB.UPPER) {
|
|
529 |
}
|
|
530 |
else if (this.lastSelected == SELECTED_KNOB.UPPER) {
|
| 482 |
531 |
image = this.sliderSelected;
|
| 483 |
|
} else {
|
|
532 |
}
|
|
533 |
else {
|
| 484 |
534 |
image = this.slider;
|
| 485 |
535 |
}
|
| 486 |
|
} else if (knob == SELECTED_KNOB.LOWER) {
|
|
536 |
}
|
|
537 |
else if (knob == SELECTED_KNOB.LOWER) {
|
| 487 |
538 |
if (this.lowerHover) {
|
| 488 |
539 |
image = this.dragInProgress ? this.sliderDrag : this.sliderHover;
|
| 489 |
|
} else if (this.lastSelected == SELECTED_KNOB.LOWER) {
|
|
540 |
}
|
|
541 |
else if (this.lastSelected == SELECTED_KNOB.LOWER) {
|
| 490 |
542 |
image = this.sliderSelected;
|
| 491 |
|
} else {
|
|
543 |
}
|
|
544 |
else {
|
| 492 |
545 |
image = this.slider;
|
| 493 |
546 |
}
|
| 494 |
|
} else {
|
|
547 |
}
|
|
548 |
else {
|
| 495 |
549 |
if (this.middleHover) {
|
| 496 |
550 |
image = this.dragInProgress ? this.sliderDrag : this.sliderHover;
|
| 497 |
|
} else if (this.lastSelected == SELECTED_KNOB.MIDDLE) {
|
|
551 |
}
|
|
552 |
else if (this.lastSelected == SELECTED_KNOB.MIDDLE) {
|
| 498 |
553 |
image = this.sliderSelected;
|
| 499 |
|
} else {
|
|
554 |
}
|
|
555 |
else {
|
| 500 |
556 |
image = this.slider;
|
| 501 |
557 |
}
|
| 502 |
558 |
}
|
| 503 |
559 |
if (isEnabled()) {
|
| 504 |
560 |
gc.drawImage(image, x + 5, getClientArea().height / 2 - this.slider.getBounds().height / 2);
|
| 505 |
|
} else {
|
|
561 |
}
|
|
562 |
else {
|
| 506 |
563 |
final Image temp = new Image(getDisplay(), image, SWT.IMAGE_DISABLE);
|
| 507 |
564 |
gc.drawImage(temp, x + 5, getClientArea().height / 2 - this.slider.getBounds().height / 2);
|
| 508 |
565 |
temp.dispose();
|
| 509 |
566 |
}
|
| 510 |
567 |
return new Point(x + 5, getClientArea().height / 2 - this.slider.getBounds().height / 2);
|
| 511 |
568 |
}
|
| 512 |
|
|
|
569 |
|
| 513 |
570 |
/**
|
| 514 |
571 |
* Draw the range slider (vertical)
|
| 515 |
572 |
*
|
| ... | ... | |
| 522 |
579 |
this.coordMiddle = drawVerticalKnob(gc, this.middleValue, SELECTED_KNOB.MIDDLE);
|
| 523 |
580 |
this.coordLower = drawVerticalKnob(gc, this.lowerValue, SELECTED_KNOB.LOWER);
|
| 524 |
581 |
}
|
| 525 |
|
|
|
582 |
|
| 526 |
583 |
/**
|
| 527 |
584 |
* Draws the background
|
| 528 |
585 |
*
|
| ... | ... | |
| 532 |
589 |
final Rectangle clientArea = this.getClientArea();
|
| 533 |
590 |
gc.setBackground(getBackground());
|
| 534 |
591 |
gc.fillRectangle(clientArea);
|
| 535 |
|
|
|
592 |
|
| 536 |
593 |
if (isEnabled()) {
|
| 537 |
594 |
gc.setForeground(getForeground());
|
| 538 |
|
} else {
|
|
595 |
}
|
|
596 |
else {
|
| 539 |
597 |
gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_GRAY));
|
| 540 |
598 |
}
|
| 541 |
599 |
gc.drawRoundRectangle(9, 9, clientArea.width - 20, clientArea.height - 20, 3, 3);
|
| 542 |
|
|
|
600 |
|
| 543 |
601 |
final float pixelSize = computePixelSizeForVerticalSlider();
|
| 544 |
602 |
final int startY = (int) (pixelSize * this.lowerValue);
|
| 545 |
603 |
final int endY = (int) (pixelSize * this.upperValue);
|
| 546 |
604 |
if (isEnabled()) {
|
| 547 |
605 |
gc.setBackground(getForeground());
|
| 548 |
|
} else {
|
|
606 |
}
|
|
607 |
else {
|
| 549 |
608 |
gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_GRAY));
|
| 550 |
609 |
}
|
| 551 |
610 |
gc.fillRectangle(9, 12 + startY, clientArea.width - 20, endY - startY - 6);
|
| 552 |
|
|
|
611 |
|
| 553 |
612 |
}
|
| 554 |
|
|
|
613 |
|
| 555 |
614 |
/**
|
| 556 |
615 |
* @return how many pixels corresponds to 1 point of value
|
| 557 |
616 |
*/
|
| 558 |
617 |
private float computePixelSizeForVerticalSlider() {
|
| 559 |
618 |
return (getClientArea().height - 20f) / (this.maximum - this.minimum);
|
| 560 |
619 |
}
|
| 561 |
|
|
|
620 |
|
| 562 |
621 |
/**
|
| 563 |
622 |
* Draws the bars
|
| 564 |
623 |
*
|
| ... | ... | |
| 568 |
627 |
final Rectangle clientArea = this.getClientArea();
|
| 569 |
628 |
if (isEnabled()) {
|
| 570 |
629 |
gc.setForeground(getForeground());
|
| 571 |
|
} else {
|
|
630 |
}
|
|
631 |
else {
|
| 572 |
632 |
gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_GRAY));
|
| 573 |
633 |
}
|
| 574 |
|
|
|
634 |
|
| 575 |
635 |
final float pixelSize = computePixelSizeForVerticalSlider();
|
| 576 |
636 |
for (int i = 1; i < 10; i++) {
|
| 577 |
637 |
final int y = (int) (9 + pixelSize * (this.maximum - this.minimum) / 10 * i);
|
| 578 |
638 |
gc.drawLine(4, y, 7, y);
|
| 579 |
639 |
gc.drawLine(clientArea.width - 6, y, clientArea.width - 9, y);
|
| 580 |
|
|
|
640 |
|
| 581 |
641 |
}
|
| 582 |
|
|
|
642 |
|
| 583 |
643 |
}
|
| 584 |
|
|
|
644 |
|
| 585 |
645 |
/**
|
| 586 |
646 |
* Draws a vertical knob
|
| 587 |
647 |
*
|
| ... | ... | |
| 594 |
654 |
private Point drawVerticalKnob(final GC gc, final int value, final SELECTED_KNOB knob) {
|
| 595 |
655 |
final float pixelSize = computePixelSizeForVerticalSlider();
|
| 596 |
656 |
final int y = (int) (pixelSize * value);
|
| 597 |
|
|
|
657 |
|
| 598 |
658 |
Image image;
|
| 599 |
659 |
if (knob == SELECTED_KNOB.UPPER) {
|
| 600 |
660 |
if (this.upperHover) {
|
| 601 |
661 |
image = this.dragInProgress ? this.vSliderDrag : this.vSliderHover;
|
| 602 |
|
} else if (this.lastSelected == SELECTED_KNOB.UPPER) {
|
|
662 |
}
|
|
663 |
else if (this.lastSelected == SELECTED_KNOB.UPPER) {
|
| 603 |
664 |
image = this.vSliderSelected;
|
| 604 |
|
} else {
|
|
665 |
}
|
|
666 |
else {
|
| 605 |
667 |
image = this.vSlider;
|
| 606 |
668 |
}
|
| 607 |
|
} else if (knob == SELECTED_KNOB.LOWER) {
|
|
669 |
}
|
|
670 |
else if (knob == SELECTED_KNOB.LOWER) {
|
| 608 |
671 |
if (this.lowerHover) {
|
| 609 |
672 |
image = this.dragInProgress ? this.vSliderDrag : this.vSliderHover;
|
| 610 |
|
} else if (this.lastSelected == SELECTED_KNOB.LOWER) {
|
|
673 |
}
|
|
674 |
else if (this.lastSelected == SELECTED_KNOB.LOWER) {
|
| 611 |
675 |
image = this.vSliderSelected;
|
| 612 |
|
} else {
|
|
676 |
}
|
|
677 |
else {
|
| 613 |
678 |
image = this.vSlider;
|
| 614 |
679 |
}
|
| 615 |
|
} else { // MIDDLE
|
|
680 |
}
|
|
681 |
else { // MIDDLE
|
| 616 |
682 |
if (this.middleHover) {
|
| 617 |
683 |
image = this.dragInProgress ? this.vSliderDrag : this.vSliderHover;
|
| 618 |
|
} else if (this.lastSelected == SELECTED_KNOB.MIDDLE) {
|
|
684 |
}
|
|
685 |
else if (this.lastSelected == SELECTED_KNOB.MIDDLE) {
|
| 619 |
686 |
image = this.vSliderSelected;
|
| 620 |
|
} else {
|
|
687 |
}
|
|
688 |
else {
|
| 621 |
689 |
image = this.vSlider;
|
| 622 |
690 |
}
|
| 623 |
691 |
}
|
| 624 |
692 |
if (isEnabled()) {
|
| 625 |
693 |
gc.drawImage(image, getClientArea().width / 2 - 8, y + 2);
|
| 626 |
|
} else {
|
|
694 |
}
|
|
695 |
else {
|
| 627 |
696 |
final Image temp = new Image(getDisplay(), image, SWT.IMAGE_DISABLE);
|
| 628 |
697 |
gc.drawImage(temp, getClientArea().width / 2 - 8, y + 2);
|
| 629 |
698 |
temp.dispose();
|
| 630 |
699 |
}
|
| 631 |
700 |
return new Point(getClientArea().width / 2 - 8, y + 2);
|
| 632 |
701 |
}
|
| 633 |
|
|
|
702 |
|
| 634 |
703 |
/**
|
| 635 |
704 |
* Code executed when a key is typed
|
| 636 |
705 |
*
|
| 637 |
706 |
* @param event event
|
| 638 |
707 |
*/
|
| 639 |
708 |
private void handleKeyDown(final Event event) {
|
| 640 |
|
|
|
709 |
|
| 641 |
710 |
boolean needRedraw = false;
|
| 642 |
|
|
|
711 |
|
| 643 |
712 |
if (this.lastSelected == SELECTED_KNOB.NONE) {
|
| 644 |
713 |
this.lastSelected = SELECTED_KNOB.LOWER;
|
| 645 |
714 |
}
|
| 646 |
|
|
|
715 |
|
| 647 |
716 |
switch (event.keyCode) {
|
| 648 |
|
case SWT.HOME:
|
| 649 |
|
if (this.lastSelected == SELECTED_KNOB.UPPER) {
|
| 650 |
|
this.upperValue = this.minimum;
|
| 651 |
|
} else if (this.lastSelected == SELECTED_KNOB.LOWER) {
|
| 652 |
|
this.lowerValue = this.minimum;
|
| 653 |
|
} else {
|
| 654 |
|
this.middleValue = this.minimum;
|
| 655 |
|
}
|
| 656 |
|
needRedraw = true;
|
| 657 |
|
break;
|
| 658 |
|
case SWT.END:
|
| 659 |
|
if (this.lastSelected == SELECTED_KNOB.UPPER) {
|
| 660 |
|
this.upperValue = this.maximum;
|
| 661 |
|
} if (this.lastSelected == SELECTED_KNOB.LOWER) {
|
| 662 |
|
this.lowerValue = this.maximum;
|
| 663 |
|
} else {
|
| 664 |
|
this.middleValue = this.maximum;
|
| 665 |
|
}
|
| 666 |
|
needRedraw = true;
|
| 667 |
|
break;
|
| 668 |
|
case SWT.PAGE_UP:
|
| 669 |
|
if (this.lastSelected == SELECTED_KNOB.UPPER) {
|
| 670 |
|
this.upperValue += this.pageIncrement;
|
| 671 |
|
} else if (this.lastSelected == SELECTED_KNOB.LOWER) {
|
| 672 |
|
this.lowerValue += this.pageIncrement;
|
| 673 |
|
} else {
|
| 674 |
|
this.middleValue += this.pageIncrement;
|
| 675 |
|
}
|
| 676 |
|
needRedraw = true;
|
| 677 |
|
break;
|
| 678 |
|
case SWT.PAGE_DOWN:
|
| 679 |
|
if (this.lastSelected == SELECTED_KNOB.UPPER) {
|
| 680 |
|
this.upperValue -= this.pageIncrement;
|
| 681 |
|
} else if (this.lastSelected == SELECTED_KNOB.LOWER) {
|
| 682 |
|
this.lowerValue -= this.pageIncrement;
|
| 683 |
|
} else {
|
| 684 |
|
this.middleValue -= this.pageIncrement;
|
| 685 |
|
}
|
| 686 |
|
needRedraw = true;
|
| 687 |
|
break;
|
| 688 |
|
case SWT.ARROW_LEFT:
|
| 689 |
|
case SWT.ARROW_UP:
|
| 690 |
|
if (this.lastSelected == SELECTED_KNOB.UPPER) {
|
| 691 |
|
this.upperValue -= this.increment;
|
| 692 |
|
} else if (this.lastSelected == SELECTED_KNOB.LOWER) {
|
| 693 |
|
this.lowerValue -= this.increment;
|
| 694 |
|
} else {
|
| 695 |
|
this.middleValue -= this.increment;
|
| 696 |
|
}
|
| 697 |
|
needRedraw = true;
|
| 698 |
|
break;
|
| 699 |
|
case SWT.ARROW_RIGHT:
|
| 700 |
|
case SWT.ARROW_DOWN:
|
| 701 |
|
if (this.lastSelected == SELECTED_KNOB.UPPER) {
|
| 702 |
|
this.upperValue += this.increment;
|
| 703 |
|
} else if (this.lastSelected == SELECTED_KNOB.LOWER) {
|
| 704 |
|
this.lowerValue += this.increment;
|
| 705 |
|
} else {
|
| 706 |
|
this.middleValue += this.increment;
|
| 707 |
|
}
|
| 708 |
|
needRedraw = true;
|
| 709 |
|
break;
|
|
717 |
case SWT.HOME:
|
|
718 |
if (this.lastSelected == SELECTED_KNOB.UPPER) {
|
|
719 |
this.upperValue = this.minimum;
|
|
720 |
}
|
|
721 |
else if (this.lastSelected == SELECTED_KNOB.LOWER) {
|
|
722 |
this.lowerValue = this.minimum;
|
|
723 |
}
|
|
724 |
else {
|
|
725 |
this.middleValue = this.minimum;
|
|
726 |
}
|
|
727 |
needRedraw = true;
|
|
728 |
break;
|
|
729 |
case SWT.END:
|
|
730 |
if (this.lastSelected == SELECTED_KNOB.UPPER) {
|
|
731 |
this.upperValue = this.maximum;
|
|
732 |
}
|
|
733 |
if (this.lastSelected == SELECTED_KNOB.LOWER) {
|
|
734 |
this.lowerValue = this.maximum;
|
|
735 |
}
|
|
736 |
else {
|
|
737 |
this.middleValue = this.maximum;
|
|
738 |
}
|
|
739 |
needRedraw = true;
|
|
740 |
break;
|
|
741 |
case SWT.PAGE_UP:
|
|
742 |
if (this.lastSelected == SELECTED_KNOB.UPPER) {
|
|
743 |
this.upperValue += this.pageIncrement;
|
|
744 |
}
|
|
745 |
else if (this.lastSelected == SELECTED_KNOB.LOWER) {
|
|
746 |
this.lowerValue += this.pageIncrement;
|
|
747 |
}
|
|
748 |
else {
|
|
749 |
this.middleValue += this.pageIncrement;
|
|
750 |
}
|
|
751 |
needRedraw = true;
|
|
752 |
break;
|
|
753 |
case SWT.PAGE_DOWN:
|
|
754 |
if (this.lastSelected == SELECTED_KNOB.UPPER) {
|
|
755 |
this.upperValue -= this.pageIncrement;
|
|
756 |
}
|
|
757 |
else if (this.lastSelected == SELECTED_KNOB.LOWER) {
|
|
758 |
this.lowerValue -= this.pageIncrement;
|
|
759 |
}
|
|
760 |
else {
|
|
761 |
this.middleValue -= this.pageIncrement;
|
|
762 |
}
|
|
763 |
needRedraw = true;
|
|
764 |
break;
|
|
765 |
case SWT.ARROW_LEFT:
|
|
766 |
case SWT.ARROW_UP:
|
|
767 |
if (this.lastSelected == SELECTED_KNOB.UPPER) {
|
|
768 |
this.upperValue -= this.increment;
|
|
769 |
}
|
|
770 |
else if (this.lastSelected == SELECTED_KNOB.LOWER) {
|
|
771 |
this.lowerValue -= this.increment;
|
|
772 |
}
|
|
773 |
else {
|
|
774 |
this.middleValue -= this.increment;
|
|
775 |
}
|
|
776 |
needRedraw = true;
|
|
777 |
break;
|
|
778 |
case SWT.ARROW_RIGHT:
|
|
779 |
case SWT.ARROW_DOWN:
|
|
780 |
if (this.lastSelected == SELECTED_KNOB.UPPER) {
|
|
781 |
this.upperValue += this.increment;
|
|
782 |
}
|
|
783 |
else if (this.lastSelected == SELECTED_KNOB.LOWER) {
|
|
784 |
this.lowerValue += this.increment;
|
|
785 |
}
|
|
786 |
else {
|
|
787 |
this.middleValue += this.increment;
|
|
788 |
}
|
|
789 |
needRedraw = true;
|
|
790 |
break;
|
| 710 |
791 |
}
|
| 711 |
|
|
|
792 |
|
| 712 |
793 |
if (needRedraw) {
|
| 713 |
794 |
if (this.lastSelected == SELECTED_KNOB.UPPER) {
|
| 714 |
795 |
checkUpperValue();
|
| 715 |
|
} else if (this.lastSelected == SELECTED_KNOB.LOWER) {
|
|
796 |
}
|
|
797 |
else if (this.lastSelected == SELECTED_KNOB.LOWER) {
|
| 716 |
798 |
checkLowerValue();
|
| 717 |
|
} else {
|
|
799 |
}
|
|
800 |
else {
|
| 718 |
801 |
checkMiddleValue();
|
| 719 |
802 |
}
|
| 720 |
803 |
redraw();
|
| 721 |
804 |
}
|
| 722 |
805 |
}
|
| 723 |
|
|
|
806 |
|
| 724 |
807 |
/**
|
| 725 |
808 |
* Adds the listener to the collection of listeners who will be notified
|
| 726 |
809 |
* when the user changes the receiver's value, by sending it one of the
|
| ... | ... | |
| 732 |
815 |
*
|
| 733 |
816 |
* @param listener the listener which should be notified
|
| 734 |
817 |
*
|
| 735 |
|
* @exception IllegalArgumentException <ul>
|
|
818 |
* @exception IllegalArgumentException
|
|
819 |
* <ul>
|
| 736 |
820 |
* <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
|
| 737 |
821 |
* </ul>
|
| 738 |
|
* @exception SWTException <ul>
|
|
822 |
* @exception SWTException
|
|
823 |
* <ul>
|
| 739 |
824 |
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been
|
| 740 |
825 |
* disposed</li>
|
| 741 |
826 |
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the
|
| ... | ... | |
| 749 |
834 |
checkWidget();
|
| 750 |
835 |
this.listeners.add(listener);
|
| 751 |
836 |
}
|
| 752 |
|
|
|
837 |
|
| 753 |
838 |
/**
|
| 754 |
839 |
* @see org.eclipse.swt.widgets.Composite#computeSize(int, int, boolean)
|
| 755 |
840 |
*/
|
| ... | ... | |
| 760 |
845 |
if (this.orientation == SWT.HORIZONTAL) {
|
| 761 |
846 |
if (wHint < 100) {
|
| 762 |
847 |
width = 100;
|
| 763 |
|
} else {
|
|
848 |
}
|
|
849 |
else {
|
| 764 |
850 |
width = wHint;
|
| 765 |
851 |
}
|
| 766 |
|
|
|
852 |
|
| 767 |
853 |
if (hHint < 30) {
|
| 768 |
854 |
height = 30;
|
| 769 |
|
} else {
|
|
855 |
}
|
|
856 |
else {
|
| 770 |
857 |
height = hHint;
|
| 771 |
858 |
}
|
| 772 |
|
} else {
|
|
859 |
}
|
|
860 |
else {
|
| 773 |
861 |
if (wHint < 30) {
|
| 774 |
862 |
width = 30;
|
| 775 |
|
} else {
|
|
863 |
}
|
|
864 |
else {
|
| 776 |
865 |
width = wHint;
|
| 777 |
866 |
}
|
| 778 |
|
|
|
867 |
|
| 779 |
868 |
if (hHint < 100) {
|
| 780 |
869 |
height = 100;
|
| 781 |
|
} else {
|
|
870 |
}
|
|
871 |
else {
|
| 782 |
872 |
height = hHint;
|
| 783 |
873 |
}
|
| 784 |
874 |
}
|
| 785 |
|
|
|
875 |
|
| 786 |
876 |
return new Point(width, height);
|
| 787 |
877 |
}
|
| 788 |
|
|
|
878 |
|
| 789 |
879 |
/**
|
| 790 |
880 |
* Returns the amount that the selected receiver's value will be modified by
|
| 791 |
881 |
* when the up/down (or right/left) arrows are pressed.
|
| 792 |
882 |
*
|
| 793 |
883 |
* @return the increment
|
| 794 |
884 |
*
|
| 795 |
|
* @exception SWTException <ul>
|
|
885 |
* @exception SWTException
|
|
886 |
* <ul>
|
| 796 |
887 |
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been
|
| 797 |
888 |
* disposed</li>
|
| 798 |
889 |
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the
|
| ... | ... | |
| 803 |
894 |
checkWidget();
|
| 804 |
895 |
return this.increment;
|
| 805 |
896 |
}
|
| 806 |
|
|
|
897 |
|
| 807 |
898 |
/**
|
| 808 |
899 |
* Returns the 'lower selection', which is the lower receiver's position.
|
| 809 |
900 |
*
|
| 810 |
901 |
* @return the selection
|
| 811 |
902 |
*
|
| 812 |
|
* @exception SWTException <ul>
|
|
903 |
* @exception SWTException
|
|
904 |
* <ul>
|
| 813 |
905 |
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been
|
| 814 |
906 |
* disposed</li>
|
| 815 |
907 |
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the
|
| ... | ... | |
| 824 |
916 |
public SELECTED_KNOB getLastSelectedKnob() {
|
| 825 |
917 |
return lastSelected;
|
| 826 |
918 |
}
|
| 827 |
|
|
|
919 |
|
| 828 |
920 |
/**
|
| 829 |
921 |
* Returns the 'middle selection', which is the middle receiver's position.
|
| 830 |
922 |
*
|
| 831 |
923 |
* @return the selection
|
| 832 |
924 |
*
|
| 833 |
|
* @exception SWTException <ul>
|
|
925 |
* @exception SWTException
|
|
926 |
* <ul>
|
| 834 |
927 |
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been
|
| 835 |
928 |
* disposed</li>
|
| 836 |
929 |
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the
|
| ... | ... | |
| 847 |
940 |
*
|
| 848 |
941 |
* @return the maximum
|
| 849 |
942 |
*
|
| 850 |
|
* @exception SWTException <ul>
|
|
943 |
* @exception SWTException
|
|
944 |
* <ul>
|
| 851 |
945 |
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been
|
| 852 |
946 |
* disposed</li>
|
| 853 |
947 |
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the
|
| ... | ... | |
| 858 |
952 |
checkWidget();
|
| 859 |
953 |
return this.maximum;
|
| 860 |
954 |
}
|
| 861 |
|
|
|
955 |
|
| 862 |
956 |
/**
|
| 863 |
957 |
* Returns the minimum value which the receiver will allow.
|
| 864 |
958 |
*
|
| 865 |
959 |
* @return the minimum
|
| 866 |
960 |
*
|
| 867 |
|
* @exception SWTException <ul>
|
|
961 |
* @exception SWTException
|
|
962 |
* <ul>
|
| 868 |
963 |
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been
|
| 869 |
964 |
* disposed</li>
|
| 870 |
965 |
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the
|
| ... | ... | |
| 875 |
970 |
checkWidget();
|
| 876 |
971 |
return this.minimum;
|
| 877 |
972 |
}
|
| 878 |
|
|
|
973 |
|
| 879 |
974 |
/**
|
| 880 |
975 |
* Returns the amount that the selected receiver's value will be modified by
|
| 881 |
976 |
* when the page increment/decrement areas are selected.
|
| 882 |
977 |
*
|
| 883 |
978 |
* @return the page increment
|
| 884 |
979 |
*
|
| 885 |
|
* @exception SWTException <ul>
|
|
980 |
* @exception SWTException
|
|
981 |
* <ul>
|
| 886 |
982 |
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been
|
| 887 |
983 |
* disposed</li>
|
| 888 |
984 |
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the
|
| ... | ... | |
| 893 |
989 |
checkWidget();
|
| 894 |
990 |
return this.pageIncrement;
|
| 895 |
991 |
}
|
| 896 |
|
|
|
992 |
|
| 897 |
993 |
/**
|
| 898 |
994 |
* Returns the 'selection', which is an array where the first element is the
|
| 899 |
995 |
* lower selection, and the second element is the upper selection
|
| 900 |
996 |
*
|
| 901 |
997 |
* @return the selection
|
| 902 |
998 |
*
|
| 903 |
|
* @exception SWTException <ul>
|
|
999 |
* @exception SWTException
|
|
1000 |
* <ul>
|
| 904 |
1001 |
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been
|
| 905 |
1002 |
* disposed</li>
|
| 906 |
1003 |
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the
|
| ... | ... | |
| 915 |
1012 |
selection[2] = this.upperValue;
|
| 916 |
1013 |
return selection;
|
| 917 |
1014 |
}
|
| 918 |
|
|
|
1015 |
|
| 919 |
1016 |
/**
|
| 920 |
1017 |
* Returns the 'upper selection', which is the upper receiver's position.
|
| 921 |
1018 |
*
|
| 922 |
1019 |
* @return the selection
|
| 923 |
1020 |
*
|
| 924 |
|
* @exception SWTException <ul>
|
|
1021 |
* @exception SWTException
|
|
1022 |
* <ul>
|
| 925 |
1023 |
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been
|
| 926 |
1024 |
* disposed</li>
|
| 927 |
1025 |
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the
|
| ... | ... | |
| 932 |
1030 |
checkWidget();
|
| 933 |
1031 |
return this.upperValue;
|
| 934 |
1032 |
}
|
| 935 |
|
|
|
1033 |
|
| 936 |
1034 |
/**
|
| 937 |
1035 |
* Removes the listener from the collection of listeners who will be
|
| 938 |
1036 |
* notified when the user changes the receiver's value.
|
| 939 |
1037 |
*
|