Unity Scopes API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ValueSliderFilter.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 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_VALUESLIDERFILTER_H
20 #define UNITY_SCOPES_VALUESLIDERFILTER_H
21 
22 #include <unity/scopes/FilterBase.h>
23 
24 namespace unity
25 {
26 
27 namespace scopes
28 {
29 
30 class FilterState;
31 
32 namespace internal
33 {
34 class ValueSliderFilterImpl;
35 }
36 
37 namespace experimental
38 {
39 
48 class UNITY_API ValueSliderFilter : public FilterBase
49 {
50 public:
52  UNITY_DEFINES_PTRS(ValueSliderFilter);
54 
64  enum SliderType
65  {
66  LessThan,
67  MoreThan
68  };
69 
83  static ValueSliderFilter::UPtr create(std::string const& id, std::string const& label, std::string const& label_template, double min, double max);
84 
90  void set_slider_type(SliderType tp);
91 
100  void set_default_value(double val);
101 
107  SliderType slider_type() const;
108 
114  double default_value() const;
115 
121  double min() const;
122 
128  double max() const;
129 
135  std::string label() const;
136 
142  std::string value_label_template() const;
143 
149  bool has_value(FilterState const& filter_state) const;
150 
157  double value(FilterState const& filter_state) const;
158 
166  void update_state(FilterState& filter_state, double value) const;
167 
174  static void update_state(FilterState& filter_state, std::string const& filter_id, double value);
175 
176 private:
177  ValueSliderFilter(internal::ValueSliderFilterImpl*);
178  internal::ValueSliderFilterImpl* fwd() const;
179  friend class internal::ValueSliderFilterImpl;
180 };
181 
182 } // namespace experimental
183 
184 } // namespace scopes
185 
186 } // namespace unity
187 
188 #endif
Top-level namespace for all things Unity-related.
Definition: Version.h:50
Definition: ActionMetadata.h:32