Wt::WSlider Class Reference

A horizontal or vertical slider control. More...

#include <Wt/WSlider>

Inheritance diagram for Wt::WSlider:

Inheritance graph
[legend]

List of all members.

Public Types

enum  TickPosition { TicksAbove = 0x1, TicksBelow = 0x2, TicksLeft = 0x1, TicksRight = 0x2 }
 Enumeration that specifies the location of ticks. More...

Public Member Functions

 WSlider (WContainerWidget *parent=0)
 Create a default horizontal slider.
 WSlider (Orientation orientation, WContainerWidget *parent=0)
 Create a default slider of the given orientation.
 ~WSlider ()
 Destructor.
void setOrientation (Wt::Orientation orientation)
 Change the slider orientation.
Orientation orientation () const
 Returns the slider orientation.
void setTickInterval (int tickInterval)
 Change the tick interval.
int tickInterval () const
 Returns the tick interval.
void setTickPosition (WFlags< TickPosition > tickPosition)
 Set the tick position.
WFlags< TickPositiontickPosition () const
 Return the tick position.
void setValue (int value)
 Change the slider value.
int value () const
 Returns the current slider value.
void setMaximum (int maximum)
 Set the maximum value.
int maximum () const
 Returns the maximum value.
void setMinimum (int minimum)
 Set the minimum value.
int minimum () const
 Returns the minimum value.
void setRange (int minimum, int maximum)
 Set the value range.
Signal< int > & valueChanged ()
 Signal emitted when the user has changed the value of the slider.
virtual void resize (const WLength &width, const WLength &height)
 Resizes the widget.

Static Public Attributes

static const Wt::WFlags
< TickPosition
NoTicks = 0
 Do not render ticks.
static const Wt::WFlags
< TickPosition
TicksBothSides = TicksAbove | TicksBelow
 Render ticks on both sides.


Detailed Description

A horizontal or vertical slider control.

A slider allows the user to specify an integer value within a particular range using a visual slider.

The slider must be sized explicitly using WWidget::resize(). The default size is 150 x 50 pixels for a horizontal slider, and 50 x 150 pixels for a vertical slider.

Usage example:

 Wt::WSlider *scaleSlider = new Wt::WSlider(Wt::Horizontal);
 scaleSlider->setMinimum(0);
 scaleSlider->setMaximum(20);
 scaleSlider->setValue(10);
 scaleSlider->setTickInterval(5);
 scaleSlider->setTickPosition(Wt::WSlider::TicksBothSides);
 scaleSlider->resize(300, 50);
 scaleSlider->valueChanged().connect(SLOT(this, ThisClass::scaleShape));

WSlider-1.png

Horizontal slider with ticks on both sides.


Member Enumeration Documentation

Enumeration that specifies the location of ticks.

Enumerator:
TicksAbove  Render ticks above (horizontal slider).
TicksBelow  Render ticks below (horizontal slider).
TicksLeft  Render ticks on the left side (vertical slider).
TicksRight  Render ticks on the right side (vertical slider).


Constructor & Destructor Documentation

Wt::WSlider::WSlider ( WContainerWidget parent = 0  ) 

Create a default horizontal slider.

The slider shows no ticks, has a range from 0 to 99, and has tickInterval of 0 (defaulting to three ticks over the whole range).

The initial value is 0.

Wt::WSlider::WSlider ( Orientation  orientation,
WContainerWidget parent = 0 
)

Create a default slider of the given orientation.

The slider shows no ticks, has a range from 0 to 99, and has tickInterval of 0 (defaulting to three ticks over the whole range).

The initial value is 0.


Member Function Documentation

void Wt::WSlider::setOrientation ( Wt::Orientation  orientation  ) 

Change the slider orientation.

See also:
orientation()

Orientation Wt::WSlider::orientation (  )  const [inline]

Returns the slider orientation.

See also:
setOrientation()

void Wt::WSlider::setTickInterval ( int  tickInterval  ) 

Change the tick interval.

The tick interval specifies the interval for placing ticks along the slider. The interval is specified in value units (not pixel units). A value of 0 specifies an automatic tick interval, which defaults to 3 ticks spanning the whole range.

See also:
tickInterval(), setTickPosition()

int Wt::WSlider::tickInterval (  )  const [inline]

Returns the tick interval.

See also:
setTickInterval()

void Wt::WSlider::setTickPosition ( WFlags< TickPosition tickPosition  ) 

Set the tick position.

The tick position indicates if and where ticks are placed around the slider groove.

See also:
tickPosition(), setTickInterval()

WFlags<TickPosition> Wt::WSlider::tickPosition (  )  const [inline]

Return the tick position.

See also:
setTickPosition(), setTickInterval()

void Wt::WSlider::setValue ( int  value  ) 

Change the slider value.

The value is automatically trimmed to the valid range (minimum() to maximum()).

See also:
value()

int Wt::WSlider::value (  )  const [inline]

Returns the current slider value.

See also:
setValue()

void Wt::WSlider::setMaximum ( int  maximum  ) 

Set the maximum value.

The maximum value defines the upper limit of the valid range. The lower limit and current value are automatically adjusted to remain valid.

See also:
maximum(), setMinimum(), setRange()

int Wt::WSlider::maximum (  )  const [inline]

Returns the maximum value.

See also:
setMaximum(int)

void Wt::WSlider::setMinimum ( int  minimum  ) 

Set the minimum value.

The minimum value defines the lower limit of the valid range. The upper limit and current value are automatically adjusted to remain valid.

See also:
minimum(), setMaximum(), setRange()

int Wt::WSlider::minimum (  )  const [inline]

Returns the minimum value.

See also:
setMinimum(int)

void Wt::WSlider::setRange ( int  minimum,
int  maximum 
)

Set the value range.

See also:
setMinimum(), setMaximum()

Signal<int>& Wt::WSlider::valueChanged (  )  [inline]

Signal emitted when the user has changed the value of the slider.

The new value is passed as the argument.

void Wt::WSlider::resize ( const WLength width,
const WLength height 
) [virtual]

Resizes the widget.

Specify a new size for this widget, by specifying width and height. By default a widget has automatic width and height, see WLength::isAuto().

This applies to CSS-based layout.

See also:
width(), height()

Reimplemented from Wt::WCompositeWidget.


Generated on Tue Sep 1 17:51:17 2009 for Wt by doxygen 1.5.6