kdeui
ktip.h
Go to the documentation of this file. 00001 /*****************************************************************
00002
00003 Copyright (c) 2000-2003 Matthias Hoelzer-Kluepfel <mhk@kde.org>
00004 Tobias Koenig <tokoe@kde.org>
00005 Daniel Molkentin <molkentin@kde.org>
00006
00007 Permission is hereby granted, free of charge, to any person obtaining a copy
00008 of this software and associated documentation files (the "Software"), to deal
00009 in the Software without restriction, including without limitation the rights
00010 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00011 copies of the Software, and to permit persons to whom the Software is
00012 furnished to do so, subject to the following conditions:
00013
00014 The above copyright notice and this permission notice shall be included in
00015 all copies or substantial portions of the Software.
00016
00017 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00018 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00019 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00020 AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
00021 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00022 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00023
00024 ******************************************************************/
00025
00026 #ifndef __K_TIP_H__
00027 #define __K_TIP_H__
00028
00029 #include <qstringlist.h>
00030
00031 #include <kdialog.h>
00032
00033 class QCheckBox;
00034
00035 class KTextBrowser;
00036
00055 class KDEUI_EXPORT KTipDatabase
00056 {
00057 public:
00064 KTipDatabase(const QString &tipFile = QString::null);
00065
00072 KTipDatabase(const QStringList &tipFiles);
00073
00077 QString tip() const;
00078
00082 void nextTip();
00083
00087 void prevTip();
00088
00089 private:
00090 void loadTips(const QString &tipFile);
00091
00092 void addTips(const QString &tipFile);
00093
00094 QStringList mTips;
00095
00096 int mCurrent;
00097 class KTipDatabasePrivate;
00098 KTipDatabasePrivate *d;
00099 };
00100
00108 class KDEUI_EXPORT KTipDialog : public KDialog
00109 {
00110 Q_OBJECT
00111 public:
00119 KTipDialog(KTipDatabase *db, QWidget *parent = 0, const char *name = 0);
00120 ~KTipDialog();
00121
00138 static void showTip(QWidget *parent, const QString &tipFile = QString::null, bool force=false);
00139
00151 static void showMultiTip(QWidget *parent, const QStringList &tipFiles, bool force=false);
00152
00159 static void showTip(const QString &tipFile = QString::null, bool force = false);
00160
00167 static void setShowOnStart(bool show);
00168
00169 protected:
00170 bool eventFilter(QObject *, QEvent *);
00171 virtual void virtual_hook( int id, void* data );
00172
00173 private slots:
00174 void nextTip();
00175 void prevTip();
00176 void showOnStart(bool);
00177
00178 private:
00179 KTipDatabase *mDatabase;
00180
00181 QCheckBox *mTipOnStart;
00182 KTextBrowser *mTipText;
00183
00184 class KTipDialogPrivate;
00185 KTipDialogPrivate *d;
00186
00187 static KTipDialog *mInstance;
00188
00189 QColor mBaseColor, mBlendedColor, mTextColor;
00190 };
00191
00192 #endif