Skip to main content

TheUI

Struct TheUI 

Source
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>§context_menu: Option<TheContextMenu>§menu_widget_id: Option<TheId>§is_dirty: bool§shift: bool§ctrl: bool§alt: bool§mouse_coord: Vec2<i32>

Implementations§

Source§

impl TheUI

Source

pub fn new() -> TheUI

Source

pub fn init(&mut self, ctx: &mut TheContext)

Source

pub fn add_state_listener(&mut self, name: String) -> Receiver<TheEvent>

Adds a widget state listener of the given name. Returns the Receiver which the app can user to react to widget state changes. An app can add several listeners.

Source

pub fn set_statusbar_name(&mut self, name: String)

Source

pub fn relayout(&mut self, ctx: &mut TheContext)

Source

pub fn focus_widget_supports_text_input(&mut self, ctx: &mut TheContext) -> bool

Returns true if the current focus widget supports text input.

Source

pub fn focus_widget_supports_clipboard(&mut self, ctx: &mut TheContext) -> bool

Returns true if the current focus widget supports clipboard operations.

Source

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.

Source

pub fn cut(&mut self, ctx: &mut TheContext)

Initiate a cut operation on the current focus widget.

Source

pub fn copy(&mut self, ctx: &mut TheContext)

Initiate a copy operation on the current focus widget.

Source

pub fn paste(&mut self, ctx: &mut TheContext)

Initiate a paste operation on the current focus widget.

Source

pub fn undo(&mut self, ctx: &mut TheContext)

Initiate a widget based undo.

Source

pub fn redo(&mut self, ctx: &mut TheContext)

Initiate a widget based redo.

Source

pub fn draw(&mut self, pixels: &mut [u8], ctx: &mut TheContext)

Source

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.

Source

pub fn set_disabled(&mut self, id: &str, ctx: &mut TheContext)

Set the given id as disabled.

Source

pub fn set_enabled(&mut self, id: &str, ctx: &mut TheContext)

Remove the given id from the disabled list.

Source

pub fn update(&mut self, ctx: &mut TheContext) -> bool

Source

pub fn context(&mut self, x: f32, y: f32, ctx: &mut TheContext) -> bool

Source

pub fn touch_down(&mut self, x: f32, y: f32, ctx: &mut TheContext) -> bool

Source

pub fn touch_dragged(&mut self, x: f32, y: f32, ctx: &mut TheContext) -> bool

Source

pub fn touch_up(&mut self, x: f32, y: f32, ctx: &mut TheContext) -> bool

Source

pub fn hover(&mut self, x: f32, y: f32, ctx: &mut TheContext) -> bool

Source

pub fn mouse_wheel(&mut self, delta: (i32, i32), ctx: &mut TheContext) -> bool

Source

pub fn key_down( &mut self, char: Option<char>, key: Option<TheKeyCode>, ctx: &mut TheContext, ) -> bool

Source

pub fn key_up( &mut self, char: Option<char>, key: Option<TheKeyCode>, ctx: &mut TheContext, ) -> bool

Source

pub fn modifier_changed( &mut self, shift: bool, ctrl: bool, alt: bool, logo: bool, ctx: &mut TheContext, ) -> bool

Source

pub fn get_layout_at_coord(&mut self, coord: Vec2<i32>) -> Option<TheId>

Returns the layout at the given position.

Source

pub fn get_widget_at_coord( &mut self, coord: Vec2<i32>, ) -> Option<&mut Box<dyn TheWidget>>

Returns the absolute widget at the given position.

Source

pub fn get_widget_abs( &mut self, name: Option<&String>, uuid: Option<&Uuid>, ) -> Option<&mut Box<dyn TheWidget>>

Source

pub fn get_widget(&mut self, name: &str) -> Option<&mut Box<dyn TheWidget>>

Gets a given widget by name

Source

pub fn get_widget_id(&mut self, id: Uuid) -> Option<&mut Box<dyn TheWidget>>

Gets a given widget by id

Source

pub fn get_text_line_edit( &mut self, name: &str, ) -> Option<&mut dyn TheTextLineEditTrait>

Gets a given text line edit by name

Source

pub fn get_text_area_edit( &mut self, name: &str, ) -> Option<&mut dyn TheTextAreaEditTrait>

Gets a given text area edit by name

Source

pub fn get_icon_view(&mut self, name: &str) -> Option<&mut dyn TheIconViewTrait>

Gets a given icon view by name

Source

pub fn get_menu(&mut self, name: &str) -> Option<&mut dyn TheMenuTrait>

Gets a given menu by name

Source

pub fn get_render_view( &mut self, name: &str, ) -> Option<&mut dyn TheRenderViewTrait>

Gets a given render view by name

Source

pub fn get_text(&mut self, name: &str) -> Option<&mut dyn TheTextTrait>

Gets a given text by name

Source

pub fn get_group_button( &mut self, name: &str, ) -> Option<&mut dyn TheGroupButtonTrait>

Gets a given group button by name

Source

pub fn get_statusbar( &mut self, name: &str, ) -> Option<&mut dyn TheStatusbarTrait>

Gets a given statusbar by name

Source

pub fn get_drop_down_menu( &mut self, name: &str, ) -> Option<&mut dyn TheDropdownMenuTrait>

Gets a given drop down menu by name

Source

pub fn get_time_slider( &mut self, name: &str, ) -> Option<&mut dyn TheTimeSliderTrait>

Gets a given time slider by name

Source

pub fn get_palette_picker( &mut self, name: &str, ) -> Option<&mut dyn ThePalettePickerTrait>

Gets a given palette picker by name

Source

pub fn get_layout(&mut self, name: &str) -> Option<&mut Box<dyn TheLayout>>

Gets a given layout by name

Source

pub fn relayout_layout(&mut self, name: &str, ctx: &mut TheContext)

Relayouts the given layout.

Source

pub fn get_list_layout( &mut self, name: &str, ) -> Option<&mut dyn TheListLayoutTrait>

Gets a given TheListLayout by name

Source

pub fn get_tree_layout( &mut self, name: &str, ) -> Option<&mut dyn TheTreeLayoutTrait>

Gets a given TheTreeLayout by name

Source

pub fn get_rowlist_layout( &mut self, name: &str, ) -> Option<&mut dyn TheRowListLayoutTrait>

Gets a given TheRowListLayout by name

Source

pub fn get_stack_layout( &mut self, name: &str, ) -> Option<&mut dyn TheStackLayoutTrait>

Gets a given TheStackLayout by name

Source

pub fn select_first_list_item(&mut self, name: &str, ctx: &mut TheContext)

Selects the first item of a list layout.

Source

pub fn select_list_item_at( &mut self, name: &str, index: i32, ctx: &mut TheContext, )

Source

pub fn get_rgba_layout( &mut self, name: &str, ) -> Option<&mut dyn TheRGBALayoutTrait>

Gets a given TheRGBALayout by name

Source

pub fn get_sharedhlayout( &mut self, name: &str, ) -> Option<&mut dyn TheSharedHLayoutTrait>

Gets a given TheSharedHLayout by name

Source

pub fn get_sharedvlayout( &mut self, name: &str, ) -> Option<&mut dyn TheSharedVLayoutTrait>

Gets a given TheSharedVLayout by name

Source

pub fn get_hlayout(&mut self, name: &str) -> Option<&mut dyn TheHLayoutTrait>

Gets a given TheHLayout by name

Source

pub fn get_vlayout(&mut self, name: &str) -> Option<&mut dyn TheVLayoutTrait>

Gets a given TheVLayout by name

Source

pub fn get_text_layout( &mut self, name: &str, ) -> Option<&mut dyn TheTextLayoutTrait>

Gets a given TheTextLayout by name

Source

pub fn set_node_canvas(&mut self, name: &str, canvas: TheNodeCanvas)

Sets the nodes for a node canvas.

Source

pub fn set_node_overlay(&mut self, name: &str, overlay: Option<TheRGBABuffer>)

Sets the overlay for the node canvas.

Source

pub fn set_node_preview( &mut self, name: &str, index: usize, buffer: TheRGBABuffer, )

Sets the preview for a node in a node canvas.

Source

pub fn get_node_canvas_view( &mut self, name: &str, ) -> Option<&mut dyn TheNodeCanvasViewTrait>

Gets a given TheNodeCanvasView by name

Source

pub fn set_widget_disabled_state( &mut self, name: &str, ctx: &mut TheContext, disabled: bool, )

Set the disabled state of the given widget.

Source

pub fn set_widget_context_menu( &mut self, name: &str, menu: Option<TheContextMenu>, )

Sets the context menu for the widget.

Source

pub fn get_widget_value(&mut self, name: &str) -> Option<TheValue>

Get the value of the given widget.

Source

pub fn set_widget_value( &mut self, name: &str, ctx: &mut TheContext, value: TheValue, ) -> bool

Set the value of the given widget.

Source

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.

Source

pub fn clear_dialog(&mut self)

Clears / closes the dialog.

Source

pub fn draw_dialog(&mut self, ctx: &mut TheContext)

Draws the current dialog.

Trait Implementations§

Source§

impl Default for TheUI

Source§

fn default() -> TheUI

Returns the “default value” for a type. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> WasmNotSend for T
where T: Send,