summaryrefslogtreecommitdiff
path: root/noncore/apps/zsafe/shadedlistitem.cpp
authorzcarsten <zcarsten>2003-07-22 19:23:13 (UTC)
committer zcarsten <zcarsten>2003-07-22 19:23:13 (UTC)
commitfa3772aa7ddea5725cc7e7db42d017567e4cc14c (patch) (side-by-side diff)
tree112ec27dd148d0b381ac559fd3e1ee32a89ecd0d /noncore/apps/zsafe/shadedlistitem.cpp
parent059af0e82a14a32f068c2ad943dc918afca93587 (diff)
downloadopie-fa3772aa7ddea5725cc7e7db42d017567e4cc14c.zip
opie-fa3772aa7ddea5725cc7e7db42d017567e4cc14c.tar.gz
opie-fa3772aa7ddea5725cc7e7db42d017567e4cc14c.tar.bz2
Initial revision
Diffstat (limited to 'noncore/apps/zsafe/shadedlistitem.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/zsafe/shadedlistitem.cpp69
1 files changed, 69 insertions, 0 deletions
diff --git a/noncore/apps/zsafe/shadedlistitem.cpp b/noncore/apps/zsafe/shadedlistitem.cpp
new file mode 100644
index 0000000..72c6261
--- a/dev/null
+++ b/noncore/apps/zsafe/shadedlistitem.cpp
@@ -0,0 +1,69 @@
+/*
+ * shadedlistitem.cpp
+ *
+ * (c) 2003 by Jeremy Bowman <jmbowman@alum.mit.edu>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include "zsafe.h"
+#include "shadedlistitem.h"
+
+
+ShadedListItem::ShadedListItem(int index, QListViewItem *parent)
+ : QListViewItem(parent)
+{
+ oddRow = (index % 2 != 0);
+}
+
+ShadedListItem::ShadedListItem(int index, QListView *parent)
+ : QListViewItem(parent), lv(parent)
+{
+ oddRow = (index % 2 != 0);
+}
+
+ShadedListItem::ShadedListItem(int index, QListView *parent, QListViewItem *after)
+ : QListViewItem(parent, after), lv(parent)
+{
+ oddRow = (index % 2 != 0);
+}
+
+ShadedListItem::ShadedListItem(int index, QListView *parent, QString label1, QString label2, QString label3)
+ : QListViewItem(parent, label1, label2, label3), lv(parent)
+{
+ oddRow = (index % 2 != 0);
+}
+
+ShadedListItem::ShadedListItem(int index, QListView *parent, QListViewItem *after, QString label1, QString label2, QString label3)
+ : QListViewItem(parent, after, label1, label2, label3), lv(parent)
+{
+ oddRow = (index % 2 != 0);
+}
+
+ShadedListItem::~ShadedListItem()
+{
+
+}
+
+
+void ShadedListItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment)
+{
+ QColorGroup colors(cg);
+#if QT_VERSION >=300
+ const QColorGroup::ColorRole crole = QColorGroup::Base;
+ // const QWidget::BackgroundMode bgmode = lv->viewport()->backgroundMode();
+ // const QColorGroup::ColorRole crole = QPalette::backgroundRoleFromMode(bgmode);
+#else
+ const QColorGroup::ColorRole crole = QColorGroup::Base;
+#endif
+ if (oddRow) {
+ colors.setColor(crole, *ZSafe::oddRowColor);
+ }
+ else {
+ colors.setColor(crole, *ZSafe::evenRowColor);
+ }
+ QListViewItem::paintCell(p, colors, column, width, alignment);
+}