The Layout Library: MSlider

Derived from: public MView, public BSlider

Declared in: <MSlider.h>


Overview

MSlider is liblayout's version of BSlider. In addition to the features of a standard BSlider, it allows you to specify a "granularity" for the slider.


Constructor and Destructor


MSlider()

    MSlider(const char *label, int32 minval, int32 maxval,int32 granularity=1, BMessage *message=NULL, BHandler *target=NULL, thumb_style ts=B_BLOCK_THUMB)
Constructs an MSlider with the given settings.

minval and maxval are the minimum and maximum value the MSlider can represent

granularity is the granularity of the MSlider.

message and target determine the message that will be sent when the MSlider is invoked, and the handler it will be sent to.

is the thumb style, which is either B_BLOCK_THUMB or B_TRIANGLE_THUMB


~MSlider()

    virtual ~MSlider()
Destroys the MSlider

Member Functions


AllAttached()

    virtual void AllAttached()
Sets the target for the MSlider to the handler that was specified when it was constructed


SetGranularity()

    void SetGranularity(int32 granul)
Sets the granularity of the MSlider. The current value of the slider is rounded to the nearest multiple of the granularity if needed.
The granularity determines in what steps the value of a BSlider can be set. If you create an MSlider with a minimum value of 0, a maximum value of 100, and a granularity of 50, then the only possible values the MSlider can take are 0, 50 and 100.


SetValue()

    virtual void SetValue(int32 value)
Sets the value of the slider, taking into account the minimum, maximum and granularity.