Unity Scopes API
unity::scopes::OptionSelectorFilter Class Reference

A selection filter that displays a list of choices and allows one or more of them to be selected. More...

#include <unity/scopes/OptionSelectorFilter.h>

Inheritance diagram for unity::scopes::OptionSelectorFilter:

Public Member Functions

std::string label () const
 Get the label of this filter. More...
 
bool multi_select () const
 Check if this filter supports multiple options to be selected. More...
 
FilterOption::SCPtr add_option (std::string const &id, std::string const &label)
 Add a new option to this filter. More...
 
std::list< FilterOption::SCPtr > options () const
 Get all options of this filter, in the order they were added. More...
 
bool has_active_option (FilterState const &filter_state) const
 Check if an option is active for this filter. More...
 
std::set< FilterOption::SCPtr > active_options (FilterState const &filter_state) const
 Get active options from an instance of FilterState for this filter. More...
 
void update_state (FilterState &filter_state, FilterOption::SCPtr option, bool active) const
 Marks given FilterOption of this filter instance as active (or not active) in a FilterState object. More...
 
- Public Member Functions inherited from unity::scopes::FilterBase
void set_display_hints (int hints)
 Sets display hints for the Shell UI. More...
 
int display_hints () const
 Get display hints of this filter. More...
 
std::string id () const
 Get the identifier of this filter. More...
 
std::string filter_type () const
 Get the type name of this filter. More...
 

Static Public Member Functions

static OptionSelectorFilter::UPtr create (std::string const &id, std::string const &label, bool multi_select=false)
 Creates an OpionSelectorFilter. More...
 
static void update_state (FilterState &filter_state, std::string const &filter_id, std::string const &option_id, bool value)
 Marks an option of a filter active/inactive in a FilterState object, without having an instance of OptionSelectorFilter. More...
 

Additional Inherited Members

- Public Types inherited from unity::scopes::FilterBase
enum  DisplayHints { Default = 0, Primary = 1 }
 Display hints for the Shell UI. More...
 

Detailed Description

A selection filter that displays a list of choices and allows one or more of them to be selected.

Member Function Documentation

std::set< FilterOption::SCPtr > unity::scopes::OptionSelectorFilter::active_options ( FilterState const &  filter_state) const

Get active options from an instance of FilterState for this filter.

Returns
The set of selected filter options.
FilterOption::SCPtr unity::scopes::OptionSelectorFilter::add_option ( std::string const &  id,
std::string const &  label 
)

Add a new option to this filter.

Returns
The new option instance.
OptionSelectorFilter::UPtr unity::scopes::OptionSelectorFilter::create ( std::string const &  id,
std::string const &  label,
bool  multi_select = false 
)
static

Creates an OpionSelectorFilter.

Parameters
idA unique identifier for the filter that can be used to identify it later among several filters.
labelA display label for the filter.
multi_selectIf true, the filter permits more than option to be selected; otherwise, only a single option can be selected.
bool unity::scopes::OptionSelectorFilter::has_active_option ( FilterState const &  filter_state) const

Check if an option is active for this filter.

Parameters
filter_stateThe state of filters
Returns
true if an option is active
std::string unity::scopes::OptionSelectorFilter::label ( ) const

Get the label of this filter.

Returns
The filter label.
bool unity::scopes::OptionSelectorFilter::multi_select ( ) const

Check if this filter supports multiple options to be selected.

Returns
True if multi-selection is enabled.
std::list< FilterOption::SCPtr > unity::scopes::OptionSelectorFilter::options ( ) const

Get all options of this filter, in the order they were added.

Returns
The list of options.
void unity::scopes::OptionSelectorFilter::update_state ( FilterState filter_state,
FilterOption::SCPtr  option,
bool  active 
) const

Marks given FilterOption of this filter instance as active (or not active) in a FilterState object.

Records the given FilterOption as "selected" in the FilterState. This is meant to be used to modify a FilterState received with a search request before sending it back to the client (UI shell).

void unity::scopes::OptionSelectorFilter::update_state ( FilterState filter_state,
std::string const &  filter_id,
std::string const &  option_id,
bool  value 
)
static

Marks an option of a filter active/inactive in a FilterState object, without having an instance of OptionSelectorFilter.

Updates an instance of FilterState, without the need for an OptionSelectorFilter instance. This is meant to be used when creating a canned Query that references another scope.


The documentation for this class was generated from the following files: