Source Code (Use browser search to find items of interest.)
Class Index
kdvi'ScrollBox (./kdegraphics/kdvi/scrbox.h:15)
class ScrollBox: public QFrame
{
Q_OBJECT
public:
ScrollBox( QWidget * parent = 0, const char * name = 0 );
public slots:
void setPageSize( QSize );
void setViewSize( QSize );
void setViewPos( QPoint );
signals:
void valueChanged( QPoint );
void button2Pressed();
void button3Pressed();
protected:
void mousePressEvent ( QMouseEvent *);
void mouseMoveEvent ( QMouseEvent *);
void drawContents ( QPainter *);
private:
QPoint viewpos, mouse;
QSize pagesize;
QSize viewsize;
};
kdvi'ScrollBox::ScrollBox() (./kdegraphics/kdvi/scrbox.cpp:17)
ScrollBox::ScrollBox( QWidget * parent , const char * name )
: QFrame( parent, name )
{
setFrameStyle( Panel | Sunken );
}
kdvi'ScrollBox::mousePressEvent() (./kdegraphics/kdvi/scrbox.cpp:23)
void ScrollBox::mousePressEvent ( QMouseEvent *e )
{
mouse = e->pos();
if ( e->button() == RightButton )
emit button3Pressed();
if ( e->button() == MidButton )
emit button2Pressed();
}
kdvi'ScrollBox::mouseMoveEvent() (./kdegraphics/kdvi/scrbox.cpp:32)
void ScrollBox::mouseMoveEvent ( QMouseEvent *e )
{
if (e->state() != LeftButton)
return;
int dx = ( e->pos().x() - mouse.x() ) *
pagesize.width() /
width();
int dy = ( e->pos().y() - mouse.y() ) *
pagesize.height() /
height();
// Notify the word what the view position has changed
// The word in turn will notify as that view position has changed
// Even if coordinates are out of range JScrollView hendle
// this properly
emit valueChanged( viewpos + QPoint( dx, dy ) );
mouse = e->pos();
}
kdvi'ScrollBox::drawContents() (./kdegraphics/kdvi/scrbox.cpp:52)
void ScrollBox::drawContents ( QPainter *p )
{
if (pagesize.isNull())
return;
QRect c( contentsRect() );
int len = pagesize.width();
int x = c.x() + c.width() * viewpos.x() / len;
int w = c.width() * viewsize.width() / len ;
if ( w > c.width() ) w = c.width();
len = pagesize.height();
int y = c.y() + c.height() * viewpos.y() / len;
int h = c.height() * viewsize.height() / len;
if ( h > c.height() ) h = c.height();
qDrawShadePanel( p, x, y, w, h, colorGroup(), FALSE, 1, 0);
}
kdvi'ScrollBox::setPageSize() (./kdegraphics/kdvi/scrbox.cpp:72)
void ScrollBox::setPageSize( QSize s )
{
pagesize = s;
repaint();
}
kdvi'ScrollBox::setViewSize() (./kdegraphics/kdvi/scrbox.cpp:78)
void ScrollBox::setViewSize( QSize s )
{
viewsize = s;
repaint();
}
kdvi'ScrollBox::setViewPos() (./kdegraphics/kdvi/scrbox.cpp:84)
void ScrollBox::setViewPos( QPoint pos )
{
viewpos = pos;
repaint();
}