Commit bc3029a7 authored by hausmann@webkit.org's avatar hausmann@webkit.org

Michael Brasser <michael.brasser@trolltech.com>

Added simple scrolling API to QWebFrame.

The intent is that it works similar to QAbstractScrollArea.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@31901 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent de2cc015
......@@ -477,6 +477,64 @@ void QWebFrame::setHorizontalScrollBarPolicy(Qt::ScrollBarPolicy policy)
d->frame->view()->setHScrollbarMode((ScrollbarMode)policy);
}
/*!
Sets the current value for the scrollbar with orientation \a orientation.
The scrollbar forces the value to be within the legal range: minimum <= value <= maximum.
Changing the value also updates the thumb position.
*/
void QWebFrame::setScrollBarValue(Qt::Orientation orientation, int value)
{
PlatformScrollbar *sb;
sb = (orientation == Qt::Horizontal) ? d->horizontalScrollBar() : d->verticalScrollBar();
if (sb) {
if (value < 0)
value = 0;
else if (value > scrollBarMaximum(orientation))
value = scrollBarMaximum(orientation);
sb->setValue(value);
}
}
/*!
Returns the current value for the scrollbar with orientation \a orientation, or 0
if no scrollbar is found for \a orientation.
*/
int QWebFrame::scrollBarValue(Qt::Orientation orientation) const
{
PlatformScrollbar *sb;
sb = (orientation == Qt::Horizontal) ? d->horizontalScrollBar() : d->verticalScrollBar();
if (sb) {
return sb->value();
}
return 0;
}
/*!
Returns the maximum value for the scrollbar with orientation \a orientation, or 0
if no scrollbar is found for \a orientation.
*/
int QWebFrame::scrollBarMaximum(Qt::Orientation orientation) const
{
PlatformScrollbar *sb;
sb = (orientation == Qt::Horizontal) ? d->horizontalScrollBar() : d->verticalScrollBar();
if (sb) {
return (orientation == Qt::Horizontal) ? sb->width() : sb->height();
}
return 0;
}
/*!
Returns the minimum value for the scrollbar with orientation \a orientation.
The minimum value is always 0.
*/
int QWebFrame::scrollBarMinimum(Qt::Orientation orientation) const
{
return 0;
}
/*!
Render the frame into \a painter clipping to \a clip.
*/
......
......@@ -97,6 +97,11 @@ public:
Qt::ScrollBarPolicy horizontalScrollBarPolicy() const;
void setHorizontalScrollBarPolicy(Qt::ScrollBarPolicy);
void setScrollBarValue(Qt::Orientation orientation, int value);
int scrollBarValue(Qt::Orientation orientation) const;
int scrollBarMinimum(Qt::Orientation orientation) const;
int scrollBarMaximum(Qt::Orientation orientation) const;
void render(QPainter *painter, const QRegion &clip);
void layout();
......
2008-04-15 Michael Brasser <michael.brasser@trolltech.com>
Reviewed by Simon.
Added simple scrolling API to QWebFrame.
The intent is that it works similar to QAbstractScrollArea.
* Api/qwebframe.cpp:
(QWebFrame::setScrollBarValue):
(QWebFrame::scrollBarValue):
(QWebFrame::scrollBarMaximum):
(QWebFrame::scrollBarMinimum):
* Api/qwebframe.h:
2008-04-15 Olivier Goffart <ogoffart@trolltech.com>
Reviewed by Holger.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment