[][src]Trait rg3d_ui::Control

pub trait Control<M: 'static, C: 'static + Control<M, C>> {
    fn widget(&self) -> &Widget<M, C>;
fn widget_mut(&mut self) -> &mut Widget<M, C>;
fn raw_copy(&self) -> UINode<M, C>;
fn handle_message(
        &mut self,
        self_handle: Handle<UINode<M, C>>,
        ui: &mut UserInterface<M, C>,
        message: &mut UiMessage<M, C>
    ); fn resolve(&mut self, _node_map: &NodeHandleMapping<M, C>) { ... }
fn measure_override(
        &self,
        ui: &UserInterface<M, C>,
        available_size: Vec2
    ) -> Vec2 { ... }
fn arrange_override(
        &self,
        ui: &UserInterface<M, C>,
        final_size: Vec2
    ) -> Vec2 { ... }
fn arrange(&self, ui: &UserInterface<M, C>, final_rect: &Rect<f32>) { ... }
fn is_measure_valid(&self, ui: &UserInterface<M, C>) -> bool { ... }
fn is_arrange_valid(&self, ui: &UserInterface<M, C>) -> bool { ... }
fn measure(&self, ui: &UserInterface<M, C>, available_size: Vec2) { ... }
fn draw(&self, _drawing_context: &mut DrawingContext) { ... }
fn update(&mut self, _dt: f32) { ... }
fn handle_os_event(
        &mut self,
        _self_handle: Handle<UINode<M, C>>,
        _ui: &mut UserInterface<M, C>,
        _event: &OsEvent
    ) { ... }
fn remove_ref(&mut self, _handle: Handle<UINode<M, C>>) { ... } }

Trait for all UI controls in engine.

Control must provide at least references (shared and mutable) to inner widget, which means that any control must be based on widget struct. Any other methods will be auto-implemented.

Required methods

fn widget(&self) -> &Widget<M, C>

fn widget_mut(&mut self) -> &mut Widget<M, C>

fn raw_copy(&self) -> UINode<M, C>

fn handle_message(
    &mut self,
    self_handle: Handle<UINode<M, C>>,
    ui: &mut UserInterface<M, C>,
    message: &mut UiMessage<M, C>
)

Performs event-specific actions. Must call widget_mut().handle_message()!

Notes

Do not try to borrow node by self_handle in UI - at this moment node has been moved out of pool and attempt of borrowing will cause panic! self_handle should be used only to check if event came from/for this node or to capture input on node.

Loading content...

Provided methods

fn resolve(&mut self, _node_map: &NodeHandleMapping<M, C>)

fn measure_override(
    &self,
    ui: &UserInterface<M, C>,
    available_size: Vec2
) -> Vec2

fn arrange_override(&self, ui: &UserInterface<M, C>, final_size: Vec2) -> Vec2

fn arrange(&self, ui: &UserInterface<M, C>, final_rect: &Rect<f32>)

fn is_measure_valid(&self, ui: &UserInterface<M, C>) -> bool

fn is_arrange_valid(&self, ui: &UserInterface<M, C>) -> bool

fn measure(&self, ui: &UserInterface<M, C>, available_size: Vec2)

fn draw(&self, _drawing_context: &mut DrawingContext)

fn update(&mut self, _dt: f32)

fn handle_os_event(
    &mut self,
    _self_handle: Handle<UINode<M, C>>,
    _ui: &mut UserInterface<M, C>,
    _event: &OsEvent
)

Provides a way to respond to OS specific events. Can be useful to detect if a key or mouse button was pressed. This method significantly differs from handle_message because os events are not dispatched - they'll be passed to this method in any case.

fn remove_ref(&mut self, _handle: Handle<UINode<M, C>>)

Called when a node is deleted from container thus giving a chance to remove dangling handles which may cause panic.

Loading content...

Implementors

impl Control<(), StubNode> for StubNode[src]

impl<M, C: 'static + Control<M, C>> Control<M, C> for UINode<M, C>[src]

impl<M, C: 'static + Control<M, C>> Control<M, C> for Border<M, C>[src]

impl<M, C: 'static + Control<M, C>> Control<M, C> for Button<M, C>[src]

impl<M, C: 'static + Control<M, C>> Control<M, C> for Canvas<M, C>[src]

impl<M, C: 'static + Control<M, C>> Control<M, C> for CheckBox<M, C>[src]

impl<M, C: 'static + Control<M, C>> Control<M, C> for Grid<M, C>[src]

impl<M, C: 'static + Control<M, C>> Control<M, C> for Image<M, C>[src]

impl<M, C: 'static + Control<M, C>> Control<M, C> for ItemContainer<M, C>[src]

impl<M, C: 'static + Control<M, C>> Control<M, C> for ItemsControl<M, C>[src]

impl<M, C: 'static + Control<M, C>> Control<M, C> for ListBox<M, C>[src]

impl<M, C: 'static + Control<M, C>> Control<M, C> for ListBoxItem<M, C>[src]

impl<M, C: 'static + Control<M, C>> Control<M, C> for Popup<M, C>[src]

impl<M, C: 'static + Control<M, C>> Control<M, C> for ProgressBar<M, C>[src]

impl<M, C: 'static + Control<M, C>> Control<M, C> for ScrollBar<M, C>[src]

impl<M, C: 'static + Control<M, C>> Control<M, C> for ScrollContentPresenter<M, C>[src]

impl<M, C: 'static + Control<M, C>> Control<M, C> for ScrollViewer<M, C>[src]

impl<M, C: 'static + Control<M, C>> Control<M, C> for StackPanel<M, C>[src]

impl<M, C: 'static + Control<M, C>> Control<M, C> for TabControl<M, C>[src]

impl<M, C: 'static + Control<M, C>> Control<M, C> for Text<M, C>[src]

impl<M, C: 'static + Control<M, C>> Control<M, C> for TextBox<M, C>[src]

impl<M, C: 'static + Control<M, C>> Control<M, C> for Window<M, C>[src]

impl<M: 'static, C: 'static + Control<M, C>> Control<M, C> for ComboBox<M, C>[src]

impl<M: 'static, C: 'static + Control<M, C>> Control<M, C> for Decorator<M, C>[src]

Loading content...