home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
cset21v1.zip
/
IBMCPP
/
IBMCLASS
/
ISLIDER.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-22
|
50KB
|
786 lines
#ifndef _ISLIDER_
#define _ISLIDER_
/*******************************************************************************
* FILE NAME: islider.hpp *
* *
* DESCRIPTION: *
* Declaration of the classes: *
* ISlider - Creates and manages a slider control. *
* IProgressIndicator - Creates and manages a progress indicator control. *
* *
* COPYRIGHT: *
* Licensed Materials - Property of IBM *
* (C) Copyright IBM Corporation 1992, 1993 *
* All Rights Reserved *
* US Government Users Restricted Rights - Use, duplication, or disclosure *
* restricted by GSA ADP Schedule Contract with IBM Corp. *
* *
*******************************************************************************/
#ifndef _ICONTROL_
#include <icontrol.hpp>
#endif
#ifndef _IBITFLAG_
#include <ibitflag.hpp>
#endif
// Forward declarations for other classes:
class IPoint;
class ISize;
class IString;
class IRectangle;
class IColor;
class IWindowHandle;
class IResourceId;
/*----------------------------------------------------------------------------*/
/* Align classes on four byte boundary. */
/*----------------------------------------------------------------------------*/
#pragma pack(4)
class IProgressIndicator : public IControl {
typedef IControl
Inherited;
/*******************************************************************************
* The IProgressIndicator class is a read-only version of the slider control. *
* (See the ISlider class for a complete description of the slider control.) *
* *
* A typical use of a progress indicator is to display the percentage of a *
* task that has been completed, by filling in its shaft as the task *
* progresses. *
* *
* Progress Indicator Window *
* | *
* V *
* +-----------------------------------------+ *
* | | *
* | 0 10 20 30 40 50<-------------Tick Text *
* | : : : : : :<--------------Tick Mark *
* | +--------***--------------------+ | *
* | | | | | | *
* | +--------***--------------------+ | *
* | A A | *
* | | | | *
* | | Slider Shaft | *
* | Slider Arm | *
* +-----------------------------------------+ *
* *
* Slider Shaft - A track for the slider arm to move along. *
* Tick Mark - A mark that indicates an incremental value in the slider's *
* scale. *
* Tick Text - A label that indicates the value the tick mark represents. *
* Slider Arm - The slider arm shows the current level of progress along *
* the slider shaft. For the progress indicator, the arm is *
* barely visible and cannot be moved by the user. The *
* slider arm's position can only be changed programatically. *
* *
* By default, the progress indicator is created horizontally and centered in *
* the window with its ticks and text above it. The arm is based on the left *
* edge and the shaft fills with color as the arm moves to the right. It can *
* also be constructed with the ticks and text below the shaft, at various *
* positions in the window, and based on the right edge. If the progress *
* indicator is constructed vertically, all the related options are still *
* available. *
* *
* Example: *
* *
* The following example creates a progress indicator in the constructor of a *
* subclass of IFrameWindow, and therefore uses "this" for its parent and *
* owner. The tick lengths are then set and numbered. *
* *
* IRectangle rectangle(60,60,440,240); *
* unsigned long numberOfTicks = 15; *
* *
* myIndicator = new IProgressIndicator( (unsigned long)ID_PROGIND, *
* this, this, *
* rectangle, *
* numberOfTicks ); *
* myIndicator->setTickLength(10); *
* for (unsigned long z=0; z<15; z++) *
* myIndicator->setTickText(z, (char*)(IString(z))); *
* *
*******************************************************************************/
public:
class Style; // forward declaration
/*------------------------- Constructors ---------------------------------------
| You can construct instances of this class in the following ways: |
| -- By using the primary constructor. This constructor takes seven |
| arguments, five of which are required: |
| - A unique ID for the control. |
| - A parent window. |
| - An owner window. |
| - A rectangle that defines the size and placement of the control |
| window. |
| - The number of ticks to be placed on the primary scale of the |
| progress indicator. |
| - The number of pixels between ticks. This defaults to 0, which |
| causes the control to evenly space the ticks on the shaft. If this |
| argument is specified, the length of the slider shaft will be |
| determined based on this number and the number of ticks specified. |
| NOTE: The arm position is not set to the same tick position when the |
| progress indicator control window is resized. This typically |
| occurs when the control is on a canvas and the default for |
| tick spacing is taken on the constructor. The arm is |
| positioned at the same pixel offset, instead of at the same |
| relative position from home. |
| - The style of the control. |
| -- By specifying the number of ticks and spacing for both scale1 and |
| scale2. |
| NOTE: Various repaint problems can occur when the progress indicator |
| control is resized with IWindow::sizeTo or IWindow::moveSizeTo. |
| The problems occur when the width of the window is less than the |
| width of the entire control. This typically happens when tick |
| spacing has been specified on the constructor; otherwise, the |
| control is able to resize itself. |
| -- From a parent window. This constructor requires two arguments: |
| - A unique ID for the control. |
| - A parent window. |
| -- From a window handle. This constructor requires one argument: the |
| window handle of the control. |
------------------------------------------------------------------------------*/
IProgressIndicator ( unsigned long windowId,
IWindow* parent,
IWindow* owner,
const IRectangle& initial,
unsigned long numberOfTicks,
unsigned long tickSpacing = 0,
const Style& style = defaultStyle() );
IProgressIndicator ( unsigned long windowId,
IWindow* parent,
IWindow* owner,
const IRectangle& initial,
unsigned long scale1NumberOfTicks,
unsigned long scale1TickSpacing,
unsigned long scale2NumberOfTicks,
unsigned long scale2TickSpacing = 0,
const Style& style = defaultStyle() );
IProgressIndicator ( unsigned long windowId,
IWindow* parent );
IProgressIndicator ( const IWindowHandle& handle );
virtual
~IProgressIndicator ( );
/*---------------------------------- Style -------------------------------------
| The following functions provide a means to set and query progress indicator |
| styles: |
| |
| Style - Nested class that provides static members that define the set of |
| valid progress indicator styles. These styles can be used in |
| conjunction with the styles defined by the nested classes |
| IWindow::Style and IControl::Style. For example, you could |
| define an instance of the IProgressIndicator::Style class and |
| initialize it like: |
| IProgressIndicator::Style |
| style = IProgressIndicator::vertical | |
| IWindow::visible; |
| An object of this type is provided when the progress indicator |
| is created. A customizable default is used if no styles are |
| specified. |
| |
| The declaration of the IProgressIndicator::Style nested class is |
| generated by the INESTEDBITFLAGCLASSDEF2 macro. |
| |
| The valid progress indicator styles are: |
| classDefaultStyle - Original default style for this class, which is |
| IWindow::visible | horizontal | alignCentered | |
| homeLeft | ribbonStrip | primaryScale1. |
| horizontal - Specifies that the progress indicator be built |
| horizontally. |
| vertical - Specifies that the progress indicator be built |
| vertically. |
| alignCentered - Progress indicator is centered in the window. |
| alignTop - Progress indicator is at the top of the window. |
| alignBottom - Progress indicator is at the bottom of the window. |
| alignLeft - Progress indicator is at the left of the window. |
| alignRight - Progress indicator is at the right of the window. |
| homeTop - Specifies that the progress indicator's arm and scale |
| start at the top. |
| homeBottom - Specifies that the progress indicator's arm and scale |
| start at the bottom. |
| homeLeft - Specifies that the progress indicator's arm and scale |
| start at the left. |
| homeRight - Specifies that the progress indicator's arm and scale |
| start at the right. |
| primaryScale1 - The progress indicator's scale1 is used for |
| positioning the arm, and is located above or right of |
| the progress indicator. |
| primaryScale2 - The progress indicator's scale2 is used for |
| positioning the arm, and is located below or left of |
| the progress indicator. |
| snapToTickMark - Specifies that the progress indicator's arm snap to |
| the nearest tick when moved between two ticks. |
| ribbonStrip - The progress indicator's shaft fills with color |
| between the arm and home position when the arm is |
| moved. |
| handleDrawItem - An ISliderDrawItemEvent is dispatched to the control |
| whenever the shaft, ribbon strip, arm, and background |
| are to be drawn. |
| |
| The following functions provide a means of getting and setting the default |
| style for this class: |
| defaultStyle - Returns the current default style. This is the same as |
| classDefaultStyle unless setDefaultStyle has been |
| called. |
| setDefaultStyle - Sets the default style for all subsequent progress |
| indicators. |
------------------------------------------------------------------------------*/
INESTEDBITFLAGCLASSDEF2(Style, IProgressIndicator, IWindow, IControl);
// style class definitions
static const Style
classDefaultStyle,
horizontal,
vertical,
alignCentered,
alignTop,
alignBottom,
alignLeft,
alignRight,
homeTop,
homeBottom,
homeLeft,
homeRight,
primaryScale1,
primaryScale2,
snapToTickMark,
ribbonStrip,
handleDrawItem;
static Style
defaultStyle ( );
static void
setDefaultStyle ( const Style& style );
/*------------------------------ Related Types ---------------------------------
| The following enumeration types are defined to pass "modes" to various |
| implementation functions: |
| Alignment - An enumeration used to determine the placement of the |
| progress indicator. The allowable values are: |
| topRight - A vertical progress indicator is aligned to |
| the right of the control window; a horizontal |
| progress indicator is aligned to the top. |
| bottomLeft - A vertical progress indicator is aligned to |
| the left of the control window; a horizontal |
| progress indicator is aligned to the bottom. |
| centered - The progress indicator is center aligned. |
| HomePosition - An enumeration that specifies the home position of the |
| progress indicator. The allowable values are: |
| homeBottomLeft - Home position is at the bottom for a |
| vertical progress indicator and at the |
| left for a horizontal progress indicator. |
| homeTopRight - Home position is at the top for a |
| vertical progress indicator and at the |
| right for a horizontal progress indicator. |
| Scale - An enumeration used to specify which scale is being |
| referred to. The allowable values are: |
| scale1 - Scale 1 is above a horizontal progress indicator, |
| and to the right of a vertical progress indicator. |
| scale2 - Scale 2 is below a horizontal progress indicator, |
| and to the left of a vertical progress indicator. |
| ColorArea - An enumeration that specifies the area of the progress |
| indicator being referred to in a color operation. The |
| allowable values are: |
| background - The background of the progress indicator |
| control window. |
| foreground - The text and bit maps used for the progress |
| indicator. |
| border - The color of the border that surrounds the |
| progress indicator. |
------------------------------------------------------------------------------*/
enum Alignment { topRight, bottomLeft, centered };
enum HomePosition { homeTopRight, homeBottomLeft };
enum Scale { scale1, scale2 };
enum ColorArea { background, foreground, border };
/*----------------------------- Style Functions --------------------------------
| The following functions provide a means for getting and setting the styles |
| of instances of this class: |
| alignment - Returns the alignment of the progress indicator as |
| one of the values of the Alignment enumeration. |
| homePosition - Returns the home position of the progress |
| indicator as one of the values of the HomePosition |
| enumeration. |
| primaryScale - Returns the primary scale of the progress |
| indicator as one of the values of the Scale |
| enumeration. |
| isVertical - If the progress indicator is oriented vertically, |
| true is returned. If it is oriented horizontally, |
| false is returned. |
| isRibbonStripEnabled - Returns true if the ribbonStrip style is set. |
| isDrawItemEnabled - Returns true if the handleDrawItem style is set. |
| isSnapToTickEnabled - Returns true if the snapToTickMark style is set. |
| setHomePosition - Sets the home position of the progress indicator |
| to one of the values of the HomePosition |
| enumeration. |
| setPrimaryScale - Sets the primary scale of the progress indicator |
| to one of the values of the Scale enumeration. |
| enableSnapToTick - Sets the snapToTickMark style on if the |
| snapToTickOn argument is true; otherwise, the |
| style is set off. |
| disableSnapToTick - Sets the snapToTickMark style off. |
| enableRibbonStrip - Sets the ribbonStrip style on if the ribbonStripOn |
| argument is true; otherwise, the style is set off. |
| disableRibbonStrip - Sets the ribbonStrip style off. |
| enableDrawItem - Sets the handleDrawItem style on if the drawItemOn |
| argument is true; otherwise, the style is set off. |
| disableDrawItem - Sets the handleDrawItem style off. |
------------------------------------------------------------------------------*/
Alignment
alignment ( ) const;
HomePosition
homePosition ( ) const;
Scale
primaryScale ( ) const;
Boolean
isVertical ( ) const,
isRibbonStripEnabled ( ) const,
isDrawItemEnabled ( ) const,
isSnapToTickEnabled ( ) const;
IProgressIndicator
&setHomePosition ( HomePosition home ),
&setPrimaryScale ( Scale primaryScale ),
&enableSnapToTick ( Boolean snapToTickOn = true ),
&disableSnapToTick ( ),
&enableRibbonStrip ( Boolean ribbonStripOn = true ),
&disableRibbonStrip ( ),
&enableDrawItem ( Boolean drawItemOn = true ),
&disableDrawItem ( );
/*----------------------------- Tick Operations --------------------------------
| The following functions provide a means for setting and getting attributes |
| of ticks: |
| tickText - Returns the text associated with the tick at the |
| specified index. Ticks are numbered starting with 0. |
| tickPosition - Returns the pixel position of the tick at the specified |
| index. Ticks are numbered starting with 0. |
| tickLength - Returns the length of the tick at the specified index, in |
| pixels. |
| tickSpacing - Returns the number of pixels between ticks for the |
| specified scale. |
| numberOfTicks - Returns the number of ticks for the specified scale. |
| setTickLength - Sets the length of a tick, or all ticks, on the progress |
| indicator scale depending on which version of the |
| overloaded function is used. Ticks are created with 0 |
| length and are thus initially invisible. |
| setTicks - Sets the number of ticks and number of pixels between |
| ticks for one or both scales, depending on which version |
| of the overloaded function is used. |
| setTickText - Sets the text associated with the tick at the specified |
| index. A tick need not be visible to have text |
| associated with it. This function is overloaded so the |
| text can be passed in as a character string or loaded |
| from a resource using a passed in IResourceId. |
------------------------------------------------------------------------------*/
IString
tickText ( unsigned long tickNumber ) const;
IPoint
tickPosition ( unsigned long tickNumber ) const;
unsigned long
tickLength ( unsigned long tickNumber ) const,
tickSpacing ( Scale scale ) const,
numberOfTicks ( Scale scale ) const;
IProgressIndicator
&setTickLength ( unsigned long tickNumber,
unsigned long length ),
&setTickLength ( unsigned long length ),
&setTicks ( unsigned long scale1NumberOfTicks,
unsigned long scale2NumberOfTicks,
unsigned long scale1TickSpacing = 0,
unsigned long scale2TickSpacing = 0 ),
&setTicks ( Scale scale,
unsigned long numberOfTicks,
unsigned long tickSpacing = 0 ),
&setTickText ( unsigned long tickNumber,
const char* text ),
&setTickText ( unsigned long tickNumber,
const IResourceId& text );
/*----------------------------- Shaft Operations -------------------------------
| The following functions provide a means for setting and getting attributes |
| of the progress indicator shaft: |
| shaftPosition - Returns the lower left point of the shaft relative to |
| the lower left corner of the control window. |
| shaftSize - Returns the size of the shaft, in pixels. |
| setShaftPosition - Sets the position of the lower left point of the |
| shaft, in pixels. The position of the shaft is |
| relative to the lower left corner of the control |
| window. |
| setShaftBreadth - Sets the width for vertical progress indicators, or |
| height for horizontal progress indicators, of the |
| shaft, in pixels. |
------------------------------------------------------------------------------*/
IPoint
shaftPosition ( ) const;
ISize
shaftSize ( ) const;
IProgressIndicator
&setShaftPosition ( const IPoint& lowerLeft ),
&setShaftBreadth ( unsigned long breadth );
/*------------------------------ Arm Operations --------------------------------
| The following functions provide a means for setting and getting attributes |
| of the progress indicator arm: |
| armRange - Returns the number of pixels over which the arm can be |
| moved. |
| armPixelOffset - Returns the offset of the arm from the home position, in |
| pixels. |
| armTickOffset - Returns the position of the arm as a tick number. Ticks |
| are numbered starting at 0. |
| moveArmToTick - Moves the arm to a tick. Ticks are numbered starting at |
| 0. Using this function can cause an exception if the |
| control window has no size and if tick spacing has been |
| specified on the constructor. |
| moveArmToPixel - Moves the arm to a pixel offset relative to the home |
| position. |
------------------------------------------------------------------------------*/
unsigned long
armRange ( ) const,
armPixelOffset ( ) const,
armTickOffset ( ) const;
IProgressIndicator
&moveArmToTick ( unsigned long tickNumber ),
&moveArmToPixel ( unsigned long armOffset );
/*----------------------------- Color Operations -------------------------------
| The following functions provide a means for setting and getting the color of |
| the foreground or background of the progress indicator control window: |
| setColor - Sets the color to be used for the portion of the progress |
| indicator control window specified by the value argument. It |
| must be one of the values of the ColorArea enumeration. |
| color - Returns the color used for the portion of the progress |
| indicator control window specified by the value argument. It |
| must be one of the values specified by the ColorArea |
| enumeration. |
------------------------------------------------------------------------------*/
IColor
color ( ColorArea value ) const;
IProgressIndicator
&setColor ( ColorArea value,
const IColor& color );
protected:
/*------------------------------ Implementation --------------------------------
| The following functions are provided for use by this class and any of its |
| subclasses: |
| calcMinimumSize - Returns an ISize that indicates the minimum size that |
| the progress indicator can be. This is used by the |
| ICanvas hierarchy of classes. |
| initialize - Used by several of the constructors to create a |
| progress indicator or slider control. |
------------------------------------------------------------------------------*/
virtual ISize
calcMinimumSize ( ) const;
void
initialize ( unsigned long windowId,
unsigned long parent,
unsigned long owner,
unsigned long style,
const IRectangle& initial,
void * sliderData );
/*-------------------------- Protected Constructor -----------------------------
| IProgressIndicator - Constructor used by the ISlider class to allow it to |
| control the creation of the slider. |
------------------------------------------------------------------------------*/
IProgressIndicator ( );
private:
/*--------------------------------- PRIVATE ----------------------------------*/
IProgressIndicator ( const IProgressIndicator& anIndicator);
IProgressIndicator&
operator= ( const IProgressIndicator& anIndicator);
char*
getTickText ( unsigned long tickNumber,
char* buffer = 0,
unsigned long bufferLength = 0 ) const;
unsigned long
tickTextLength ( unsigned long tickNumber ) const;
static Style
currentDefaultStyle;
}; // IProgressIndicator
INESTEDBITFLAGCLASSFUNCS(Style, IProgressIndicator);
// global style functions
class ISlider : public IProgressIndicator {
typedef IProgressIndicator
Inherited;
/*******************************************************************************
* The ISlider class is a full implementation of the Presentation Manager *
* Extension slider control, whose purpose is to allow a user to set, display, *
* or modify a value by moving the slider arm along the slider shaft. *
* *
* Slider Window *
* | *
* V *
* +----------------------------------------+ *
* | | *
* | 0 10 20 30 40 50<------------Tick Text *
* | : v : : : : :<-------------Tick Mark *
* | +--A-----***--------------------+-+-+| *
* | | | | | |<|>|| *
* | +--|-----***--------------------+-+-+| *
* | | A A A | *
* | Detent | | | | *
* | | Slider Shaft Slider Buttons *
* | Slider Arm | *
* +----------------------------------------+ *
* *
* Slider Arm - An arm that the user can move along the shaft to set *
* slider values. The slider arm shows the current value by *
* its position on the slider shaft and can be changed *
* programatically, as well as by the user. *
* Slider Shaft - A track for the slider arm to move along. *
* Slider Buttons - Buttons that move the slider arm one incremental position *
* in the indicated direction. *
* Detent - A user-selectable mark that can be placed anywhere along *
* the slider's scale. *
* Tick Text - A label that indicates the value the tick mark represents. *
* Tick Mark - A mark that indicates an incremental value in the *
* slider's scale. Tick marks are evenly spaced along the *
* shaft. *
* *
* Sliders typically allow a user to set values that have familiar increments, *
* such as feet or degrees. They can also be used for other purposes, such as *
* blending colors or showing the percentage of a task that has been completed. *
* Since the slider is interactive, detents and buttons are provided and the *
* slider arm is larger so it can be easily dragged by the user. *
* *
* By default, the slider is created horizontally in the center of the control *
* window, with the slider arm based on the left side, and the ticks and text *
* above the shaft. The horizontal slider has several alternative *
* construction styles: *
* - The ticks and text can be placed below the shaft. *
* - The slider can be placed at the top or bottom of the control window. *
* - The arm can be based on either the right or left side. *
* *
* A related set of options is available for creating a vertical slider: *
* - The ticks and text can be placed either left or right of the shaft. *
* - The slider can be placed at the left or right of the control window. *
* - The arm can be based on either the top or the bottom. *
* *
* Other style options include incremental-movement buttons at either end of *
* the slider and having the slider shaft fill with color as the arm moves. *
* *
* Example: *
* *
* The following example creates a slider in the constructor of a subclass of *
* IFrameWindow, and therefore uses "this" for its parent and owner. The tick *
* lengths are then set and numbered. *
* *
* *
* IRectangle rectangle(60,60,440,240); *
* unsigned long numberOfTicks = 15; *
* *
* mySlider = new ISlider( (unsigned long)ID_SLIDER, *
* this, this, *
* rectangle, *
* numberOfTicks ); *
* mySlider->setTickLength(10); *
* for (unsigned long z=0; z<15; z++) *
* mySlider->setTickText(z, (char*)(IString(z))); *
* *
*******************************************************************************/
public:
class Style; // forward declaration
/*------------------------- Constructors ---------------------------------------
| You can construct instances of this class in the following ways: |
| - By using the primary constructor. This constructor takes seven |
| arguments, five of which are required: |
| - A unique ID for the control. |
| - A parent window. |
| - An owner window. |
| - A rectangle that defines the size and placement of the control |
| window. |
| - The number of ticks to be placed on the primary scale of the slider. |
| - The number of pixels between ticks. This defaults to 0, which |
| causes the control to evenly space the ticks on the shaft. If this |
| argument is specified, the length of the slider shaft will be |
| determined based on this number and the number of ticks specified. |
| - The style of the control. |
| - By constructing with the number of ticks and spacing for both scale1 |
| and scale2. |
| - By constructing from a parent window. This constructor requires two |
| arguments: |
| - A unique ID for the control. |
| - A parent window. |
| - By constructing from a window handle. This constructor requires one |
| argument: the window handle of the control. |
------------------------------------------------------------------------------*/
ISlider ( unsigned long windowId,
IWindow* parent,
IWindow* owner,
const IRectangle& initial,
unsigned long numberOfTicks,
unsigned long tickSpacing = 0,
const Style& style = defaultStyle() );
ISlider ( unsigned long windowId,
IWindow* parent,
IWindow* owner,
const IRectangle& initial,
unsigned long scale1NumberOfTicks,
unsigned long scale1TickSpacing,
unsigned long scale2NumberOfTicks,
unsigned long scale2TickSpacing = 0,
const Style& style = defaultStyle() );
ISlider ( unsigned long windowId,
IWindow* parent );
ISlider ( const IWindowHandle& handle );
virtual
~ISlider ( );
/*---------------------------------- Style -------------------------------------
| The following functions provide a means to set and query slider styles: |
| |
| Style - Nested class that provides static members that define the set of |
| valid slider styles. These styles can be used in conjunction |
| with the styles defined by the nested classes IWindow::Style, |
| IControl::Style, and IProgressIndicator::Style. For example, |
| you could define an instance of the ISlider::Style class and |
| initialize it like: |
| ISlider::Style |
| style = IProgressIndicator::vertical | |
| ISlider::buttonsTop | IWindow::visible; |
| An object of this type is provided when the slider is created. |
| A customizable default is used if no styles are specified. |
| |
| The declaration of the ISlider::Style nested class is generated |
| by the INESTEDBITFLAGCLASSDEF3 macro. |
| |
| The valid slider styles are: |
| classDefaultStyle - Original default style for this class, which is |
| IWindow::visible | IProgressIndicator::horizontal | |
| IProgressIndicator::alignCentered | |
| IProgressIndicator::homeLeft | |
| IProgressIndicator::primaryScale1 | buttonsLeft. |
| buttonsTop - The slider's buttons are placed above the slider |
| shaft. |
| buttonsBottom - The slider's buttons are placed below the slider |
| shaft. |
| buttonsLeft - The slider's buttons are placed to the left of the |
| slider shaft. |
| buttonsRight - The slider's buttons are placed to the right of the |
| slider shaft. |
| |
| The following functions provide a means of getting and setting the default |
| style for this class: |
| defaultStyle - Returns the current default style. This is the same as |
| classDefaultStyle unless setDefaultStyle has been |
| called. |
| setDefaultStyle - Sets the default style for all subsequent sliders. |
------------------------------------------------------------------------------*/
INESTEDBITFLAGCLASSDEF3(Style, ISlider, IWindow, IControl, IProgressIndicator);
// style class definition
static const Style
classDefaultStyle,
buttonsTop,
buttonsBottom,
buttonsLeft,
buttonsRight;
static Style
defaultStyle ( );
static void
setDefaultStyle ( const Style& style );
/*------------------------------ Related Types ---------------------------------
| The following enumeration type is defined to return "modes" in the |
| buttonsPosition function: |
| ButtonsPosition - Enumeration used to determine the placement of the |
| slider's buttons. The buttons are used to move the |
| slider arm one tick in the direction that is selected. |
| The allowable values are: |
| top - The slider's buttons are placed above the |
| slider shaft. |
| bottom - The slider's buttons are placed below the |
| slider shaft. |
| left - The slider's buttons are placed to the left |
| of the slider shaft. |
| right - The slider's buttons are placed to the right |
| of the slider shaft. |
| none - The slider's buttons are removed. |
------------------------------------------------------------------------------*/
enum ButtonsPosition { top, bottom,
left, right, none };
/*----------------------------- Style Functions --------------------------------
| The following function provides a means for getting and setting the styles |
| of instances of this class: |
| buttonsPosition - Returns the position of the slider's buttons as a value |
| of the ButtonsPosition enumeration. |
------------------------------------------------------------------------------*/
ButtonsPosition
buttonsPosition ( ) const;
/*---------------------------- Detent Operations -------------------------------
| The following functions provide a means for getting and setting attributes |
| for a slider's detents: |
| detentPosition - Returns the offset of a detent from the home position, |
| in pixels. The ID of the detent must be specified. |
| addDetent - Adds a detent to the slider at the pixel offset from the |
| home position specified. Returns a unique ID, which is |
| required for removing a detent or querying its position. |
| removeDetent - Removes the detent with the specified ID from the slider. |
------------------------------------------------------------------------------*/
unsigned long
detentPosition ( unsigned long detentId ) const, // in pixels
addDetent ( unsigned long offset );
ISlider
&removeDetent ( unsigned long detentId );
/*------------------------------ Arm Operations --------------------------------
| The following functions provide a means for setting and getting attributes |
| of the slider arm: |
| armSize - Returns the size of the arm, in pixels. |
| setArmSize - Sets the size of the arm, in pixels. |
------------------------------------------------------------------------------*/
ISize
armSize ( ) const;
ISlider
&setArmSize ( const ISize& sliderArm );
private:
/*--------------------------------- PRIVATE ----------------------------------*/
ISlider ( const ISlider& aSlider );
ISlider&
operator= ( const ISlider& aSlider );
static Style
currentDefaultStyle;
}; // ISlider
INESTEDBITFLAGCLASSFUNCS(Style, ISlider);
// global style functions
/*----------------------------------------------------------------------------*/
/* Resume compiler default packing. */
/*----------------------------------------------------------------------------*/
#pragma pack()
/*--------------------------------- INLINES ----------------------------------*/
#ifndef I_NO_INLINES
#include <islider.inl>
#endif
#endif /* _ISLIDER_ */