Unity Scopes API
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 #pragma once
20 
21 #include <unity/util/NonCopyable.h>
22 #include <unity/util/DefinesPtrs.h>
23 #include <unity/scopes/Variant.h>
24 #include <unity/scopes/CannedQuery.h>
25 #include <string>
26 #include <memory>
27 
28 namespace unity
29 {
30 
31 namespace scopes
32 {
33  class CategoryRenderer;
34 
35 namespace internal
36 {
37  class CategoryImpl;
38  class CategoryRegistry;
39  class SearchReplyImpl;
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  friend class internal::SearchReplyImpl;
105 
106 private:
107  std::unique_ptr<internal::CategoryImpl> p;
108 };
109 
110 } // namespace scopes
111 
112 } // namespace unity
std::string icon() const
Get icon of this Category.
A category renderer template in JSON format.
Definition: CategoryRenderer.h:83
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:49
std::map< std::string, Variant > VariantMap
A dictionary of (string, Variant) pairs.
Definition: Variant.h:38
Definition: ActionMetadata.h:31
CannedQuery::SCPtr query() const
Query to perform when this category is expanded.