//----------------------------------------------------------------------------// void ScrollablePane::configureScrollbars(void) { // controls should all be valid by this stage Scrollbar* const vertScrollbar = getVertScrollbar(); Scrollbar* const horzScrollbar = getHorzScrollbar(); const bool horzScrollBarWasVisible = horzScrollbar->isVisible(); const bool vertScrollBarWasVisible = vertScrollbar->isVisible(); // enable required scrollbars vertScrollbar->setVisible(isVertScrollbarNeeded()); horzScrollbar->setVisible(isHorzScrollbarNeeded()); // Check if the addition of the horizontal scrollbar means we // now also need the vertical bar. if (horzScrollbar->isVisible()) vertScrollbar->setVisible(isVertScrollbarNeeded()); if (horzScrollBarWasVisible != horzScrollbar->isVisible() || vertScrollBarWasVisible != vertScrollbar->isVisible()) { ElementEventArgs args(this); onSized(args); } performChildWindowLayout(); // get viewable area const Rectf viewableArea(getViewableArea()); // set up vertical scroll bar values vertScrollbar->setDocumentSize(fabsf(d_contentRect.getHeight())); vertScrollbar->setPageSize(viewableArea.getHeight()); vertScrollbar->setStepSize(ceguimax(1.0f, viewableArea.getHeight() * d_vertStep)); vertScrollbar->setOverlapSize(ceguimax(1.0f, viewableArea.getHeight() * d_vertOverlap)); vertScrollbar->setScrollPosition(vertScrollbar->getScrollPosition()); // set up horizontal scroll bar values horzScrollbar->setDocumentSize(fabsf(d_contentRect.getWidth())); horzScrollbar->setPageSize(viewableArea.getWidth()); horzScrollbar->setStepSize(ceguimax(1.0f, viewableArea.getWidth() * d_horzStep)); horzScrollbar->setOverlapSize(ceguimax(1.0f, viewableArea.getWidth() * d_horzOverlap)); horzScrollbar->setScrollPosition(horzScrollbar->getScrollPosition()); }
void ScrollablePane::configureScrollbars(void) { // controls should all be valid by this stage assert(d_container != 0); assert(d_vertScrollbar != 0); assert(d_horzScrollbar != 0); // enable required scrollbars d_vertScrollbar->setVisible(isVertScrollbarNeeded()); d_horzScrollbar->setVisible(isHorzScrollbarNeeded()); // Check if the addition of the horizontal scrollbar means we // now also need the vertical bar. if (d_horzScrollbar->isVisible()) { d_vertScrollbar->setVisible(isVertScrollbarNeeded()); } performChildWindowLayout(); // get viewable area Rect viewableArea(getViewableArea()); if( d_vertScrollbar ) { // set up vertical scroll bar values d_vertScrollbar->setDocumentSize(fabsf(d_contentRect.getHeight())); d_vertScrollbar->setPageSize(viewableArea.getHeight()); d_vertScrollbar->setStepSize(ceguimax(1.0f, viewableArea.getHeight() * d_vertStep)); d_vertScrollbar->setOverlapSize(ceguimax(1.0f, viewableArea.getHeight() * d_vertOverlap)); d_vertScrollbar->setScrollPosition(d_vertScrollbar->getScrollPosition()); } if( d_horzScrollbar ) { // set up horizontal scroll bar values d_horzScrollbar->setDocumentSize(fabsf(d_contentRect.getWidth())); d_horzScrollbar->setPageSize(viewableArea.getWidth()); d_horzScrollbar->setStepSize(ceguimax(1.0f, viewableArea.getWidth() * d_horzStep)); d_horzScrollbar->setOverlapSize(ceguimax(1.0f, viewableArea.getWidth() * d_horzOverlap)); d_horzScrollbar->setScrollPosition(d_horzScrollbar->getScrollPosition()); } }