OSDN Git Service

refactoring.
[kita/kita.git] / kita / src / write / previewpart.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 PREVIEWPART_H
12 #define PREVIEWPART_H
13
14 #include <khtml_part.h>
15
16 /* ID of user defined event */
17 #define EVENT_GotoAnchor ( QEvent::User + 100 )
18
19 namespace Kita
20 {
21     class ResPopup;
22 }
23
24 class KitaPreviewPart : public KHTMLPart
25 {
26     Q_OBJECT
27
28     Kita::ResPopup* m_popup;
29
30     /* basic information */
31     KURL m_datURL;
32
33     /* mouse event */
34     bool m_isPushedRightButton;
35
36     /* res popup */
37     bool m_multiPopup;
38     bool m_kitaIsActive;
39
40 public:
41
42     KitaPreviewPart( QWidget* parent, const char* name = 0 );
43     ~KitaPreviewPart();
44     bool setup( const KURL& url );
45
46     /* rendering */
47     void setInnerHTML( const QString& innerHTML );
48
49 public slots:
50
51     /* rendering */
52     void slotSetFaceOfHTMLPart();
53     void slotSetStyleSheetOfHTMLPart();
54
55     /* res popup */
56     void slotDeletePopup();
57
58 private:
59
60     void clearPart();
61
62     /* setup */
63     void connectSignals();
64     void createHTMLDocument();
65
66     /* click */
67     void clickAnchor( const KURL& urlin );
68
69     /* res popup */
70     void showPopup( const KURL& url, const QString& innerHTML );
71     bool startMultiPopup();
72     bool isMultiPopupMode();
73     void hidePopup();
74
75 protected:
76
77     /* user event */
78     virtual void customEvent( QCustomEvent * e );
79
80     /* mouse event */
81     virtual void khtmlMousePressEvent( khtml::MousePressEvent* e );
82
83 private slots:
84
85     /* res popup */
86     void slotLeave();
87     void slotVSliderReleased();
88     void slotHSliderReleased();
89     void slotHideChildPopup();
90     void slotKitaIsActive();
91     void slotOnURL( const QString& url );
92
93 signals:
94
95     void openURLRequestExt( const KURL& url, const KParts::URLArgs& args = KParts::URLArgs(),
96                             QString mimetype = QString::null,
97                             int usr1 = 0,
98                             const KURL& usrUrl1 = KURL() );
99     void mousePressed(); /* to KitaThreadView */
100
101     /* res popup */
102     void isKitaActive();
103 };
104
105 #endif