OSDN Git Service

Rename boardmanager.cpp and boardmanager.h
[kita/kita.git] / kita / src / kitaui / htmlview.cpp
1 /***************************************************************************
2  *   Copyright (C) 2003 by Hideki Ikemoto                                  *
3  *   ikemo@users.sourceforge.jp                                            *
4  *                                                                         *
5  *   This program is free software; you can redistribute it and/or modify  *
6  *   it under the terms of the GNU General Public License as published by  *
7  *   the Free Software Foundation; either version 2 of the License, or     *
8  *   (at your option) any later version.                                   *
9  ***************************************************************************/
10
11 #include "htmlview.h"
12
13 #include <khtml_part.h>
14
15 using namespace Kita;
16
17 HTMLView::HTMLView(KHTMLPart* part, QWidget *parent) : KHTMLView(part, parent)
18 {}
19
20 HTMLView::~HTMLView()
21 {}
22
23 void HTMLView::leaveEvent(QEvent*)
24 {
25     emit leave();
26 }
27
28 /* protected */
29 void HTMLView::keyPressEvent(QKeyEvent* e)
30 {
31     if (e->key() == Qt::Key_Space || e->key() == Qt::Key_PageDown
32             || e->key() == Qt::Key_Down || e->key() == Qt::Key_End) {
33         if (emitPushDown()) return ;
34     }
35
36     KHTMLView::keyPressEvent(e);
37 }
38
39 /* protected */
40 void HTMLView::wheelEvent(QWheelEvent * e)
41 {
42     if (e->delta() < 0) { /* scroll down */
43         if (emitPushDown()) return ;
44     }
45
46     KHTMLView::wheelEvent(e);
47 }
48
49 /* private */
50 bool HTMLView::emitPushDown()
51 {
52     int y = contentsY();
53
54     if (y >= contentsHeight() - visibleHeight()) {
55         emit pushDown(); /* to HTMLPart in order to call slotClickTugi100 */
56         return true;
57     }
58
59     return false;
60 }