// Constructor
//------------------------------------------------------------------------------
CPUTSlider::CPUTSlider(const cString ControlText, CPUTControlID id, CPUTFont *pFont, float scale):    mpControlText(NULL),
    mpMirrorBufferActive(NULL),
    mpMirrorBufferPressed(NULL),
    mpMirrorBufferDisabled(NULL),
    mSliderNubTickLocation(0),
    mSliderNubLocation(0.0f),
    mbMouseInside(false),
    mbStartedClickInside(false),
    mbDrawTicks(true),
    mpFont(pFont),
    mScale(scale)
{
    // initialize the state variables
    InitialStateSet();

    // save the control ID for callbacks
    mcontrolID = id;

    // set as enabled
    CPUTControl::SetEnable(true);

    // default to an active control
    mControlState = CPUT_CONTROL_ACTIVE;

    // save the control ID
    mcontrolID = id;

    // set the string to display with the slider
    mpControlText = new CPUTText(mpFont);
    mpControlText->SetText(ControlText);
   
    // set default scale/start/end values
    SetScale(mSliderStartValue, mSliderEndValue, mSliderNumberOfSteps);
    RecalculateSizes();
}
Exemplo n.º 2
0
void ctrlScrollBar::Resize(unsigned short width, unsigned short height)
{
    Window::Resize(width, height);

    // Up button
    GetCtrl<ctrlButton>(0)->Resize(width, button_height);
    // Down button
    ctrlButton* downButton = GetCtrl<ctrlButton>(1);
    downButton->Resize(width, button_height);

    if(height >= button_height)
    {
        downButton->SetVisible(true);
        downButton->Move(0, height - button_height);
    }
    else
        downButton->SetVisible(false);

    RecalculateSizes();
}
Exemplo n.º 3
0
/**
 *  setzt die Seiten-Höhe.
 */
void ctrlScrollBar::SetPageSize(unsigned short pagesize)
{
    this->pagesize = pagesize;
    RecalculateSizes();
}
Exemplo n.º 4
0
/**
 *  setzt die Scroll-Höhe.
 */
void ctrlScrollBar::SetRange(unsigned short scroll_range)
{
    this->scroll_range = scroll_range;
    RecalculateSizes();
}