Unity Scopes API
|
Defines a layout for preview widgets with given column setup. More...
Public Member Functions | |
ColumnLayout (int num_of_columns) | |
Creates a layout definition that expects num_of_columns columns to be added with ColumnLayout::add_column. More... | |
void | add_column (std::vector< std::string > widget_ids) |
Adds a new column and assigns widgets to it. More... | |
int | size () const noexcept |
Get the current number of columns in this layout. More... | |
int | number_of_columns () const noexcept |
Get the number of columns expected by this layout as specified in the constructor. More... | |
std::vector< std::string > | column (int index) const |
Retrieve the list of widgets for given column. More... | |
Copy and assignment | |
Copy and assignment operators (move and non-move versions) have the usual value semantics. | |
ColumnLayout (ColumnLayout const &other) | |
ColumnLayout (ColumnLayout &&) | |
ColumnLayout & | operator= (ColumnLayout const &other) |
ColumnLayout & | operator= (ColumnLayout &&) |
Defines a layout for preview widgets with given column setup.
ColumnLayout defines how widgets should be laid out on a display with a given number of columns. In typical use cases, a scope creates ColumnLayout instances for all supported displays (number of columns), and defines for every instance what widgets belong to which columns. The shell uses the layout that is most appropriate for the device in use. Column layout definitions are optional. However, we recommend that scopes define layouts for the best visual appearance.
An example of creating two layouts, one for a screen with one column and and one for a screen with two columns.
|
explicit |
Creates a layout definition that expects num_of_columns columns to be added with ColumnLayout::add_column.
num_of_columns | The number of columns for the layout. |
unity::InvalidArgumentException | for an invalid number of columns. |
void unity::scopes::ColumnLayout::add_column | ( | std::vector< std::string > | widget_ids | ) |
Adds a new column and assigns widgets to it.
ColumnLayout expects exactly the number of columns passed to the constructor to be created with the add_column method.
unity::LogicException | if an attempt is made to add more columns than specified in the constructor. |
unity::LogicException | from unity::scopes::PreviewReply::register_layout if a layout has fewer columns than specified in the constructor. |
std::vector< std::string > unity::scopes::ColumnLayout::column | ( | int | index | ) | const |
Retrieve the list of widgets for given column.
index | The index of a column. |
unity::InvalidArgumentException | if the index is invalid. |
|
noexcept |
Get the number of columns expected by this layout as specified in the constructor.
|
noexcept |
Get the current number of columns in this layout.