/* This file is part of the KDE Libraries
Copyright (C) 1998 Thomas Tanghus (tanghus@earthling.net)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __KTABBAR_H__
#define __KTABBAR_H__
#include <kapp.h>
#include <kwizard.h>
#include <qtabbar.h>
//#include <qbutton.h>
#define JUMP 30
/**
* KTabButton is a helper class for KTabBar. It provides the buttons
* used to scroll the tab bar.
* @short KTabButton
* @author Thomas Tanghus <tanghus@earthling.net>
* @version 0.1
*/
class KTabButton : public KDirectionButton
{
Q_OBJECT
public:
KTabButton( QWidget * parent = 0, const char * name = 0 );
~KTabButton() { };
protected:
virtual void drawButton(QPainter *);
};
/**
* KTabBar is very similar to QTabBar. The only difference is that if the tab bar
* needs more space it provides left and right buttons used to scroll the tab bar.
* @short KTabBar
* @author Thomas Tanghus <tanghus@earthling.net>
* @version 0.1
*/
class KTabBar : public QWidget
{
Q_OBJECT
public:
KTabBar( QWidget * parent = 0, const char * name = 0 );
~KTabBar();
QTabBar *getQTab() { return qtab; };
QSize sizeHint() { return qtab->sizeHint(); };
int addTab( QTab *tab ) { return qtab->addTab(tab); };
void setTabEnabled( int tab, bool enable ) { qtab->setTabEnabled(tab, enable); };
bool isTabEnabled( int tab ) { return qtab->isTabEnabled( tab ); };
int currentTab() { return qtab->currentTab(); };
QTab *tab( int tab ) { return qtab->tab(tab); };
int keyboardFocusTab() { return qtab->keyboardFocusTab(); };
public slots:
void setCurrentTab( int tab ) { qtab->setCurrentTab( tab ); };
void setCurrentTab( QTab *tab ) { qtab->setCurrentTab( tab ); };
signals:
void selected( int );
void scrolled( ArrowType );
protected:
void init();
void setSizes();
void resizeEvent ( QResizeEvent * );
void paintEvent ( QPaintEvent * );
//void paintScrollButton( QButton *button, QPainter *p, Direction d);
protected slots:
void leftClicked();
void rightClicked();
void emitSelected(int);
private:
QTabBar *qtab;
QWidget *tabw;
KTabButton *left, *right;
bool leftscroll, rightscroll;
int tpos, t_width, tw_width, tw_height, tw_start;
};
#endif __KTABBAR_H__
Documentation generated by tanghus@tang1 on Sun Feb 15 18:01:30 CET 1998