summaryrefslogtreecommitdiff
path: root/noncore/net/opieirc/ircmisc.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/opieirc/ircmisc.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieirc/ircmisc.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/noncore/net/opieirc/ircmisc.cpp b/noncore/net/opieirc/ircmisc.cpp
index f41a89a..dd7292c 100644
--- a/noncore/net/opieirc/ircmisc.cpp
+++ b/noncore/net/opieirc/ircmisc.cpp
@@ -1,5 +1,6 @@
#include <opie/colordialog.h>
#include <qlayout.h>
+#include <stdio.h>
#include "ircmisc.h"
IRCColorLabel::IRCColorLabel(QColor color, QWidget *parent, const char *name, WFlags f) : QLabel(parent, name, f) {
@@ -29,3 +30,37 @@ QColor IRCFramedColorLabel::color() {
return m_label->color();
}
+IRCTabBar::IRCTabBar(QWidget *parent, const char *name) : QTabBar(parent, name) {
+}
+
+int IRCTabBar::insertTab(QTab *tab, int index = -1) {
+ if (m_colors.size() == (unsigned int)count())
+ m_colors.resize(m_colors.size() * 2 + 1);
+ if (index == -1)
+ m_colors.insert(count(), &black);
+ else
+ m_colors.insert(index, &black);
+ return QTabBar::insertTab(tab, index);
+}
+
+void IRCTabBar::setTabColor(int index, const QColor *color) {
+ m_colors.insert(index, color);
+ update();
+}
+
+void IRCTabBar::paintLabel(QPainter* p, const QRect& br, QTab* t, bool focus) const {
+ QRect r = br;
+ QTabBar::paintLabel(p, br, t, focus);
+ if (t->id == currentTab())
+ r.setBottom(r.bottom() - style().defaultFrameWidth());
+ p->setPen(*m_colors.at(t->id));
+ p->drawText(r, AlignCenter | ShowPrefix, t->label);
+}
+
+IRCTabWidget::IRCTabWidget(QWidget *parent, const char *name) : QTabWidget(parent, name) {
+ setTabBar(new IRCTabBar(this, "tab control"));
+}
+
+void IRCTabWidget::setTabColor(int index, const QColor *color) {
+ ((IRCTabBar *)tabBar())->setTabColor(index, color);
+}