~ubuntu-branches/ubuntu/trusty/kdeplasma-addons/trusty

« back to all changes in this revision

Viewing changes to applets/lancelot/libs/lancelot/models/StandardActionTreeModel.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Thomas
  • Date: 2010-05-25 09:50:14 UTC
  • mfrom: (1.1.28 upstream)
  • Revision ID: james.westby@ubuntu.com-20100525095014-6mlrm9z9bkws0zkt
Tags: 4:4.4.80-0ubuntu1
* New upstream beta release:
  - Bump kde-sc-dev-latest build-dep version to 4.4.80
  - Refresh kubuntu_04_kimpanel_disable_scim.diff
  - Update various .install files
  - Drop liblancelot0a and liblancelot-dev packages; Upstream has broken ABI
    without an .so version bump, and after discussion with Debian it was
    decided it was not worth it to ship an unstable library.
  - Add liblancelot files to plasma-widget-lancelot, adding appropriate
    Replaces: entries
* Switch to source format 3.0 (quilt):
  - Bump debhelper build-depend version to 7.3.16 or greater

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 *   Copyright (C) 2007 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_STANDARD_ACTION_TREE_MODEL_H
21
 
#define LANCELOT_STANDARD_ACTION_TREE_MODEL_H
22
 
 
23
 
#include "ActionTreeModel.h"
24
 
 
25
 
#include <lancelot/lancelot_export.h>
26
 
 
27
 
namespace Lancelot
28
 
{
29
 
 
30
 
class LANCELOT_EXPORT StandardActionTreeModel: public ActionTreeModel {
31
 
protected:
32
 
    /**
33
 
     * This class represents an item in the list model.
34
 
     */
35
 
    class LANCELOT_EXPORT Item {
36
 
    public:
37
 
        explicit Item(QString itemTitle = QString(),
38
 
             QString itemDescription = QString(),
39
 
             QIcon itemIcon = QIcon(),
40
 
             QVariant itemData = QVariant());
41
 
 
42
 
        ~Item();
43
 
 
44
 
        QString title;
45
 
        QString description;
46
 
        QIcon icon;
47
 
        QVariant data;
48
 
 
49
 
        QList < Item * > children;
50
 
    };
51
 
 
52
 
    StandardActionTreeModel(Item * root);
53
 
 
54
 
    Item * root() const;
55
 
    virtual StandardActionTreeModel * createChild(int index) = 0;
56
 
 
57
 
 
58
 
public:
59
 
    StandardActionTreeModel();
60
 
 
61
 
    virtual ~StandardActionTreeModel();
62
 
 
63
 
    // ActionTreeModel
64
 
    L_Override ActionTreeModel * child(int index);
65
 
    L_Override QString selfTitle() const;
66
 
    L_Override QIcon selfIcon()  const;
67
 
 
68
 
    // ActionListModel
69
 
    L_Override QString title(int index) const;
70
 
    L_Override QString description(int index) const;
71
 
    L_Override QIcon icon(int index) const;
72
 
    L_Override bool isCategory(int index) const;
73
 
 
74
 
    L_Override int size() const;
75
 
 
76
 
    QVariant data(int index) const;
77
 
 
78
 
    /**
79
 
     * Adds a new item into the model
80
 
     * @param item new item
81
 
     */
82
 
    void add(Item * item, Item * parent = NULL);
83
 
 
84
 
    /**
85
 
     * Adds a new item into the model
86
 
     * @param title the title for the new item
87
 
     * @param description the description of the new item
88
 
     * @param icon the icon for the new item
89
 
     * @param data data for the new item. Not shown to user
90
 
     */
91
 
    void add(const QString & title, const QString & description,
92
 
            QIcon icon, const QVariant & data, Item * parent = NULL);
93
 
 
94
 
    /**
95
 
     * Replaces existing item at specified index with a new one
96
 
     * @param index index of the item to be replaced
97
 
     * @param item new item
98
 
     */
99
 
    void set(int index, Item * item, Item * parent = NULL);
100
 
 
101
 
    /**
102
 
     * Replaces existing item at specified index with a new one
103
 
     * @param index index of the item to be replaced
104
 
     * @param title the title for the new item
105
 
     * @param description the description of the new item
106
 
     * @param icon the icon for the new item
107
 
     * @param data data for the new item. Not shown to user
108
 
     */
109
 
    void set(int index, const QString & title, const QString & description,
110
 
            QIcon icon, const QVariant & data, Item * parent = NULL);
111
 
 
112
 
    /**
113
 
     * Removes an item
114
 
     * @param index index of the item to remove
115
 
     */
116
 
    void removeAt(int index, Item * parent = NULL);
117
 
 
118
 
    /**
119
 
     * @returns the specified item
120
 
     * @param index index of the item to return
121
 
     */
122
 
    Item * itemAt(int index, Item * parent = NULL);
123
 
 
124
 
    /**
125
 
     * Clears all items
126
 
     */
127
 
    void clear(Item * parent = NULL);
128
 
 
129
 
private:
130
 
    class Private;
131
 
    Private * const d;
132
 
 
133
 
};
134
 
 
135
 
} // namespace Lancelot
136
 
 
137
 
#endif /* LANCELOT_STANDARD_ACTION_TREE_MODEL_H */
138