view 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
line wrap: on
line source

/*******************************************************************************
 * Copyright (c) 2000, 2005 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 * Port to the D programming language:
 *     Frank Benoit <benoit@tionex.de>
 *******************************************************************************/
module dwtx.draw2d.RangeModel;

import dwt.dwthelper.utils;

import dwtx.dwtxhelper.Bean;

/**
 * This interface represents a range of possible values as well as the current values.
 * There is a minumum and maximum value, a current value, and the extent.  One use for a
 * RangeModel is a scrollbar.  There is a minimum value (the top of the scrollbar), a
 * maximum value (the bottom of the scrollbar), a current value (the top of the thumb),
 * and an extent (the length of the thumb).
 */
public interface RangeModel {

/** Value property name */
static const String PROPERTY_VALUE = "value"; //$NON-NLS-1$
/** Extent property name */
static const String PROPERTY_EXTENT = "extent"; //$NON-NLS-1$
/** Minimum property name */
static const String PROPERTY_MINIMUM = "minimum"; //$NON-NLS-1$
/** Maximum property name */
static const String PROPERTY_MAXIMUM = "maximum"; //$NON-NLS-1$

/**
 * Registers listener as a PropertyChangeListener of this RangeModel.  Listeners will be
 * notified of changes to {@link #PROPERTY_VALUE value}, {@link #PROPERTY_EXTENT extent},
 * {@link #PROPERTY_MINIMUM minimum} and {@link #PROPERTY_MAXIMUM maximum} properties.
 *
 * @param listener The listener to add
 */
void addPropertyChangeListener(PropertyChangeListener listener);

/**
 * Returns the extent.
 * @return The extent
 */
int getExtent();

/**
 * Returns the maximum value in the range.
 * @return The maximum value
 */
int getMaximum();

/**
 * Returns the minimum value in the range.
 * @return The minimum value
 */
int getMinimum();

/**
 * Returns the current value.
 * @return The current value
 */
int getValue();

/**
 * Returns <code>true</code> if this RangeModel is enabled.
 * @return <code>true</code> if this Rangel Model is enabled
 */
bool isEnabled();

/**
 * Removes the given listener from this RangeModel's list of PropertyChangeListeners.
 * @param listener The listener to remove
 */
void removePropertyChangeListener(PropertyChangeListener listener);

/**
 * Sets min, extent, and max all at once.
 * @param min the new mininum
 * @param extent the new extent
 * @param max the new maximum
 */
void setAll(int min, int extent, int max);

/**
 * Sets the extent.
 * @param extent The extent
 */
void setExtent(int extent);

/**
 * Sets the maximum value of the range.
 * @param max The maximum value
 */
void setMaximum(int max);

/**
 * Sets the minimum value of the range.
 * @param min The minimum value
 */
void setMinimum(int min);

/**
 * Sets the current value.
 * @param value The current value
 */
void setValue(int value);

}