예제 #1
0
    void Spinner::initialise(void)
    {
        Window::initialise();

        // create all the component widgets
        d_increaseButton = createIncreaseButton(getName() + "__auto_incbtn__");
        addChildWindow(d_increaseButton);
        d_decreaseButton = createDecreaseButton(getName() + "__auto_decbtn__");
        addChildWindow(d_decreaseButton);
        d_editbox = createEditbox(getName() + "__auto_editbox__");
        addChildWindow(d_editbox);

        // setup component controls
        d_increaseButton->setWantsMultiClickEvents(false);
        d_increaseButton->setMouseAutoRepeatEnabled(true);
        d_decreaseButton->setWantsMultiClickEvents(false);
        d_decreaseButton->setMouseAutoRepeatEnabled(true);

        // perform event subscriptions.
        d_increaseButton->subscribeEvent(Window::EventMouseButtonDown, Event::Subscriber(&Spinner::handleIncreaseButton, this));
        d_decreaseButton->subscribeEvent(Window::EventMouseButtonDown, Event::Subscriber(&Spinner::handleDecreaseButton, this));
        d_editbox->subscribeEvent(Window::EventTextChanged, Event::Subscriber(&Spinner::handleEditTextChange, this));

        // final initialisation
        setTextInputMode(Integer);
        setCurrentValue(0.0f);
        performChildWindowLayout();
    }
예제 #2
0
/*************************************************************************
	Initialises the Scrollbar object ready for use.
*************************************************************************/
void Scrollbar::initialise(void)
{
	// Set up thumb
	d_thumb = createThumb(getName() + "__auto_thumb__");
	addChildWindow(d_thumb);
	d_thumb->subscribeEvent(Thumb::EventThumbPositionChanged, Event::Subscriber(&CEGUI::Scrollbar::handleThumbMoved, this));
	d_thumb->subscribeEvent(Thumb::EventThumbTrackStarted, Event::Subscriber(&CEGUI::Scrollbar::handleThumbTrackStarted, this));
	d_thumb->subscribeEvent(Thumb::EventThumbTrackEnded, Event::Subscriber(&CEGUI::Scrollbar::handleThumbTrackEnded, this));

	// set up Increase button
	d_increase = createIncreaseButton(getName() + "__auto_incbtn__");
	addChildWindow(d_increase);
	d_increase->subscribeEvent(PushButton::EventMouseButtonDown, Event::Subscriber(&CEGUI::Scrollbar::handleIncreaseClicked, this));

	// set up Decrease button
	d_decrease = createDecreaseButton(getName() + "__auto_decbtn__");
	addChildWindow(d_decrease);
	d_decrease->subscribeEvent(PushButton::EventMouseButtonDown, Event::Subscriber(&CEGUI::Scrollbar::handleDecreaseClicked, this));

	// do initial layout
	performChildWindowLayout();
}