Unity Scopes API
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 #pragma once
20 
21 #include <unity/scopes/FilterBase.h>
22 
23 namespace unity
24 {
25 
26 namespace scopes
27 {
28 
29 class FilterState;
30 
31 namespace internal
32 {
33 class ValueSliderFilterImpl;
34 }
35 
36 namespace experimental
37 {
38 
47 class UNITY_API ValueSliderFilter : public FilterBase
48 {
49 public:
51  UNITY_DEFINES_PTRS(ValueSliderFilter);
53 
63  enum SliderType
64  {
65  LessThan,
66  MoreThan
67  };
68 
82  static ValueSliderFilter::UPtr create(std::string const& id, std::string const& label, std::string const& label_template, double min, double max);
83 
89  void set_slider_type(SliderType tp);
90 
99  void set_default_value(double val);
100 
106  SliderType slider_type() const;
107 
113  double default_value() const;
114 
120  double min() const;
121 
127  double max() const;
128 
134  std::string label() const;
135 
141  std::string value_label_template() const;
142 
148  bool has_value(FilterState const& filter_state) const;
149 
156  double value(FilterState const& filter_state) const;
157 
165  void update_state(FilterState& filter_state, double value) const;
166 
173  static void update_state(FilterState& filter_state, std::string const& filter_id, double value);
174 
175 private:
176  ValueSliderFilter(internal::ValueSliderFilterImpl*);
177  internal::ValueSliderFilterImpl* fwd() const;
178  friend class internal::ValueSliderFilterImpl;
179 };
180 
181 } // namespace experimental
182 
183 } // namespace scopes
184 
185 } // namespace unity
Top-level namespace for all things Unity-related.
Definition: Version.h:49
Definition: ActionMetadata.h:31