pub struct TheUI {
pub canvas: TheCanvas,
pub dialog_text: String,
pub dialog: Option<TheCanvas>,
pub style: Box<dyn TheStyle>,
pub context_menu: Option<TheContextMenu>,
pub menu_widget_id: Option<TheId>,
pub is_dirty: bool,
pub shift: bool,
pub ctrl: bool,
pub alt: bool,
pub logo: bool,
pub mouse_coord: Vec2<i32>,
/* private fields */
}Fields§
§canvas: TheCanvas§dialog_text: String§dialog: Option<TheCanvas>§style: Box<dyn TheStyle>§is_dirty: bool§shift: bool§ctrl: bool§alt: bool§logo: bool§mouse_coord: Vec2<i32>Implementations§
Source§impl TheUI
impl TheUI
pub fn new() -> TheUI
pub fn init(&mut self, ctx: &mut TheContext)
Sourcepub fn add_state_listener(&mut self, name: String) -> Receiver<TheEvent>
pub fn add_state_listener(&mut self, name: String) -> Receiver<TheEvent>
Adds a widget state listener of the given name. Returns the Receiver
pub fn set_statusbar_name(&mut self, name: String)
pub fn relayout(&mut self, ctx: &mut TheContext)
Sourcepub fn focus_widget_supports_text_input(&mut self, ctx: &mut TheContext) -> bool
pub fn focus_widget_supports_text_input(&mut self, ctx: &mut TheContext) -> bool
Returns true if the current focus widget supports text input.
Sourcepub fn focus_widget_supports_clipboard(&mut self, ctx: &mut TheContext) -> bool
pub fn focus_widget_supports_clipboard(&mut self, ctx: &mut TheContext) -> bool
Returns true if the current focus widget supports clipboard operations.
Sourcepub fn focus_widget_supports_undo_redo(&mut self, ctx: &mut TheContext) -> bool
pub fn focus_widget_supports_undo_redo(&mut self, ctx: &mut TheContext) -> bool
Returns true if the current focus widget supports internal undo / redo operations.
Sourcepub fn cut(&mut self, ctx: &mut TheContext)
pub fn cut(&mut self, ctx: &mut TheContext)
Initiate a cut operation on the current focus widget.
Sourcepub fn copy(&mut self, ctx: &mut TheContext)
pub fn copy(&mut self, ctx: &mut TheContext)
Initiate a copy operation on the current focus widget.
Sourcepub fn paste(&mut self, ctx: &mut TheContext)
pub fn paste(&mut self, ctx: &mut TheContext)
Initiate a paste operation on the current focus widget.
Sourcepub fn undo(&mut self, ctx: &mut TheContext)
pub fn undo(&mut self, ctx: &mut TheContext)
Initiate a widget based undo.
Sourcepub fn redo(&mut self, ctx: &mut TheContext)
pub fn redo(&mut self, ctx: &mut TheContext)
Initiate a widget based redo.
pub fn draw(&mut self, pixels: &mut [u8], ctx: &mut TheContext)
Sourcepub fn process_events(&mut self, ctx: &mut TheContext)
pub fn process_events(&mut self, ctx: &mut TheContext)
Processes widget state events, these are mostly send from TheUIContext based on state changes provided by the widgets.
Sourcepub fn set_disabled(&mut self, id: &str, ctx: &mut TheContext)
pub fn set_disabled(&mut self, id: &str, ctx: &mut TheContext)
Set the given id as disabled.
Sourcepub fn set_enabled(&mut self, id: &str, ctx: &mut TheContext)
pub fn set_enabled(&mut self, id: &str, ctx: &mut TheContext)
Remove the given id from the disabled list.
pub fn update(&mut self, ctx: &mut TheContext) -> bool
pub fn context(&mut self, x: f32, y: f32, ctx: &mut TheContext) -> bool
pub fn touch_down(&mut self, x: f32, y: f32, ctx: &mut TheContext) -> bool
pub fn touch_dragged(&mut self, x: f32, y: f32, ctx: &mut TheContext) -> bool
pub fn touch_up(&mut self, x: f32, y: f32, ctx: &mut TheContext) -> bool
pub fn hover(&mut self, x: f32, y: f32, ctx: &mut TheContext) -> bool
pub fn mouse_wheel(&mut self, delta: (i32, i32), ctx: &mut TheContext) -> bool
pub fn key_down( &mut self, char: Option<char>, key: Option<TheKeyCode>, ctx: &mut TheContext, ) -> bool
pub fn key_up( &mut self, char: Option<char>, key: Option<TheKeyCode>, ctx: &mut TheContext, ) -> bool
pub fn modifier_changed( &mut self, shift: bool, ctrl: bool, alt: bool, logo: bool, ctx: &mut TheContext, ) -> bool
Sourcepub fn get_layout_at_coord(&mut self, coord: Vec2<i32>) -> Option<TheId>
pub fn get_layout_at_coord(&mut self, coord: Vec2<i32>) -> Option<TheId>
Returns the layout at the given position.
Sourcepub fn get_widget_at_coord(
&mut self,
coord: Vec2<i32>,
) -> Option<&mut Box<dyn TheWidget>>
pub fn get_widget_at_coord( &mut self, coord: Vec2<i32>, ) -> Option<&mut Box<dyn TheWidget>>
Returns the absolute widget at the given position.
pub fn get_widget_abs( &mut self, name: Option<&String>, uuid: Option<&Uuid>, ) -> Option<&mut Box<dyn TheWidget>>
Sourcepub fn get_widget(&mut self, name: &str) -> Option<&mut Box<dyn TheWidget>>
pub fn get_widget(&mut self, name: &str) -> Option<&mut Box<dyn TheWidget>>
Gets a given widget by name
Sourcepub fn get_widget_id(&mut self, id: Uuid) -> Option<&mut Box<dyn TheWidget>>
pub fn get_widget_id(&mut self, id: Uuid) -> Option<&mut Box<dyn TheWidget>>
Gets a given widget by id
Sourcepub fn get_text_line_edit(
&mut self,
name: &str,
) -> Option<&mut dyn TheTextLineEditTrait>
pub fn get_text_line_edit( &mut self, name: &str, ) -> Option<&mut dyn TheTextLineEditTrait>
Gets a given text line edit by name
Sourcepub fn get_text_area_edit(
&mut self,
name: &str,
) -> Option<&mut dyn TheTextAreaEditTrait>
pub fn get_text_area_edit( &mut self, name: &str, ) -> Option<&mut dyn TheTextAreaEditTrait>
Gets a given text area edit by name
Sourcepub fn get_icon_view(&mut self, name: &str) -> Option<&mut dyn TheIconViewTrait>
pub fn get_icon_view(&mut self, name: &str) -> Option<&mut dyn TheIconViewTrait>
Gets a given icon view by name
Gets a given menu by name
Sourcepub fn get_render_view(
&mut self,
name: &str,
) -> Option<&mut dyn TheRenderViewTrait>
pub fn get_render_view( &mut self, name: &str, ) -> Option<&mut dyn TheRenderViewTrait>
Gets a given render view by name
Sourcepub fn get_text(&mut self, name: &str) -> Option<&mut dyn TheTextTrait>
pub fn get_text(&mut self, name: &str) -> Option<&mut dyn TheTextTrait>
Gets a given text by name
Gets a given group button by name
Sourcepub fn get_statusbar(
&mut self,
name: &str,
) -> Option<&mut dyn TheStatusbarTrait>
pub fn get_statusbar( &mut self, name: &str, ) -> Option<&mut dyn TheStatusbarTrait>
Gets a given statusbar by name
Gets a given drop down menu by name
Sourcepub fn get_time_slider(
&mut self,
name: &str,
) -> Option<&mut dyn TheTimeSliderTrait>
pub fn get_time_slider( &mut self, name: &str, ) -> Option<&mut dyn TheTimeSliderTrait>
Gets a given time slider by name
Sourcepub fn get_palette_picker(
&mut self,
name: &str,
) -> Option<&mut dyn ThePalettePickerTrait>
pub fn get_palette_picker( &mut self, name: &str, ) -> Option<&mut dyn ThePalettePickerTrait>
Gets a given palette picker by name
Sourcepub fn get_layout(&mut self, name: &str) -> Option<&mut Box<dyn TheLayout>>
pub fn get_layout(&mut self, name: &str) -> Option<&mut Box<dyn TheLayout>>
Gets a given layout by name
Sourcepub fn relayout_layout(&mut self, name: &str, ctx: &mut TheContext)
pub fn relayout_layout(&mut self, name: &str, ctx: &mut TheContext)
Relayouts the given layout.
Sourcepub fn get_list_layout(
&mut self,
name: &str,
) -> Option<&mut dyn TheListLayoutTrait>
pub fn get_list_layout( &mut self, name: &str, ) -> Option<&mut dyn TheListLayoutTrait>
Gets a given TheListLayout by name
Sourcepub fn get_tree_layout(
&mut self,
name: &str,
) -> Option<&mut dyn TheTreeLayoutTrait>
pub fn get_tree_layout( &mut self, name: &str, ) -> Option<&mut dyn TheTreeLayoutTrait>
Gets a given TheTreeLayout by name
Sourcepub fn get_rowlist_layout(
&mut self,
name: &str,
) -> Option<&mut dyn TheRowListLayoutTrait>
pub fn get_rowlist_layout( &mut self, name: &str, ) -> Option<&mut dyn TheRowListLayoutTrait>
Gets a given TheRowListLayout by name
Sourcepub fn get_stack_layout(
&mut self,
name: &str,
) -> Option<&mut dyn TheStackLayoutTrait>
pub fn get_stack_layout( &mut self, name: &str, ) -> Option<&mut dyn TheStackLayoutTrait>
Gets a given TheStackLayout by name
Sourcepub fn select_first_list_item(&mut self, name: &str, ctx: &mut TheContext)
pub fn select_first_list_item(&mut self, name: &str, ctx: &mut TheContext)
Selects the first item of a list layout.
pub fn select_list_item_at( &mut self, name: &str, index: i32, ctx: &mut TheContext, )
Sourcepub fn get_rgba_layout(
&mut self,
name: &str,
) -> Option<&mut dyn TheRGBALayoutTrait>
pub fn get_rgba_layout( &mut self, name: &str, ) -> Option<&mut dyn TheRGBALayoutTrait>
Gets a given TheRGBALayout by name
Gets a given TheSharedHLayout by name
Gets a given TheSharedVLayout by name
Sourcepub fn get_hlayout(&mut self, name: &str) -> Option<&mut dyn TheHLayoutTrait>
pub fn get_hlayout(&mut self, name: &str) -> Option<&mut dyn TheHLayoutTrait>
Gets a given TheHLayout by name
Sourcepub fn get_vlayout(&mut self, name: &str) -> Option<&mut dyn TheVLayoutTrait>
pub fn get_vlayout(&mut self, name: &str) -> Option<&mut dyn TheVLayoutTrait>
Gets a given TheVLayout by name
Sourcepub fn get_text_layout(
&mut self,
name: &str,
) -> Option<&mut dyn TheTextLayoutTrait>
pub fn get_text_layout( &mut self, name: &str, ) -> Option<&mut dyn TheTextLayoutTrait>
Gets a given TheTextLayout by name
Sourcepub fn set_node_canvas(&mut self, name: &str, canvas: TheNodeCanvas)
pub fn set_node_canvas(&mut self, name: &str, canvas: TheNodeCanvas)
Sets the nodes for a node canvas.
Sourcepub fn set_node_overlay(&mut self, name: &str, overlay: Option<TheRGBABuffer>)
pub fn set_node_overlay(&mut self, name: &str, overlay: Option<TheRGBABuffer>)
Sets the overlay for the node canvas.
Sourcepub fn set_node_preview(
&mut self,
name: &str,
index: usize,
buffer: TheRGBABuffer,
)
pub fn set_node_preview( &mut self, name: &str, index: usize, buffer: TheRGBABuffer, )
Sets the preview for a node in a node canvas.
Sourcepub fn get_node_canvas_view(
&mut self,
name: &str,
) -> Option<&mut dyn TheNodeCanvasViewTrait>
pub fn get_node_canvas_view( &mut self, name: &str, ) -> Option<&mut dyn TheNodeCanvasViewTrait>
Gets a given TheNodeCanvasView by name
Sourcepub fn set_widget_disabled_state(
&mut self,
name: &str,
ctx: &mut TheContext,
disabled: bool,
)
pub fn set_widget_disabled_state( &mut self, name: &str, ctx: &mut TheContext, disabled: bool, )
Set the disabled state of the given widget.
Sets the context menu for the widget.
Sourcepub fn get_widget_value(&mut self, name: &str) -> Option<TheValue>
pub fn get_widget_value(&mut self, name: &str) -> Option<TheValue>
Get the value of the given widget.
Sourcepub fn set_widget_value(
&mut self,
name: &str,
ctx: &mut TheContext,
value: TheValue,
) -> bool
pub fn set_widget_value( &mut self, name: &str, ctx: &mut TheContext, value: TheValue, ) -> bool
Set the value of the given widget.
Sourcepub fn show_dialog(
&mut self,
text: &str,
canvas: TheCanvas,
buttons: Vec<TheDialogButtonRole>,
ctx: &mut TheContext,
)
pub fn show_dialog( &mut self, text: &str, canvas: TheCanvas, buttons: Vec<TheDialogButtonRole>, ctx: &mut TheContext, )
Opens a dialog which will have the canvas as context and the given text as title.
Sourcepub fn clear_dialog(&mut self)
pub fn clear_dialog(&mut self)
Clears / closes the dialog.
Sourcepub fn draw_dialog(&mut self, ctx: &mut TheContext)
pub fn draw_dialog(&mut self, ctx: &mut TheContext)
Draws the current dialog.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TheUI
impl !RefUnwindSafe for TheUI
impl Send for TheUI
impl !Sync for TheUI
impl Unpin for TheUI
impl UnsafeUnpin for TheUI
impl !UnwindSafe for TheUI
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.