Support debugger drivers that use a regular expression to search for the prompt.
[kdbg.git] / STabCtl / stabbar.h
blob8f2eba780ed9870a6c234e6feb9e81ea62198c79
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 #if QT_VERSION >= 200
27 textColor = Qt::black;
28 #else
29 textColor = black;
30 #endif
32 ~TabBarData()
34 if ( pix != 0L ) delete pix;
36 int id;
37 int width;
38 QString label;
39 QPixmap* pix;
40 bool enabled;
41 QColor textColor;
44 class BarPainter;
46 class STabBar: public QWidget
47 {Q_OBJECT
48 friend class BarPainter;
49 public:
50 STabBar( QWidget * parent = 0, const char * name = 0 );
51 ~STabBar();
53 enum TabPos{
54 TAB_TOP,
55 TAB_RIGHT
57 void setTabPos( TabPos );
59 int insertTab( const QString &label, int id = -1 );
61 void setPixmap( int id, const QPixmap &pix );
63 void setTextColor( int id, const QColor &color );
64 const QColor& textColor( int id );
66 void removeTab( int );
68 int currentTab(){ return _currentTab; }
69 void setCurrentTab( int id, bool allowDisable = false );
71 void setTabEnabled( int, bool );
72 bool isTabEnabled( int );
74 void setTabCaption( int id, const QString &caption );
75 QString tabCaption( int id );
77 virtual void show();
78 virtual void setFont( const QFont & );
80 void showTabIcon( bool );
81 bool isShowTabIcon(){ return iconShow; }
83 signals:
84 void tabSelected( int );
85 void rightButtonPress( int, QPoint );
87 protected slots:
88 void leftClicked();
89 void rightClicked();
91 protected:
92 virtual void paintEvent( QPaintEvent* );
93 virtual void resizeEvent( QResizeEvent* );
95 private:
96 void setButtonPixmap();
97 void updateHeight();
99 TabBarData* findData( int id );
100 int tabsWidth();
101 void tabsRecreate();
103 TabPos tabPos;
104 BarPainter* barPainter;
105 QList<TabBarData> *mainData;
106 int _currentTab;
107 int leftTab;
109 QPixmap* up_xpm;
110 QPixmap* down_xpm;
111 QPixmap* left_xpm;
112 QPixmap* right_xpm;
114 QPushButton *right;
115 QPushButton *left;
116 bool rightscroll;
117 bool leftscroll;
118 bool iconShow;
121 class BarPainter: public QWidget
122 {Q_OBJECT
123 friend class STabBar;
124 private:
125 BarPainter( STabBar * parent );
126 ~BarPainter();
128 void drawBuffer();
129 int findBarByPos( int x, int y );
130 QPixmap* buffer;
131 int mousePressTab;
132 int delta;
134 protected:
135 virtual void mousePressEvent ( QMouseEvent * );
136 virtual void mouseReleaseEvent ( QMouseEvent * );
138 virtual void resizeEvent( QResizeEvent * );
139 virtual void paintEvent( QPaintEvent * );
142 #endif