author | wazlaf <wazlaf> | 2002-09-30 08:07:05 (UTC) |
---|---|---|
committer | wazlaf <wazlaf> | 2002-09-30 08:07:05 (UTC) |
commit | a999acbcd1b8bc1715f2ad2dda6acedf423b89ea (patch) (unidiff) | |
tree | 898d433efa8ff3b25a5d10ab4dc4a0a9bc415104 /noncore/net/opieirc/ircmisc.cpp | |
parent | 75dccdfe90324e9ff2426930ae185c3a6bdab734 (diff) | |
download | opie-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.cpp | 35 |
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 @@ | |||
2 | #include <qlayout.h> | 2 | #include <qlayout.h> |
3 | #include <stdio.h> | ||
3 | #include "ircmisc.h" | 4 | #include "ircmisc.h" |
@@ -31 +32,35 @@ QColor IRCFramedColorLabel::color() { | |||
31 | 32 | ||
33 | IRCTabBar::IRCTabBar(QWidget *parent, const char *name) : QTabBar(parent, name) { | ||
34 | } | ||
35 | |||
36 | int IRCTabBar::insertTab(QTab *tab, int index = -1) { | ||
37 | if (m_colors.size() == (unsigned int)count()) | ||
38 | m_colors.resize(m_colors.size() * 2 + 1); | ||
39 | if (index == -1) | ||
40 | m_colors.insert(count(), &black); | ||
41 | else | ||
42 | m_colors.insert(index, &black); | ||
43 | return QTabBar::insertTab(tab, index); | ||
44 | } | ||
45 | |||
46 | void IRCTabBar::setTabColor(int index, const QColor *color) { | ||
47 | m_colors.insert(index, color); | ||
48 | update(); | ||
49 | } | ||
50 | |||
51 | void IRCTabBar::paintLabel(QPainter* p, const QRect& br, QTab* t, bool focus) const { | ||
52 | QRect r = br; | ||
53 | QTabBar::paintLabel(p, br, t, focus); | ||
54 | if (t->id == currentTab()) | ||
55 | r.setBottom(r.bottom() - style().defaultFrameWidth()); | ||
56 | p->setPen(*m_colors.at(t->id)); | ||
57 | p->drawText(r, AlignCenter | ShowPrefix, t->label); | ||
58 | } | ||
59 | |||
60 | IRCTabWidget::IRCTabWidget(QWidget *parent, const char *name) : QTabWidget(parent, name) { | ||
61 | setTabBar(new IRCTabBar(this, "tab control")); | ||
62 | } | ||
63 | |||
64 | void IRCTabWidget::setTabColor(int index, const QColor *color) { | ||
65 | ((IRCTabBar *)tabBar())->setTabColor(index, color); | ||
66 | } | ||