• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeplasma-addons API Reference
  • KDE Home
  • Contact Us
 

liblancelot

  • sources
  • kde-4.12
  • kdeplasma-addons
  • libs
  • lancelot
  • widgets
CustomListView.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2007, 2008, 2009, 2010 Ivan Cukic <ivan.cukic(at)kde.org>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser/Library General Public License version 2,
6  * or (at your option) any later version, as published by the Free
7  * Software Foundation
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser/Library General Public License for more details
13  *
14  * You should have received a copy of the GNU Lesser/Library General Public
15  * License along with this program; if not, write to the
16  * Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  */
19 
20 #ifndef LANCELOT_CUSTOM_LIST_VIEW_H
21 #define LANCELOT_CUSTOM_LIST_VIEW_H
22 
23 #include <KIcon>
24 
25 #include <lancelot/lancelot_export.h>
26 #include <lancelot/widgets/ExtenderButton.h>
27 #include <lancelot/widgets/ScrollPane.h>
28 #include <lancelot/widgets/Widget.h>
29 
30 namespace Lancelot
31 {
32 
37 class LANCELOT_EXPORT CustomListItem {
38 public:
39  CustomListItem();
40  virtual ~CustomListItem();
41 
42  virtual void setSelected(bool selected = true) = 0;
43  virtual bool isSelected() const = 0;
44 };
45 
53 class LANCELOT_EXPORT CustomListItemFactory: public QObject {
54  Q_OBJECT
55 public:
56  CustomListItemFactory();
57  virtual ~CustomListItemFactory();
58 
62  virtual int itemCount() const = 0;
63 
68  virtual CustomListItem * itemForIndex(int index) = 0;
69 
75  virtual int itemHeight(int index, Qt::SizeHint which) const = 0;
76 
77 Q_SIGNALS:
83  void updated();
84 
89  void itemInserted(int index);
90 
95  void itemDeleted(int index);
96 
101  void itemAltered(int index);
102 };
103 
110 class LANCELOT_EXPORT CustomList: public QGraphicsWidget, public Scrollable {
111  Q_OBJECT
112 public:
113  CustomList(QGraphicsItem * parent = NULL);
114  explicit CustomList(CustomListItemFactory * factory,
115  QGraphicsItem * parent = NULL);
116 
117  virtual ~CustomList();
118 
119  void setMargin(Plasma::MarginEdge margin, qreal value);
120  qreal margin(Plasma::MarginEdge margin);
121 
122  void setItemFactory(CustomListItemFactory * factory);
123  CustomListItemFactory * itemFactory() const;
124 
125  int itemAtPosition(int y) const;
126 
127  L_Override QSizeF sizeFor(QSizeF viewportSize) const;
128  L_Override void viewportChanged(QRectF viewport);
129  L_Override qreal scrollUnit(Qt::Orientation direction) const;
130 
131 Q_SIGNALS:
132  void sizeChanged();
133 
134 protected Q_SLOTS:
135  void factoryItemInserted(int position);
136  void factoryItemDeleted(int position);
137  void factoryItemAltered(int position);
138  void factoryUpdated();
139 
140 private:
141  class Private;
142  Private * const d;
143 
144  friend class CustomListView;
145 };
146 
151 class LANCELOT_EXPORT CustomListView: public Lancelot::ScrollPane {
152  Q_OBJECT
153 public:
154  CustomListView(QGraphicsItem * parent = NULL);
155  explicit CustomListView(CustomListItemFactory * factory,
156  QGraphicsItem * parent = NULL);
157 
158  virtual ~CustomListView();
159 
160  CustomList * list() const;
161 
162 protected:
163  L_Override QSizeF sizeHint(Qt::SizeHint which,
164  const QSizeF & constraint = QSizeF()) const;
165 
166 private:
167  class Private;
168  Private * const d;
169 };
170 
171 } // namespace Lancelot
172 
173 #endif /* LANCELOT_CUSTOM_LIST_VIEW_H */
174 
Lancelot::CustomList
Class that does the layouting of items in the list.
Definition: CustomListView.h:110
Lancelot::CustomListItem
All classes that are going to be used in the CustomList must subclass this and QGraphicsWidget.
Definition: CustomListView.h:37
QObject
L_Override
#define L_Override
Definition: lancelot_export.h:41
lancelot_export.h
LANCELOT_EXPORT
#define LANCELOT_EXPORT
Definition: lancelot_export.h:32
Lancelot::CustomListView
Wrapper around the CustomList which implements the actual scrolling.
Definition: CustomListView.h:151
Lancelot::ScrollPane
Pane for containing scrollable items.
Definition: ScrollPane.h:94
Lancelot::Scrollable
Interface for items that support scrolling.
Definition: ScrollPane.h:34
Widget.h
ExtenderButton.h
Lancelot::CustomListItemFactory
Interface that manages the list model and serves as an interface between the actual data model and Cu...
Definition: CustomListView.h:53
ScrollPane.h
QGraphicsWidget
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Mon Oct 13 2014 22:55:07 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

liblancelot

Skip menu "liblancelot"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeplasma-addons API Reference

Skip menu "kdeplasma-addons API Reference"
  •     GroupingDesktop
  •   liblancelot

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal