Ejemplo n.º 1
0
static void adjustmentChanged(GtkAdjustment* adjustment, gpointer _that)
{
    ScrollView* that = reinterpret_cast<ScrollView*>(_that);

    // Figure out if we really moved.
    IntSize newOffset = that->scrollOffset();
    if (adjustment == that->m_horizontalAdjustment)
        newOffset.setWidth(static_cast<int>(gtk_adjustment_get_value(adjustment)));
    else if (adjustment == that->m_verticalAdjustment)
        newOffset.setHeight(static_cast<int>(gtk_adjustment_get_value(adjustment)));

    IntSize scrollDelta = newOffset - that->scrollOffset();
    if (scrollDelta == IntSize())
        return;
    that->setScrollOffset(newOffset);

    if (that->scrollbarsSuppressed())
        return;

    that->scrollContents(scrollDelta);
}