Added a primitive guess of the executable's language.
[kdbg.git] / STabCtl / stabbar.h
blobbf5dab1b7233e8c69dcd10f60d4c498c7bce5496
1 /***************************************************************************
2 STabBar part of KDEStudio
3 -------------------
4 copyright : (C) 1999 by Judin Maximus
5 email : novaprint@mtu-net.ru
6 ***************************************************************************/
8 #ifndef STABBAR_H
9 #define STABBAR_H
11 #include <qwidget.h>
12 #include <qlist.h>
13 #include <qpixmap.h>
15 class QPushButton;
17 struct TabBarData
19 TabBarData( int _id, const char* _label )
21 id = _id;
22 width = 0;
23 label = _label;
24 pix = 0L;
25 enabled = true;
26 textColor = Qt::black;
28 ~TabBarData()
30 if ( pix != 0L ) delete pix;
32 int id;
33 int width;
34 QString label;
35 QPixmap* pix;
36 bool enabled;
37 QColor textColor;
40 class BarPainter;
42 class STabBar: public QWidget
43 {Q_OBJECT
44 friend class BarPainter;
45 public:
46 STabBar( QWidget * parent = 0, const char * name = 0 );
47 ~STabBar();
49 enum TabPos{
50 TAB_TOP,
51 TAB_RIGHT
53 void setTabPos( TabPos );
55 int insertTab( const QString &label, int id = -1 );
57 void setPixmap( int id, const QPixmap &pix );
59 void setTextColor( int id, const QColor &color );
60 const QColor& textColor( int id );
62 void removeTab( int );
64 int currentTab(){ return _currentTab; }
65 void setCurrentTab( int id, bool allowDisable = false );
67 void setTabEnabled( int, bool );
68 bool isTabEnabled( int );
70 void setTabCaption( int id, const QString &caption );
71 QString tabCaption( int id );
73 virtual void show();
74 virtual void setFont( const QFont & );
76 void showTabIcon( bool );
77 bool isShowTabIcon(){ return iconShow; }
79 signals:
80 void tabSelected( int );
81 void rightButtonPress( int, QPoint );
83 protected slots:
84 void leftClicked();
85 void rightClicked();
87 protected:
88 virtual void paintEvent( QPaintEvent* );
89 virtual void resizeEvent( QResizeEvent* );
91 private:
92 void setButtonPixmap();
93 void updateHeight();
95 TabBarData* findData( int id );
96 int tabsWidth();
97 void tabsRecreate();
99 TabPos tabPos;
100 BarPainter* barPainter;
101 QList<TabBarData> *mainData;
102 int _currentTab;
103 int leftTab;
105 QPixmap* up_xpm;
106 QPixmap* down_xpm;
107 QPixmap* left_xpm;
108 QPixmap* right_xpm;
110 QPushButton *right;
111 QPushButton *left;
112 bool rightscroll;
113 bool leftscroll;
114 bool iconShow;
117 class BarPainter: public QWidget
118 {Q_OBJECT
119 friend class STabBar;
120 private:
121 BarPainter( STabBar * parent );
122 ~BarPainter();
124 void drawBuffer();
125 int findBarByPos( int x, int y );
126 QPixmap* buffer;
127 int mousePressTab;
128 int delta;
130 protected:
131 virtual void mousePressEvent ( QMouseEvent * );
132 virtual void mouseReleaseEvent ( QMouseEvent * );
134 virtual void resizeEvent( QResizeEvent * );
135 virtual void paintEvent( QPaintEvent * );
138 #endif