Esempio n. 1
0
//----------------------------------------------------------------------------//
bool ScrollablePane::handleContentAreaChange(const EventArgs&)
{
    // get updated extents of the content
    const Rectf contentArea(getScrolledContainer()->getContentArea());
    
    // calculate any change on the top and left edges.
    const float xChange = contentArea.d_min.d_x - d_contentRect.d_min.d_x;
    const float yChange = contentArea.d_min.d_y - d_contentRect.d_min.d_y;
    
    // store new content extents information
    d_contentRect = contentArea;
    
    configureScrollbars();
    
    // update scrollbar positions (which causes container pane to be moved as needed).
    Scrollbar* const horzScrollbar = getHorzScrollbar();
    horzScrollbar->setScrollPosition(horzScrollbar->getScrollPosition() - xChange);
    Scrollbar* const vertScrollbar = getVertScrollbar();
    vertScrollbar->setScrollPosition(vertScrollbar->getScrollPosition() - yChange);
    
    // this call may already have been made if the scroll positions changed.  The call
    // is required here for cases where the top/left 'bias' has changed; in which
    // case the scroll position notification may or may not have been fired.
    if (xChange || yChange)
        updateContainerPosition();
    
    // fire event
    WindowEventArgs args(this);
    onContentPaneChanged(args);
    
    return true;
}
Esempio n. 2
0
    void ScrollablePane::onSized(WindowEventArgs& e)
    {
        Window::onSized(e);
        configureScrollbars();
        updateContainerPosition();

        e.handled = true;
    }
Esempio n. 3
0
//----------------------------------------------------------------------------//
void ScrollablePane::onSized(ElementEventArgs& e)
{
    configureScrollbars();
    updateContainerPosition();
    Window::onSized(e);
    
    ++e.handled;
}
Esempio n. 4
0
    bool ScrollablePane::handleContentAreaChange(const EventArgs& e)
    {
        assert(d_container != 0);
        assert(d_horzScrollbar != 0);
        assert(d_vertScrollbar != 0);

        // get updated extents of the content
        Rect contentArea(d_container->getContentArea());

        // calculate any change on the top and left edges.
        float xChange = contentArea.d_left - d_contentRect.d_left;
        float yChange = contentArea.d_top - d_contentRect.d_top;

        // store new content extents information
        d_contentRect = contentArea;

        configureScrollbars();

        // update scrollbar positions (which causes container pane to be moved as needed).
        d_horzScrollbar->setScrollPosition(d_horzScrollbar->getScrollPosition() - xChange);
        d_vertScrollbar->setScrollPosition(d_vertScrollbar->getScrollPosition() - yChange);

        // this call may already have been made if the scroll positions changed.  The call
        // is required here for cases where the top/left 'bias' has changed; in which
        // case the scroll position notification may or may not have been fired.
        if (xChange || yChange)
        {
            updateContainerPosition();
        }
    
        // fire event
        WindowEventArgs args(this);
        onContentPaneChanged(args);

        return true;
    }
Esempio n. 5
0
 void ScrollablePane::onContentPaneScrolled(WindowEventArgs& e)
 {
     updateContainerPosition();
     fireEvent(EventContentPaneScrolled, e, EventNamespace);
 }