00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __KOCONTEXTHELPACTION_H__
00021 #define __KOCONTEXTHELPACTION_H__
00022
00023 #include <QWidget>
00024 #include <QBitmap>
00025 #include <q3dockwindow.h>
00026
00027 #include <QPixmap>
00028 #include <QMouseEvent>
00029 #include <QLabel>
00030 #include <QTimerEvent>
00031 #include <QResizeEvent>
00032 #include <QKeyEvent>
00033 #include <QEvent>
00034 #include <QPaintEvent>
00035
00036 #include <kaction.h>
00037 #include <ktoggleaction.h>
00038 #include <koffice_export.h>
00039 class QPixmap;
00040 class QLabel;
00041 class Q3SimpleRichText;
00042
00043 class KoVerticalLabel : public QWidget
00044 {
00045 Q_OBJECT
00046
00047 public:
00048 KoVerticalLabel( QWidget* parent = 0, const char* name = 0 );
00049 ~KoVerticalLabel();
00050
00051 public slots:
00052 void setText( const QString& text );
00053
00054 protected:
00055 void paintEvent( QPaintEvent* );
00056
00057 private:
00058 QString m_text;
00059 };
00060
00061 class KoHelpNavButton : public QWidget
00062 {
00063 Q_OBJECT
00064
00065 public:
00066 enum NavDirection {
00067 Up,
00068 Down
00069 };
00070
00071 KoHelpNavButton( NavDirection d, QWidget* parent );
00072
00073 signals:
00074 void pressed();
00075 void released();
00076
00077 protected:
00078 void paintEvent( QPaintEvent* );
00079 void enterEvent( QEvent* );
00080 void leaveEvent( QEvent* );
00081
00082 private:
00083 QBitmap m_bitmap;
00084 bool m_pressed;
00085 };
00086
00087 class KoTinyButton : public QWidget
00088 {
00089 Q_OBJECT
00090
00091 public:
00092 enum Action {
00093 Close,
00094 Sticky
00095 };
00096
00097 KoTinyButton( Action a, QWidget* parent );
00098
00099 signals:
00100 void clicked();
00101 void toggled( bool );
00102
00103 protected:
00104 void paintEvent( QPaintEvent* );
00105 void mousePressEvent( QMouseEvent* );
00106 void mouseReleaseEvent( QMouseEvent* );
00107
00108 private:
00109 QBitmap m_bitmap;
00110 bool m_pressed;
00111 Action m_action;
00112 bool m_toggled;
00113 };
00114
00115 class KoHelpView : public QWidget
00116 {
00117 Q_OBJECT
00118
00119 public:
00120 KoHelpView( QWidget* parent );
00121 ~KoHelpView();
00122
00123 void setText( const QString& text );
00124 bool eventFilter( QObject* watched, QEvent* e );
00125
00126 signals:
00127 void linkClicked( const QString& link );
00128
00129 protected:
00130 virtual void mousePressEvent( QMouseEvent* e );
00131 virtual void mouseReleaseEvent( QMouseEvent* e );
00132 virtual void mouseMoveEvent( QMouseEvent* e );
00133 virtual void paintEvent( QPaintEvent* e );
00134
00135 private:
00136 Q3SimpleRichText* currentText;
00137 QString currentAnchor;
00138 };
00139
00140 class KoHelpWidget : public QWidget
00141 {
00142 Q_OBJECT
00143
00144 public:
00145 KoHelpWidget( const QString& help, QWidget* parent );
00146
00147 void setText( const QString& text );
00148 void timerEvent( QTimerEvent* );
00149 void updateButtons();
00150
00151 signals:
00152 void linkClicked( const QString& link );
00153
00154 public slots:
00155 void scrollUp();
00156 void scrollDown();
00157 void startScrollingUp();
00158 void startScrollingDown();
00159 void stopScrolling();
00160
00161 protected:
00162 void resizeEvent( QResizeEvent* );
00163
00164 private:
00165 int m_ypos;
00166 bool m_scrollDown;
00167 QWidget* m_helpViewport;
00168 KoHelpView* m_helpView;
00169 KoHelpNavButton* m_upButton;
00170 KoHelpNavButton* m_downButton;
00171 };
00172
00176 class KoContextHelpPopup : public QWidget
00177 {
00178 Q_OBJECT
00179
00180 public:
00181 KoContextHelpPopup( QWidget* parent = 0 );
00182 ~KoContextHelpPopup();
00183
00184 public slots:
00185 void setContextHelp( const QString& title, const QString& text, const QPixmap* icon = 0 );
00186 void setSticky( bool sticky ) { m_isSticky = sticky; }
00187
00188 protected:
00189 virtual void mousePressEvent( QMouseEvent* );
00190 virtual void mouseMoveEvent( QMouseEvent* );
00191 virtual void resizeEvent( QResizeEvent* );
00192 virtual void paintEvent( QPaintEvent* );
00193 virtual void windowActivationChange( bool );
00194 virtual void keyPressEvent ( QKeyEvent* );
00195 virtual void keyReleaseEvent ( QKeyEvent* );
00196
00197 signals:
00198 void wantsToBeClosed();
00202 void linkClicked( const QString& link );
00203
00204 private:
00205 KoHelpWidget* m_helpViewer;
00206 KoVerticalLabel* m_helpTitle;
00207 QLabel* m_helpIcon;
00208 KoTinyButton* m_close;
00209 KoTinyButton* m_sticky;
00210
00211 QPoint m_mousePos;
00212 bool m_isSticky;
00213 };
00214
00221 class KOFFICEUI_EXPORT KoContextHelpAction : public KToggleAction
00222 {
00223 Q_OBJECT
00224
00225 public:
00226 KoContextHelpAction( KActionCollection* parent, QWidget* parent = 0 );
00227 virtual ~KoContextHelpAction();
00228
00229 public slots:
00230 void updateHelp( const QString& title, const QString& text, const QPixmap* icon = 0 );
00231 void closePopup();
00232
00233 signals:
00237 void linkClicked( const QString& link );
00238
00239 private:
00240 KoContextHelpPopup* m_popup;
00241 };
00242
00243 class KoContextHelpWidget : public QWidget
00244 {
00245 Q_OBJECT
00246
00247 public:
00248 KoContextHelpWidget( QWidget* parent = 0, const char* name = 0 );
00249 ~KoContextHelpWidget();
00250
00251 public slots:
00252 void setContextHelp( const QString& title, const QString& text, const QPixmap* icon = 0 );
00253
00254 signals:
00258 void linkClicked( const QString& link );
00259
00260 private:
00261 KoHelpWidget* m_helpViewer;
00262 KoVerticalLabel* m_helpTitle;
00263 QLabel* m_helpIcon;
00264 };
00265
00266 class KoContextHelpDocker : public Q3DockWindow
00267 {
00268 Q_OBJECT
00269
00270 public:
00271 KoContextHelpDocker( QWidget* parent = 0, const char* name = 0 );
00272 ~KoContextHelpDocker();
00273
00274 public slots:
00275 void setContextHelp( const QString& title, const QString& text, const QPixmap* icon = 0 );
00276
00277 signals:
00281 void linkClicked( const QString& link );
00282
00283 private:
00284 KoHelpWidget* m_helpViewer;
00285 KoVerticalLabel* m_helpTitle;
00286 QLabel* m_helpIcon;
00287 };
00288
00289 #endif