void ScrollablePanel::removeAllWidgets()
    {
        Panel::removeAllWidgets();

        if (m_contentSize == sf::Vector2f{0, 0})
            updateScrollbars();
    }
Esempio n. 2
0
void ScrollView::resizeContents(int w, int h)
{
    IntSize newContentsSize(w, h);
    if (m_data->m_contentsSize != newContentsSize) {
        m_data->m_contentsSize = newContentsSize;
        updateScrollbars(m_data->m_scrollOffset);
    }
}
Esempio n. 3
0
void ScrollView::setScrollbarsMode(ScrollbarMode newMode)
{
    if (m_data->m_hScrollbarMode != newMode ||
        m_data->m_vScrollbarMode != newMode) {
        m_data->m_hScrollbarMode = m_data->m_vScrollbarMode = newMode;
        updateScrollbars(m_data->m_scrollOffset);
    }
}
    void ScrollablePanel::setContentSize(sf::Vector2f size)
    {
        m_contentSize = size;

        if (m_contentSize == sf::Vector2f{0, 0})
            recalculateMostBottomRightPosition();

        updateScrollbars();
    }
Esempio n. 5
0
void AXScrollView::updateChildrenIfNecessary()
{
    if (m_childrenDirty)
        clearChildren();

    if (!m_haveChildren)
        addChildren();

    updateScrollbars();
}
Esempio n. 6
0
void AXScrollView::addChildren()
{
    ASSERT(!m_haveChildren);
    m_haveChildren = true;

    AXObject* webArea = webAreaObject();
    if (webArea && !webArea->accessibilityIsIgnored())
        m_children.append(webArea);

    updateScrollbars();
}
Esempio n. 7
0
void ScrollView::scrollBy(int dx, int dy)
{
    IntSize scrollOffset = m_data->m_scrollOffset;
    IntSize newScrollOffset = scrollOffset + IntSize(dx, dy).shrunkTo(maximumScroll());
    newScrollOffset.clampNegativeToZero();

    if (newScrollOffset == scrollOffset)
        return;

    updateScrollbars(newScrollOffset);
}
Esempio n. 8
0
AXObject* AXScrollView::scrollBar(AccessibilityOrientation orientation)
{
    updateScrollbars();

    switch (orientation) {
    case AccessibilityOrientationVertical:
        return m_verticalScrollbar ? m_verticalScrollbar.get() : 0;
    case AccessibilityOrientationHorizontal:
        return m_horizontalScrollbar ? m_horizontalScrollbar.get() : 0;
    }

    return 0;
}
void SpaceWidgetScrollAbstract::onScrollCacheSpaceChanged(const CacheSpace* cache, ChangeReason reason)
{
    Q_UNUSED(cache);
    Q_ASSERT(cache == m_scrollableCacheSpace.data());

    if (reason & ChangeReasonSpaceStructure)
    {
        invalidateCacheItemsLayout();
        updateScrollbars();
        // request to recalculate layout
        updateGeometry();
    }
}
Esempio n. 10
0
void ByteViewText::setMonospaceFont(const QFont &mono_font)
{
    mono_font_ = mono_font;

    const QFontMetricsF fm(mono_font);
    font_width_  = fm.width('M');
    line_spacing_ = fm.lineSpacing() + 0.5;
    one_em_ = fm.height();
    margin_ = fm.height() / 2;

    setFont(mono_font);

    updateScrollbars();
    viewport()->update();
}
Esempio n. 11
0
void ScrollView::setFrameGeometry(const IntRect& newGeometry)
{
    IntRect oldGeometry = frameGeometry();
    Widget::setFrameGeometry(newGeometry);

    if (newGeometry == oldGeometry)
        return;

    if (newGeometry.width() != oldGeometry.width() || newGeometry.height() != oldGeometry.height()) {
        updateScrollbars(m_data->m_scrollOffset);
        static_cast<FrameView*>(this)->setNeedsLayout();
    }

    geometryChanged();
}
    void ScrollablePanel::add(const tgui::Widget::Ptr& widget, const sf::String& widgetName)
    {
        Panel::add(widget, widgetName);

        const sf::Vector2f bottomRight = widget->getPosition() + widget->getFullSize();
        if (m_contentSize == sf::Vector2f{0, 0})
        {
            if (bottomRight.x > m_mostBottomRightPosition.x)
                m_mostBottomRightPosition.x = bottomRight.x;
            if (bottomRight.y > m_mostBottomRightPosition.y)
                m_mostBottomRightPosition.y = bottomRight.y;

            updateScrollbars();
        }
    }
    bool ScrollablePanel::remove(const Widget::Ptr& widget)
    {
        const sf::Vector2f bottomRight = widget->getPosition() + widget->getFullSize();

        const bool ret = Panel::remove(widget);

        if (m_contentSize == sf::Vector2f{0, 0})
        {
            if ((bottomRight.x == m_mostBottomRightPosition.x) || (bottomRight.y == m_mostBottomRightPosition.y))
            {
                recalculateMostBottomRightPosition();
                updateScrollbars();
            }
        }

        return ret;
    }
Esempio n. 14
0
void ByteViewText::setMonospaceFont(const QFont &mono_font)
{
    mono_font_ = QFont(mono_font);
    mono_font_.setStyleStrategy(QFont::ForceIntegerMetrics);

    const QFontMetricsF fm(mono_font_);
    font_width_  = fm.width('M');

    setFont(mono_font_);
    viewport()->setFont(mono_font_);
    layout_->setFont(mono_font_);

    // We should probably use ProtoTree::rowHeight.
    line_height_ = fontMetrics().height();

    updateScrollbars();
    viewport()->update();
}
Esempio n. 15
0
//------------------------------------------------------------------------------
// Name: paintEvent
//------------------------------------------------------------------------------
void NandView::paintEvent(QPaintEvent *) {
	QPainter painter(viewport());
	int font_width_ = 12;
	int chars_per_row = 8;
	int origin_ = 0;
	painter.translate(-horizontalScrollBar()->value() * font_width_, 0);

	// current actual offset (in bytes)
	quint64 offset = (quint64)verticalScrollBar()->value() * chars_per_row;

	if(origin_ != 0) {
			if(offset > 0) {
					offset += origin_;
					offset -= chars_per_row;
			} else {
					origin_ = 0;
					updateScrollbars();
			}
	}
}
bool SpaceWidgetScrollAbstract::viewportEvent(QEvent* event)
{
    bool result = QAbstractScrollArea::viewportEvent(event);

    switch (event->type())
    {
    case QEvent::Paint:
        validateCacheItemsLayout();
        break;

    case QEvent::Resize:
        updateScrollbars();
        invalidateCacheItemsLayout();
        break;

    default:
        ;
    }

    result |= processOwnerEvent(event);
    return result;
}
void ScrollView::setScrollbarModes(ScrollbarMode horizontalMode, ScrollbarMode verticalMode, bool horizontalLock, bool verticalLock)
{
    // FIXME: Restructure the ScrollView abstraction so that we do not have to
    // copy this verbatim from ScrollView.cpp. Until then, we should make sure this
    // is kept in sync.
    bool needsUpdate = false;

    if (horizontalMode != horizontalScrollbarMode() && !m_horizontalScrollbarLock) {
        m_horizontalScrollbarMode = horizontalMode;
        needsUpdate = true;
    }

    if (verticalMode != verticalScrollbarMode() && !m_verticalScrollbarLock) {
        m_verticalScrollbarMode = verticalMode;
        needsUpdate = true;
    }

    if (horizontalLock)
        setHorizontalScrollbarLock();

    if (verticalLock)
        setVerticalScrollbarLock();

    if (needsUpdate)
        updateScrollbars(scrollOffset());

    // We don't need to report policy changes on ScrollView's unless this
    // one has an adjustment attached and it is a main frame.
    if (!m_horizontalAdjustment || parent() || !isFrameView())
        return;

    // For frames that do have adjustments attached, we want to report
    // policy changes, so that they may be applied to the widget to
    // which the WebView's container (e.g. GtkScrolledWindow).
    if (hostWindow())
        hostWindow()->scrollbarsModeDidChange();
}
Esempio n. 18
0
void ScrollView::setScrollbarModes(ScrollbarMode horizontalMode, ScrollbarMode verticalMode, bool, bool)
{
    if (horizontalMode == m_horizontalScrollbarMode && verticalMode == m_verticalScrollbarMode)
        return;

    m_horizontalScrollbarMode = horizontalMode;
    m_verticalScrollbarMode = verticalMode;

    // We don't really care about reporting policy changes on frames
    // that have no adjustments attached to them.
    if (!m_horizontalAdjustment) {
        updateScrollbars(scrollOffset());
        return;
    }

    if (!isFrameView())
        return;

    // For frames that do have adjustments attached, we want to report
    // policy changes, so that they may be applied to the widget to
    // which the WebView has been added, for instance.
    if (hostWindow())
        hostWindow()->scrollbarsModeDidChange();
}
Esempio n. 19
0
void ByteViewText::resizeEvent(QResizeEvent *)
{
    updateScrollbars();
}
Esempio n. 20
0
//------------------------------------------------------------------------------
// Name: resizeEvent
//------------------------------------------------------------------------------
void NandView::resizeEvent(QResizeEvent *) {
		updateScrollbars();
}
 void ScrollablePanel::setSize(const Layout2d& size)
 {
     Panel::setSize(size);
     updateScrollbars();
 }