Derived from: public MView, public BControl
Declared in: <PropGadget.h>
A PropGadget implements a two-dimensional slider. Because it is two-dimensional, it can be used either as a horizontal slider, a vertical slider, or both at the same time.
PropGadget(float xprop,float xval,float yprop,float yval, BBitmap *knobimage=NULL, void (*callback)(PropGadget*,void*,float,float)=NULL, void *arg=NULL, long extraspacing=0)
Initializes the PropGadget.
xprop and yprop are the relative size of the knob in the horizontal and vertical direction: if xprop is 0.5 for example,
the slider-knob will occupy half the slider's width. To make a one-dimensional slider, set the proportion for the other dimension to zero.
Setting xprop to 0, for example, will create a vertical slider. xprop and yprop are also the amount that the slider
is adjusted when you click next to the knob.
xval and yval are the initial values of the slider.
knobimage is the bitmap that will be used to draw the knob. When a bitmap is specified, xprop and yprop no
longer determine the size of the knob. In this case, the size of the knob is fixed, and equal to the size of the bitmap. The PropGadget
does not copy the bitmap, it is your responsibility to allocate and delete it.
The callback function is called whenever the user manipulates the slider. The function receives a pointer to the PropGadget
as its first argument, it receives the arg pointer as its second argument, and the current x- and y-values as its third and
fourth arguments.
extraspacing is the amount that the actual slider is inset from its BView's frame. Use this if you draw your own background,
and need to have some space available to draw a border around the slider.
virtual ~PropGadget(void)
Cleans up after the PropGadget.
virtual void DrawContainer(BRect knob)This function draws the background of the slider. The size and position of the knob is passed in as a BRect. When this function is called, the clipping region has already been set to include only the area that needs updating. The default version of this function draws a background in the current FILL_COLOR.
virtual void DrawKnob(BRect knob)This function draws the slider-knob. The size and position of the knob is passed in as a BRect. The default version of this function draws the bitmap given in the constructor, or a black rectangle if no bitmap was specified.
Copyright © 1997 Marco Nelissen (marcone@xs4all.nl) All rights reserved.
Be, BeOS, BeBox, BeWare, GeekPort, the Be logo, the BeOS logo, roColour, Beatware and Beatware painter are trademarks or registered trademarks of their respective owners.