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 #include <unity/scopes/FilterGroup.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 class ValueSliderLabels;
38 
46 class UNITY_API ValueSliderFilter : public FilterBase
47 {
48 public:
50  UNITY_DEFINES_PTRS(ValueSliderFilter);
52 
66  static ValueSliderFilter::UPtr create(std::string const& id, double min, double max, double default_value, ValueSliderLabels const& value_labels);
67 
82  static ValueSliderFilter::UPtr create(std::string const& id, double min, double max, double default_value, ValueSliderLabels const& value_labels, FilterGroup::SCPtr const& group);
83 
92  void set_default_value(double val);
93 
102  double default_value() const;
103 
109  double min() const;
110 
116  double max() const;
117 
123  bool has_value(FilterState const& filter_state) const;
124 
130  double value(FilterState const& filter_state) const;
131 
137  ValueSliderLabels const& labels() const;
138 
146  void update_state(FilterState& filter_state, double value) const;
147 
154  static void update_state(FilterState& filter_state, std::string const& filter_id, double value);
155 
156 private:
157  ValueSliderFilter(internal::ValueSliderFilterImpl*);
158  internal::ValueSliderFilterImpl* fwd() const;
159  friend class internal::ValueSliderFilterImpl;
160 };
161 
162 } // namespace scopes
163 
164 } // namespace unity
A value slider filter that allows for selecting a value within a given range.
Definition: ValueSliderFilter.h:46
Base class for all implementations of filters.
Definition: FilterBase.h:47
Top-level namespace for all things Unity-related.
Definition: Version.h:49
Definition: ActionMetadata.h:31
Stores the state of multiple filters.
Definition: FilterState.h:46
Labels used by a ValueSliderFilter.
Definition: ValueSliderLabels.h:56