~ubuntu-branches/ubuntu/wily/kitemviews/wily-proposed

« back to all changes in this revision

Viewing changes to src/kwidgetitemdelegatepool_p.h

  • Committer: Package Import Robot
  • Author(s): Rohan Garg
  • Date: 2014-07-10 15:49:38 UTC
  • Revision ID: package-import@ubuntu.com-20140710154938-c6kke30uicz0ypvo
Tags: upstream-5.0.0
Import upstream version 5.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
  * This file is part of the KDE project
 
3
  * Copyright (C) 2008 Rafael Fernández López <ereslibre@kde.org>
 
4
  * Copyright (C) 2008 Kevin Ottens <ervin@kde.org>
 
5
  *
 
6
  * This library is free software; you can redistribute it and/or
 
7
  * modify it under the terms of the GNU Library General Public
 
8
  * License as published by the Free Software Foundation; either
 
9
  * version 2 of the License, or (at your option) any later version.
 
10
  *
 
11
  * This library is distributed in the hope that it will be useful,
 
12
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
14
  * Library General Public License for more details.
 
15
  *
 
16
  * You should have received a copy of the GNU Library General Public License
 
17
  * along with this library; see the file COPYING.LIB.  If not, write to
 
18
  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
19
  * Boston, MA 02110-1301, USA.
 
20
  */
 
21
 
 
22
#ifndef KWIDGETITEMDELEGATEPOOL_P_H
 
23
#define KWIDGETITEMDELEGATEPOOL_P_H
 
24
 
 
25
#include <QtCore/QModelIndex>
 
26
#include <QtCore/QHash>
 
27
#include <QtCore/QList>
 
28
 
 
29
class QWidget;
 
30
class QStyleOptionViewItem;
 
31
class KWidgetItemDelegate;
 
32
class KWidgetItemDelegatePoolPrivate;
 
33
 
 
34
/**
 
35
  * @internal
 
36
  */
 
37
class KWidgetItemDelegatePool
 
38
{
 
39
public:
 
40
    enum UpdateWidgetsEnum {
 
41
        UpdateWidgets = 0,
 
42
        NotUpdateWidgets
 
43
    };
 
44
 
 
45
    /**
 
46
      * Creates a new ItemDelegatePool.
 
47
      *
 
48
      * @param delegate the ItemDelegate for this pool.
 
49
      */
 
50
 
 
51
    KWidgetItemDelegatePool(KWidgetItemDelegate *delegate);
 
52
 
 
53
    /**
 
54
      * Destroys an ItemDelegatePool.
 
55
      */
 
56
    ~KWidgetItemDelegatePool();
 
57
 
 
58
    /**
 
59
      * @brief Returns the widget associated to @p index and @p widget
 
60
      * @param index The index to search into.
 
61
      * @param option a QStyleOptionViewItem.
 
62
      * @return A QList of the pointers to the widgets found.
 
63
      * @internal
 
64
      */
 
65
    QList<QWidget *> findWidgets(const QPersistentModelIndex &index, const QStyleOptionViewItem &option,
 
66
                                 UpdateWidgetsEnum updateWidgets = UpdateWidgets) const;
 
67
 
 
68
    /**
 
69
      * @internal
 
70
      */
 
71
    QList<QWidget *> invalidIndexesWidgets() const;
 
72
 
 
73
    /**
 
74
      * @internal
 
75
      */
 
76
    void fullClear();
 
77
 
 
78
private:
 
79
    friend class KWidgetItemDelegate;
 
80
    friend class KWidgetItemDelegatePrivate;
 
81
    KWidgetItemDelegatePoolPrivate *const d;
 
82
};
 
83
 
 
84
class KWidgetItemDelegateEventListener;
 
85
 
 
86
/**
 
87
  * @internal
 
88
  */
 
89
class KWidgetItemDelegatePoolPrivate
 
90
{
 
91
public:
 
92
 
 
93
    KWidgetItemDelegatePoolPrivate(KWidgetItemDelegate *d);
 
94
 
 
95
    KWidgetItemDelegate *delegate;
 
96
    KWidgetItemDelegateEventListener *eventListener;
 
97
 
 
98
    QList<QList<QWidget *> > allocatedWidgets;
 
99
    QHash<QPersistentModelIndex, QList<QWidget *> > usedWidgets;
 
100
    QHash<QWidget *, QPersistentModelIndex> widgetInIndex;
 
101
 
 
102
    bool clearing;
 
103
};
 
104
 
 
105
#endif