Trait conrod::CustomWidget
[−]
[src]
pub trait CustomWidget: Clone + Debug {
type State: State;
fn update<C>(self, prev: Self::State, ui_id: UiId, ui: &mut Ui<C, Self>) -> Update<Self::State> where C: CharacterCache;
fn set<C>(self, ui_id: UiId, ui: &mut Ui<C, Self>) where C: CharacterCache { ... }
}A trait to be implemented for Custom widget types.
If you think your widget might be useful enough for conrod's official widget library, Feel free to submit a PR at https://github.com/PistonDevelopers/conrod.
Associated Types
type State: State
State to be stored within the Uis widget cache.
Required Methods
fn update<C>(self, prev: Self::State, ui_id: UiId, ui: &mut Ui<C, Self>) -> Update<Self::State> where C: CharacterCache
This is the method you have to implement! Your widget's previous state is given to you as a parameter and it is your job to construct and return an Update that will be used to update the widget's cached state.
Provided Methods
fn set<C>(self, ui_id: UiId, ui: &mut Ui<C, Self>) where C: CharacterCache
After building the widget, we use this method to set its current state into the given Ui.
The Ui will cache this state and use it for rendering the next time ui.draw(graphics)
is called.