00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef LAUNCHERTAB_H
00021 #define LAUNCHERTAB_H
00022
00023 #include <qcolor.h>
00024 #include <qstring.h>
00025 #include <qwidget.h>
00026 #include <qrect.h>
00027 #include <qiconset.h>
00028 #include <qlist.h>
00029 #include <qdict.h>
00030 #include <qtabbar.h>
00031
00032 class LauncherView;
00033
00034 class LauncherTab : public QTab
00035 {
00036 public:
00037 LauncherTab( const QString &idStr, LauncherView *viewPtr,
00038 const QIconSet &iconSet,
00039 const QString &textStr=QString::null )
00040 : QTab( iconSet, textStr )
00041 {
00042 type = idStr;
00043 view = viewPtr;
00044 }
00045
00046 QString type;
00047 LauncherView *view;
00048 QColor bgColor;
00049 QColor fgColor;
00050 };
00051
00052 class LauncherTabBar : public QTabBar
00053 {
00054 Q_OBJECT
00055 public:
00056 LauncherTabBar( QWidget *parent=0, const char *name=0 );
00057 ~LauncherTabBar();
00058
00059 void insertTab( LauncherTab *, int index = -1 );
00060 void removeTab( QTab * );
00061
00062 LauncherView *currentView() {
00063 return currentLauncherTab()->view;
00064 }
00065
00066 LauncherTab *currentLauncherTab() {
00067 return (LauncherTab*) tab( currentTab() );
00068 }
00069
00070 LauncherTab *launcherTab( const QString &id ) const { return tabs[id]; }
00071
00072 void nextTab();
00073 void prevTab();
00074
00075 public slots:
00076 void showTab(const QString&);
00077
00078 protected slots:
00079 virtual void layoutTabs();
00080
00081 protected:
00082 virtual void paint( QPainter *p, QTab *t, bool f ) const;
00083 void paintLabel( QPainter* p, const QRect& br, QTab* t, bool has_focus ) const;
00084
00085 private:
00086 QList<LauncherTab> items;
00087 QDict<LauncherTab> tabs;
00088 };
00089
00090 #endif