Unity Scopes API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Category.h
1 /*
2  * Copyright (C) 2013 Canonical Ltd
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License version 3 as
6  * published by the Free Software Foundation.
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 Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Pawel Stolowski <pawel.stolowski@canonical.com>
17  */
18 
19 #ifndef UNITY_SCOPES_CATEGORY_H
20 #define UNITY_SCOPES_CATEGORY_H
21 
22 #include <unity/util/NonCopyable.h>
23 #include <unity/util/DefinesPtrs.h>
24 #include <unity/scopes/Variant.h>
25 #include <unity/scopes/CannedQuery.h>
26 #include <string>
27 #include <memory>
28 
29 namespace unity
30 {
31 
32 namespace scopes
33 {
34  class CategoryRenderer;
35 
36 namespace internal
37 {
38  class CategoryImpl;
39  class CategoryRegistry;
40 }
41 
49 class Category
50 {
51 public:
53  NONCOPYABLE(Category);
54  UNITY_DEFINES_PTRS(Category);
55 
56  virtual ~Category();
58 
63  std::string id() const;
64 
69  std::string title() const;
70 
75  std::string icon() const;
76 
81  CannedQuery::SCPtr query() const;
82 
87  CategoryRenderer const& renderer_template() const;
88 
89  // @cond
90  VariantMap serialize() const;
91  // @endcond
92 
93 protected:
95  Category(std::string const& id, std::string const& title,
96  std::string const &icon, CategoryRenderer const& renderer_template);
97  Category(std::string const& id, std::string const& title,
98  std::string const &icon, CannedQuery::SCPtr const& query,
99  CategoryRenderer const& renderer_template);
100  Category(VariantMap const& variant_map);
102 
103  friend class internal::CategoryRegistry;
104 
105 private:
106  std::unique_ptr<internal::CategoryImpl> p;
107 };
108 
109 } // namespace scopes
110 
111 } // namespace unity
112 
113 #endif
std::string icon() const
Get icon of this Category.
A category renderer template in JSON format.
Definition: CategoryRenderer.h:84
std::string title() const
Get title of this Category.
std::string id() const
Get identifier of this Category.
A set of related results returned by a scope and displayed within a single pane in the Unity dash...
Definition: Category.h:49
CategoryRenderer const & renderer_template() const
Get renderer template of this Category.
Top-level namespace for all things Unity-related.
Definition: Version.h:50
std::map< std::string, Variant > VariantMap
A dictionary of (string, Variant) pairs.
Definition: Variant.h:39
Definition: ActionMetadata.h:32
CannedQuery::SCPtr query() const
Query to perform when this category is expanded.