Mercurial > projects > dwt-addons
comparison dwtx/draw2d/RangeModel.d @ 98:95307ad235d9
Added Draw2d code, still work in progress
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 03 Aug 2008 00:52:14 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
96:b492ba44e44d | 98:95307ad235d9 |
---|---|
1 /******************************************************************************* | |
2 * Copyright (c) 2000, 2005 IBM Corporation and others. | |
3 * All rights reserved. This program and the accompanying materials | |
4 * are made available under the terms of the Eclipse Public License v1.0 | |
5 * which accompanies this distribution, and is available at | |
6 * http://www.eclipse.org/legal/epl-v10.html | |
7 * | |
8 * Contributors: | |
9 * IBM Corporation - initial API and implementation | |
10 * Port to the D programming language: | |
11 * Frank Benoit <benoit@tionex.de> | |
12 *******************************************************************************/ | |
13 module dwtx.draw2d.RangeModel; | |
14 | |
15 import dwt.dwthelper.utils; | |
16 | |
17 import dwtx.dwtxhelper.Bean; | |
18 | |
19 /** | |
20 * This interface represents a range of possible values as well as the current values. | |
21 * There is a minumum and maximum value, a current value, and the extent. One use for a | |
22 * RangeModel is a scrollbar. There is a minimum value (the top of the scrollbar), a | |
23 * maximum value (the bottom of the scrollbar), a current value (the top of the thumb), | |
24 * and an extent (the length of the thumb). | |
25 */ | |
26 public interface RangeModel { | |
27 | |
28 /** Value property name */ | |
29 static const String PROPERTY_VALUE = "value"; //$NON-NLS-1$ | |
30 /** Extent property name */ | |
31 static const String PROPERTY_EXTENT = "extent"; //$NON-NLS-1$ | |
32 /** Minimum property name */ | |
33 static const String PROPERTY_MINIMUM = "minimum"; //$NON-NLS-1$ | |
34 /** Maximum property name */ | |
35 static const String PROPERTY_MAXIMUM = "maximum"; //$NON-NLS-1$ | |
36 | |
37 /** | |
38 * Registers listener as a PropertyChangeListener of this RangeModel. Listeners will be | |
39 * notified of changes to {@link #PROPERTY_VALUE value}, {@link #PROPERTY_EXTENT extent}, | |
40 * {@link #PROPERTY_MINIMUM minimum} and {@link #PROPERTY_MAXIMUM maximum} properties. | |
41 * | |
42 * @param listener The listener to add | |
43 */ | |
44 void addPropertyChangeListener(PropertyChangeListener listener); | |
45 | |
46 /** | |
47 * Returns the extent. | |
48 * @return The extent | |
49 */ | |
50 int getExtent(); | |
51 | |
52 /** | |
53 * Returns the maximum value in the range. | |
54 * @return The maximum value | |
55 */ | |
56 int getMaximum(); | |
57 | |
58 /** | |
59 * Returns the minimum value in the range. | |
60 * @return The minimum value | |
61 */ | |
62 int getMinimum(); | |
63 | |
64 /** | |
65 * Returns the current value. | |
66 * @return The current value | |
67 */ | |
68 int getValue(); | |
69 | |
70 /** | |
71 * Returns <code>true</code> if this RangeModel is enabled. | |
72 * @return <code>true</code> if this Rangel Model is enabled | |
73 */ | |
74 bool isEnabled(); | |
75 | |
76 /** | |
77 * Removes the given listener from this RangeModel's list of PropertyChangeListeners. | |
78 * @param listener The listener to remove | |
79 */ | |
80 void removePropertyChangeListener(PropertyChangeListener listener); | |
81 | |
82 /** | |
83 * Sets min, extent, and max all at once. | |
84 * @param min the new mininum | |
85 * @param extent the new extent | |
86 * @param max the new maximum | |
87 */ | |
88 void setAll(int min, int extent, int max); | |
89 | |
90 /** | |
91 * Sets the extent. | |
92 * @param extent The extent | |
93 */ | |
94 void setExtent(int extent); | |
95 | |
96 /** | |
97 * Sets the maximum value of the range. | |
98 * @param max The maximum value | |
99 */ | |
100 void setMaximum(int max); | |
101 | |
102 /** | |
103 * Sets the minimum value of the range. | |
104 * @param min The minimum value | |
105 */ | |
106 void setMinimum(int min); | |
107 | |
108 /** | |
109 * Sets the current value. | |
110 * @param value The current value | |
111 */ | |
112 void setValue(int value); | |
113 | |
114 } |