summaryrefslogtreecommitdiff
path: root/noncore/net/opieirc/ircmisc.cpp
Unidiff
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
@@ -1,5 +1,6 @@
1#include <opie/colordialog.h> 1#include <opie/colordialog.h>
2#include <qlayout.h> 2#include <qlayout.h>
3#include <stdio.h>
3#include "ircmisc.h" 4#include "ircmisc.h"
4 5
5IRCColorLabel::IRCColorLabel(QColor color, QWidget *parent, const char *name, WFlags f) : QLabel(parent, name, f) { 6IRCColorLabel::IRCColorLabel(QColor color, QWidget *parent, const char *name, WFlags f) : QLabel(parent, name, f) {
@@ -29,3 +30,37 @@ QColor IRCFramedColorLabel::color() {
29 return m_label->color(); 30 return m_label->color();
30} 31}
31 32
33IRCTabBar::IRCTabBar(QWidget *parent, const char *name) : QTabBar(parent, name) {
34}
35
36int 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
46void IRCTabBar::setTabColor(int index, const QColor *color) {
47 m_colors.insert(index, color);
48 update();
49}
50
51void 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
60IRCTabWidget::IRCTabWidget(QWidget *parent, const char *name) : QTabWidget(parent, name) {
61 setTabBar(new IRCTabBar(this, "tab control"));
62}
63
64void IRCTabWidget::setTabColor(int index, const QColor *color) {
65 ((IRCTabBar *)tabBar())->setTabColor(index, color);
66}