OSDN Git Service

remove unused code.
[kita/kita.git] / kita / src / htmlpart.h
1 /***************************************************************************
2 *   Copyright (C) 2004 by Kita Developers                                 *
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 #ifndef KITAHTMLPART_H
12 #define KITAHTMLPART_H
13
14 #include <khtml_part.h>
15 #include <qframe.h>
16 #include <qevent.h>
17
18 /* mode */
19 enum {
20     /* on main window */
21     HTMLPART_MODE_MAINPART,
22
23     /* on popup       */
24     HTMLPART_MODE_POPUP
25 };
26
27 /* ID of user defined event */
28 #define EVENT_GotoAnchor ( QEvent::User + 100 )
29
30 class KitaDomTree;
31 class KURL;
32
33 namespace Kita
34 {
35     class ResPopup;
36 }
37
38 namespace DOM
39 {
40     class Node;
41 }
42
43
44 /*-------------------------------------------------------------*/
45
46 class KitaHTMLPart : public KHTMLPart
47 {
48     Q_OBJECT
49
50     KitaDomTree* m_domtree;
51     Kita::ResPopup* m_popup;
52
53     /* basic information */
54     int m_mode;
55     KURL m_datURL;
56     bool m_updatedKokoyon;
57
58
59     /* cache */
60     bool m_firstReceive;
61     int m_centerNum;
62
63     /* goto anchor */
64     QStringList m_anchorStack;
65     int m_jumpNumAfterLoading; /* see also slotFinishLoad() */
66
67     /* mouse event */
68     bool m_pushctrl;
69     bool m_pushmidbt;
70     bool m_pushrightbt;
71
72     /* search */
73     DOM::Node m_findNode;
74     int m_findPos;
75     int m_find_y;
76
77     /* res popup */
78     bool m_multiPopup;
79
80 public:
81
82     KitaHTMLPart( QWidget* parent, const char* name = 0 );
83     ~KitaHTMLPart();
84     bool setup( int mode , const KURL& url );
85
86     /* rendering */
87     void showResponses( int startnum, int endnum );
88     void parseResponses( int startnum, int endnum );
89     void showAll();
90     void updateScreen( bool showHeaderEtc, bool clock );
91     void setInnerHTML( const QString& innerHTML );
92
93     /* cache */
94     bool load( int centerNum );
95     bool reload( int jumpNum );
96
97     /* goto anchor */
98     bool gotoAnchor( const QString& anc, bool pushPosition );
99
100     /* search */
101     bool findText( const QString &query, bool reverse );
102
103     /* popup */
104     bool isPopupVisible();
105
106 public slots:
107
108     /* rendering */
109     void slotSetFaceOfHTMLPart();
110
111     /* cache */
112     void slotReceiveData();
113     void slotFinishLoad();
114
115     /* goto anchor */
116     void slotGotoKokoyon();
117     void slotGobackAnchor();
118
119     /* Tugi100, Mae100 etc.  */
120     void slotClickGotoFooter();
121
122     /* res popup */
123     void slotDeletePopup();
124     void slotShowResPopup( QPoint point, int refNum, int refNum2 );
125
126 private:
127
128     void clearPart();
129     void redrawHTMLPart( const KURL& datURL, bool force );
130
131     /* setup */
132     void connectSignals();
133     void createHTMLDocument();
134
135     /* goto anchor */
136     void pushCurrentPosition();
137     QString getCurrentIDofNode();
138
139     /* popup menu */
140     void showPopupMenu( const KURL& kurl );
141
142     /* click */
143     void clickAnchor( const KURL& urlin );
144     void showWritePopupMenu( const QString& refstr );
145     void showIDPopup( const QString& refstr );
146     void showBePopupMenu( const QString& refstr );
147
148     /* search */
149     void findTextInit();
150
151     /* res popup */
152     void showPopup( const KURL& url, const QString& innerHTML );
153     void showPopupCore( const KURL& url, const QString& innerHTML, QPoint point );
154     bool startMultiPopup();
155     bool isMultiPopupMode();
156     void hidePopup();
157     bool isUnderMouse( int mrgwd, int mrght );
158     bool showSelectedDigitPopup();
159
160 protected:
161
162     /* user event */
163     virtual void customEvent( QCustomEvent * e );
164
165     /* mouse event */
166     virtual void khtmlMousePressEvent( khtml::MousePressEvent* e );
167
168
169 private slots:
170
171     /* click */
172     void slotOpenURLRequest( const KURL&, const KParts::URLArgs& );
173
174     /* res popup */
175     void slotLeave();
176     void slotVSliderReleased();
177     void slotHSliderReleased();
178     void slotHideChildPopup();
179     void slotOnURL( const QString& url );
180
181
182 signals:
183     void mousePressed(); /* to KitaThreadView */
184
185     /* cache */
186     void receiveData();
187     void finishReload();
188
189     /* res popup */
190     void hideChildPopup();
191 };
192
193
194
195 /*---------------------------------------------------*/
196 /*---------------------------------------------------*/
197 /*---------------------------------------------------*/
198
199
200
201
202 /* user defined events */
203
204 class GotoAnchorEvent : public QCustomEvent
205 {
206     QString m_anc;
207
208 public:
209
210     GotoAnchorEvent( const QString& anc )
211             : QCustomEvent( EVENT_GotoAnchor ), m_anc( anc ) {};
212
213     const QString& getAnc() const { return m_anc; }
214 };
215
216
217 #endif