summaryrefslogtreecommitdiffstats
path: root/src/common/gui/list_container.h
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-24 18:42:24 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-24 18:42:24 +0000
commitf508189682b6fba62e08feeb1596f682bad5fff9 (patch)
tree28aeb0e6c19386c385c1ce5edf8a92c1bca15281 /src/common/gui/list_container.h
downloadpiklab-f508189682b6fba62e08feeb1596f682bad5fff9.tar.gz
piklab-f508189682b6fba62e08feeb1596f682bad5fff9.zip
Added KDE3 version of PikLab
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/piklab@1095639 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/common/gui/list_container.h')
-rw-r--r--src/common/gui/list_container.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/common/gui/list_container.h b/src/common/gui/list_container.h
new file mode 100644
index 0000000..b70db57
--- /dev/null
+++ b/src/common/gui/list_container.h
@@ -0,0 +1,55 @@
+/***************************************************************************
+ * Copyright (C) 2007 Nicolas Hadacek <hadacek@kde.org> *
+ * *
+ * 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. *
+ ***************************************************************************/
+#ifndef LIST_CONTAINER_H
+#define LIST_CONTAINER_H
+
+#include <kpopupmenu.h>
+#include <klistview.h>
+
+//----------------------------------------------------------------------------
+class ListContainer
+{
+public:
+ virtual ~ListContainer() {}
+ virtual ListContainer *appendBranch(const QString &title) = 0;
+ enum ItemState { Normal, Checked, UnChecked, Disabled };
+ void appendItem(const QString &label, uint id, ItemState state) { appendItem(QPixmap(), label, id, state); }
+ virtual void appendItem(const QPixmap &icon, const QString &label, uint id, ItemState state) = 0;
+};
+
+//----------------------------------------------------------------------------
+class PopupContainer : public KPopupMenu, public ListContainer
+{
+Q_OBJECT
+public:
+ PopupContainer(const QString &title, QWidget *parent = 0, const char *name = 0);
+ virtual ListContainer *appendBranch(const QString &title);
+ virtual ListContainer *appendBranch(const QPixmap &icon, const QString &title);
+ virtual void appendItem(const QPixmap &icon, const QString &label, uint id, ItemState state);
+};
+
+//----------------------------------------------------------------------------
+class ListViewItemContainer : public KListViewItem, public ListContainer
+{
+public:
+ ListViewItemContainer(const QString &title, KListView *parent);
+ ListViewItemContainer(const QString &title, ListViewItemContainer *parent);
+ virtual ~ListViewItemContainer();
+ void setColumn(uint column) { _column = column; }
+ virtual ListContainer *appendBranch(const QString &title);
+ virtual void appendItem(const QPixmap &icon, const QString &label, uint id, ItemState state);
+ int id(const QListViewItem* item) const; // -1 if not known
+
+private:
+ ListViewItemContainer *_parent;
+ uint _column;
+ QMap<const QListViewItem *, uint> *_ids;
+};
+
+#endif