My Project
PreviewStackInterface.h
1 /*
2  * Copyright (C) 2014 Canonical, Ltd.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; version 3.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef UNITY_SHELL_SCOPES_PREVIEWSTACKINTERFACE_H
18 #define UNITY_SHELL_SCOPES_PREVIEWSTACKINTERFACE_H
19 
20 #include <unity/SymbolExport.h>
21 
22 #include <QAbstractListModel>
23 
24 namespace unity
25 {
26 namespace shell
27 {
28 namespace scopes
29 {
30 
31 class PreviewModelInterface;
32 
40 class UNITY_API PreviewStackInterface : public QAbstractListModel
41 {
42  Q_OBJECT
43 
44  Q_ENUMS(Roles)
45 
46 
53  Q_PROPERTY(int widgetColumnCount READ widgetColumnCount WRITE setWidgetColumnCount NOTIFY widgetColumnCountChanged)
54 
55 protected:
57  explicit PreviewStackInterface(QObject* parent = 0) : QAbstractListModel(parent) { }
59 
60 public:
64  enum Roles {
65  RolePreviewModel
66  };
67 
74  Q_INVOKABLE virtual unity::shell::scopes::PreviewModelInterface* getPreviewModel(int index) const = 0;
75 
76  // @cond
77  virtual void setWidgetColumnCount(int columnCount) = 0;
78  virtual int widgetColumnCount() const = 0;
79  QHash<int, QByteArray> roleNames() const override
80  {
81  QHash<int, QByteArray> roles;
82  roles[RolePreviewModel] = "previewModel";
83  return roles;
84  }
85  // @endcond
86 
87 Q_SIGNALS:
88  // @cond
89  void widgetColumnCountChanged();
90  // @endcond
91 };
92 
93 }
94 }
95 }
96 
98 
99 #endif
A list of PreviewWidgetModelInterface instances.
Definition: PreviewModelInterface.h:37
Top-level namespace for all things Unity-related.
Definition: Version.h:37
A master model for previews.
Definition: PreviewStackInterface.h:40
Roles
The roles supported by this model.
Definition: PreviewStackInterface.h:64