summaryrefslogtreecommitdiff
path: root/noncore/net/opieirc/ircmisc.cpp
authorwazlaf <wazlaf>2002-09-30 08:07:05 (UTC)
committer wazlaf <wazlaf>2002-09-30 08:07:05 (UTC)
commita999acbcd1b8bc1715f2ad2dda6acedf423b89ea (patch) (side-by-side diff)
tree898d433efa8ff3b25a5d10ab4dc4a0a9bc415104 /noncore/net/opieirc/ircmisc.cpp
parent75dccdfe90324e9ff2426930ae185c3a6bdab734 (diff)
downloadopie-a999acbcd1b8bc1715f2ad2dda6acedf423b89ea.zip
opie-a999acbcd1b8bc1715f2ad2dda6acedf423b89ea.tar.gz
opie-a999acbcd1b8bc1715f2ad2dda6acedf423b89ea.tar.bz2
tabs now change their color when actions occur
Diffstat (limited to 'noncore/net/opieirc/ircmisc.cpp') (more/less context) (show 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
@@ -2,2 +2,3 @@
#include <qlayout.h>
+#include <stdio.h>
#include "ircmisc.h"
@@ -31 +32,35 @@ QColor IRCFramedColorLabel::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);
+}