lib Library API Documentation

kocontexthelp.h

00001 /* This file is part of the KDE project 00002 Copyright (C) 2002, Benoit Vautrin <benoit.vautrin@free.fr> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00017 Boston, MA 02111-1307, USA. 00018 */ 00019 00020 #ifndef __KOCONTEXTHELPACTION_H__ 00021 #define __KOCONTEXTHELPACTION_H__ 00022 00023 #include <qwidget.h> 00024 #include <qbitmap.h> 00025 #include <qdockwindow.h> 00026 00027 #include <kaction.h> 00028 00029 class QPixmap; 00030 class QLabel; 00031 class QSimpleRichText; 00032 00033 class KoVerticalLabel : public QWidget 00034 { 00035 Q_OBJECT 00036 00037 public: 00038 KoVerticalLabel( QWidget* parent = 0, const char* name = 0 ); 00039 ~KoVerticalLabel(); 00040 00041 public slots: 00042 void setText( const QString& text ); 00043 00044 protected: 00045 void paintEvent( QPaintEvent* ); 00046 00047 private: 00048 QString m_text; 00049 }; // KoVerticalLabel 00050 00051 class KoHelpNavButton : public QWidget 00052 { 00053 Q_OBJECT 00054 00055 public: 00056 enum NavDirection { 00057 Up, 00058 Down 00059 }; 00060 00061 KoHelpNavButton( NavDirection d, QWidget* parent ); 00062 00063 signals: 00064 void pressed(); 00065 void released(); 00066 00067 protected: 00068 void paintEvent( QPaintEvent* ); 00069 void enterEvent( QEvent* ); 00070 void leaveEvent( QEvent* ); 00071 00072 private: 00073 QBitmap m_bitmap; 00074 bool m_pressed; 00075 }; // KoHelpNavButton 00076 00077 class KoTinyButton : public QWidget 00078 { 00079 Q_OBJECT 00080 00081 public: 00082 enum Action { 00083 Close, 00084 Sticky 00085 }; 00086 00087 KoTinyButton( Action a, QWidget* parent ); 00088 00089 signals: 00090 void clicked(); 00091 void toggled( bool ); 00092 00093 protected: 00094 void paintEvent( QPaintEvent* ); 00095 void mousePressEvent( QMouseEvent* ); 00096 void mouseReleaseEvent( QMouseEvent* ); 00097 00098 private: 00099 QBitmap m_bitmap; 00100 bool m_pressed; 00101 Action m_action; 00102 bool m_toggled; 00103 }; // KoTinyButton 00104 00105 class KoHelpView : public QWidget 00106 { 00107 Q_OBJECT 00108 00109 public: 00110 KoHelpView( QWidget* parent ); 00111 ~KoHelpView(); 00112 00113 void setText( const QString& text ); 00114 bool eventFilter( QObject* watched, QEvent* e ); 00115 00116 signals: 00117 void linkClicked( const QString& link ); 00118 00119 protected: 00120 virtual void mousePressEvent( QMouseEvent* e ); 00121 virtual void mouseReleaseEvent( QMouseEvent* e ); 00122 virtual void mouseMoveEvent( QMouseEvent* e ); 00123 virtual void paintEvent( QPaintEvent* e ); 00124 00125 private: 00126 QSimpleRichText* currentText; 00127 QString currentAnchor; 00128 }; // KoHelpView 00129 00130 class KoHelpWidget : public QWidget 00131 { 00132 Q_OBJECT 00133 00134 public: 00135 KoHelpWidget( QString help, QWidget* parent ); 00136 00137 void setText( QString text ); 00138 void timerEvent( QTimerEvent* ); 00139 void updateButtons(); 00140 00141 signals: 00142 void linkClicked( const QString& link ); 00143 00144 public slots: 00145 void scrollUp(); 00146 void scrollDown(); 00147 void startScrollingUp(); 00148 void startScrollingDown(); 00149 void stopScrolling(); 00150 00151 protected: 00152 void resizeEvent( QResizeEvent* ); 00153 00154 private: 00155 int m_ypos; 00156 bool m_scrollDown; 00157 QWidget* m_helpViewport; 00158 KoHelpView* m_helpView; 00159 KoHelpNavButton* m_upButton; 00160 KoHelpNavButton* m_downButton; 00161 }; // KoHelpWidget 00162 00166 class KoContextHelpPopup : public QWidget 00167 { 00168 Q_OBJECT 00169 00170 public: 00171 KoContextHelpPopup( QWidget* parent = 0 ); 00172 ~KoContextHelpPopup(); 00173 00174 public slots: 00175 void setContextHelp( const QString& title, const QString& text, const QPixmap* icon = 0 ); 00176 void setSticky( bool sticky ) { m_isSticky = sticky; } 00177 00178 protected: 00179 virtual void mousePressEvent( QMouseEvent* ); 00180 virtual void mouseMoveEvent( QMouseEvent* ); 00181 virtual void resizeEvent( QResizeEvent* ); 00182 virtual void paintEvent( QPaintEvent* ); 00183 virtual void windowActivationChange( bool ); 00184 virtual void keyPressEvent ( QKeyEvent* ); 00185 virtual void keyReleaseEvent ( QKeyEvent* ); 00186 00187 signals: 00188 void wantsToBeClosed(); 00192 void linkClicked( const QString& link ); 00193 00194 private: 00195 KoHelpWidget* m_helpViewer; 00196 KoVerticalLabel* m_helpTitle; 00197 QLabel* m_helpIcon; 00198 KoTinyButton* m_close; 00199 KoTinyButton* m_sticky; 00200 00201 QPoint m_mousePos; 00202 bool m_isSticky; 00203 }; // KoContextHelpPopup 00204 00211 class KoContextHelpAction : public KToggleAction 00212 { 00213 Q_OBJECT 00214 00215 public: 00216 KoContextHelpAction( KActionCollection* parent, QWidget* parent = 0 ); 00217 virtual ~KoContextHelpAction(); 00218 00219 public slots: 00220 void updateHelp( const QString& title, const QString& text, const QPixmap* icon = 0 ); 00221 void closePopup(); 00222 00223 signals: 00227 void linkClicked( const QString& link ); 00228 00229 private: 00230 KoContextHelpPopup* m_popup; 00231 }; // KoContextHelpAction 00232 00233 class KoContextHelpWidget : public QWidget 00234 { 00235 Q_OBJECT 00236 00237 public: 00238 KoContextHelpWidget( QWidget* parent = 0, const char* name = 0 ); 00239 ~KoContextHelpWidget(); 00240 00241 public slots: 00242 void setContextHelp( const QString& title, const QString& text, const QPixmap* icon = 0 ); 00243 00244 signals: 00248 void linkClicked( const QString& link ); 00249 00250 private: 00251 KoHelpWidget* m_helpViewer; 00252 KoVerticalLabel* m_helpTitle; 00253 QLabel* m_helpIcon; 00254 }; // KoContextHelpWidget 00255 00256 class KoContextHelpDocker : public QDockWindow 00257 { 00258 Q_OBJECT 00259 00260 public: 00261 KoContextHelpDocker( QWidget* parent = 0, const char* name = 0 ); 00262 ~KoContextHelpDocker(); 00263 00264 public slots: 00265 void setContextHelp( const QString& title, const QString& text, const QPixmap* icon = 0 ); 00266 00267 signals: 00271 void linkClicked( const QString& link ); 00272 00273 private: 00274 KoHelpWidget* m_helpViewer; 00275 KoVerticalLabel* m_helpTitle; 00276 QLabel* m_helpIcon; 00277 }; // KoContextHelpDocker 00278 00279 #endif /* __KOCONTEXTHELPACTION_H__ */
KDE Logo
This file is part of the documentation for lib Library Version 1.3.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Sep 24 18:22:23 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003