Unity Scopes API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
unity::scopes::RadioButtonsFilter Class Reference

A filter that displays mutually exclusive list of options. More...

#include <unity/scopes/RadioButtonsFilter.h>

Inheritance diagram for unity::scopes::RadioButtonsFilter:

Public Member Functions

FilterOption::SCPtr add_option (std::string const &id, std::string const &label)
 Adds a new option to the filter. More...
 
std::string label () const
 Get the label of this filter. More...
 
FilterOption::SCPtr active_option (FilterState const &filter_state) const
 Get active option from an instance of FilterState for this filter. More...
 
bool has_active_option (FilterState const &filter_state) const
 Check if active options. More...
 
std::list< FilterOption::SCPtr > options () const
 Get all options of this filter, in the order they were added. 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 RadioButtonsFilter::UPtr create (std::string const &id, std::string const &label)
 Creates RadioButtonsFilter filter. 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 filter that displays mutually exclusive list of options.

Displays filter with a set of options and allows only one option to be selected at a time.

Member Function Documentation

FilterOption::SCPtr unity::scopes::RadioButtonsFilter::active_option ( FilterState const &  filter_state) const

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

Returns
The active option or nullptr if no option is active.
FilterOption::SCPtr unity::scopes::RadioButtonsFilter::add_option ( std::string const &  id,
std::string const &  label 
)

Adds a new option to the filter.

Parameters
idA unique identifier of the option.
labelA display label for the option
Returns
Instance of FilterOption
RadioButtonsFilter::UPtr unity::scopes::RadioButtonsFilter::create ( std::string const &  id,
std::string const &  label 
)
static

Creates RadioButtonsFilter filter.

Creates an empty RadioButtonsFilter filter. Use unity::scopes::RadioButtonsFilter::add_option() to add options to it.

Parameters
idA unique identifier for the filter that can be used to identify it later among several filters.
labelA display label for this filter
Returns
Instance of RadioButtonsFilter
bool unity::scopes::RadioButtonsFilter::has_active_option ( FilterState const &  filter_state) const

Check if active options.

Parameters
filter_stateThe state of filters
Returns
true if there is at least one option active
std::string unity::scopes::RadioButtonsFilter::label ( ) const

Get the label of this filter.

Returns
The filter label.
std::list< FilterOption::SCPtr > unity::scopes::RadioButtonsFilter::options ( ) const

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

Returns
The list of options.
void unity::scopes::RadioButtonsFilter::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). Only one option can be active at a time - marking an option active automatically deactivates any other option.

void unity::scopes::RadioButtonsFilter::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: