Struct livesplit_core::layout::editor::Editor
[−]
[src]
pub struct Editor { /* fields omitted */ }
The Layout Editor allows modifying Layouts while ensuring all the different invariants of the Layout objects are upheld no matter what kind of operations are being applied. It provides the current state of the editor as state objects that can be visualized by any kind of User Interface.
Methods
impl Editor
[src]
impl Editor
[src]
fn new(layout: Layout) -> Result<Self>
[src]
Creates a new Layout Editor that modifies the Layout provided. Creation of the Layout Editor fails when a Layout with no components is provided.
fn close(self) -> Layout
[src]
Closes the Layout Editor and gives back access to the modified Layout. In case you want to implement a Cancel Button, just drop the Layout object you get here.
fn layout_state(&mut self, timer: &Timer) -> LayoutState
[src]
Calculates the layout's state based on the timer provided. You can use this to visualize all of the components of a layout, while it is still being edited by the Layout Editor.
fn select(&mut self, index: usize)
[src]
Selects the component with the given index in order to modify its settings. Only a single component is selected at any given time. You may not provide an invalid index.
fn add_component<C: Into<Component>>(&mut self, component: C)
[src]
Adds the component provided to the end of the layout. The newly added component becomes the selected component.
fn can_remove_component(&self) -> bool
[src]
Checks if the currently selected component can be removed. If there's only one component in the layout, it can't be removed.
fn remove_component(&mut self)
[src]
Removes the currently selected component, unless there's only one component in the layout. The next component becomes the selected component. If there's none, the previous component becomes the selected component instead.
fn can_move_component_up(&self) -> bool
[src]
Checks if the currently selected component can be moved up. If the first component is selected, it can't be moved up.
fn move_component_up(&mut self)
[src]
Moves the selected component up, unless the first component is selected.
fn can_move_component_down(&self) -> bool
[src]
Checks if the currently selected component can be moved down. If the last component is selected, it can't be moved down.
fn move_component_down(&mut self)
[src]
Moves the selected component down, unless the last component is selected.
fn move_component(&mut self, dst_index: usize)
[src]
Moves the selected component to the index provided. You may not provide an invalid index.
fn duplicate_component(&mut self)
[src]
Duplicates the currently selected component. The copy gets placed right after the selected component and becomes the newly selected component.
fn set_component_settings_value(&mut self, index: usize, value: Value)
[src]
Sets a setting's value of the selected component by its setting index to the given value.
Panics
This panics if the type of the value to be set is not compatible with the type of the setting's value. A panic can also occur if the index of the setting provided is out of bounds.
fn set_general_settings_value(&mut self, index: usize, value: Value)
[src]
Sets a setting's value of the general settings by its setting index to the given value.
Panics
This panics if the type of the value to be set is not compatible with the type of the setting's value. A panic can also occur if the index of the setting provided is out of bounds.