Unity Scopes API
|
A filter that displays mutually exclusive list of options. More...
#include <unity/scopes/RadioButtonsFilter.h>
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... | |
![]() | |
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 | |
![]() | |
enum | DisplayHints { Default = 0, Primary = 1 } |
Display hints for the Shell UI. More... | |
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.
FilterOption::SCPtr unity::scopes::RadioButtonsFilter::active_option | ( | FilterState const & | filter_state | ) | const |
Get active option from an instance of FilterState for this filter.
FilterOption::SCPtr unity::scopes::RadioButtonsFilter::add_option | ( | std::string const & | id, |
std::string const & | label | ||
) |
Adds a new option to the filter.
id | A unique identifier of the option. |
label | A display label for the option |
|
static |
Creates RadioButtonsFilter filter.
Creates an empty RadioButtonsFilter filter. Use unity::scopes::RadioButtonsFilter::add_option() to add options to it.
id | A unique identifier for the filter that can be used to identify it later among several filters. |
label | A display label for this filter |
bool unity::scopes::RadioButtonsFilter::has_active_option | ( | FilterState const & | filter_state | ) | const |
Check if active options.
filter_state | The state of filters |
std::string unity::scopes::RadioButtonsFilter::label | ( | ) | const |
Get the label of this filter.
std::list< FilterOption::SCPtr > unity::scopes::RadioButtonsFilter::options | ( | ) | const |
Get all options of this filter, in the order they were added.
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.
|
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.