Trait rg3d_ui::Control[][src]

pub trait Control<M, C>: 'static + Deref<Target = Widget<M, C>> + DerefMut + Clone where
    M: MessageData,
    C: Control<M, C>, 
{ fn handle_routed_message(
        &mut self,
        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: Vector2<f32>
    ) -> Vector2<f32> { ... }
fn arrange_override(
        &self,
        ui: &UserInterface<M, C>,
        final_size: Vector2<f32>
    ) -> Vector2<f32> { ... }
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: Vector2<f32>) { ... }
fn draw(&self, _drawing_context: &mut DrawingContext) { ... }
fn update(&mut self, _dt: f32) { ... }
fn preview_message(
        &self,
        _ui: &UserInterface<M, C>,
        _message: &mut UiMessage<M, C>
    ) { ... }
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 library.

Required methods

fn handle_routed_message(
    &mut self,
    ui: &mut UserInterface<M, C>,
    message: &mut UiMessage<M, C>
)
[src]

Performs event-specific actions. Must call widget.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>)[src]

fn measure_override(
    &self,
    ui: &UserInterface<M, C>,
    available_size: Vector2<f32>
) -> Vector2<f32>
[src]

fn arrange_override(
    &self,
    ui: &UserInterface<M, C>,
    final_size: Vector2<f32>
) -> Vector2<f32>
[src]

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

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

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

fn measure(&self, ui: &UserInterface<M, C>, available_size: Vector2<f32>)[src]

fn draw(&self, _drawing_context: &mut DrawingContext)[src]

fn update(&mut self, _dt: f32)[src]

fn preview_message(
    &self,
    _ui: &UserInterface<M, C>,
    _message: &mut UiMessage<M, C>
)
[src]

Used to react to a message (by producing another message) that was posted outside of current hierarchy. In other words this method is used when you need to “peek” a message before it’ll be passed into bubbling router. Most common use case is to catch messages from popups: popup in 99.9% cases is a child of root canvas and it won’t receive a message from a its logical parent during bubbling message routing. For example preview_message used in a dropdown list: dropdown list has two separate parts - a field with selected value and a popup for all possible options. Visual parent of the popup in this case is the root canvas, but logical parent is the dropdown list. Because of this fact, the field won’t receive any messages from popup, to solve this we use preview_message. This method is much more restrictive - it does not allow you to modify a node and ui, you can either request changes by sending a message or use internal mutability (Cell, RefCell, etc).

Important notes

The order of execution of this method is undefined! There is no guarantee that it will be called hierarchically as widgets connected.

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

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>>)[src]

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: MessageData, C: Control<M, C>> Control<M, C> for UINode<M, C>[src]

impl<M: MessageData, C: Control<M, C>> Control<M, C> for Border<M, C>[src]

impl<M: MessageData, C: Control<M, C>> Control<M, C> for Button<M, C>[src]

impl<M: MessageData, C: Control<M, C>> Control<M, C> for Canvas<M, C>[src]

impl<M: MessageData, C: Control<M, C>> Control<M, C> for CheckBox<M, C>[src]

impl<M: MessageData, C: Control<M, C>> Control<M, C> for AlphaBar<M, C>[src]

impl<M: MessageData, C: Control<M, C>> Control<M, C> for ColorField<M, C>[src]

impl<M: MessageData, C: Control<M, C>> Control<M, C> for ColorPicker<M, C>[src]

impl<M: MessageData, C: Control<M, C>> Control<M, C> for HueBar<M, C>[src]

impl<M: MessageData, C: Control<M, C>> Control<M, C> for SaturationBrightnessField<M, C>[src]

impl<M: MessageData, C: Control<M, C>> Control<M, C> for Decorator<M, C>[src]

impl<M: MessageData, C: Control<M, C>> Control<M, C> for DockingManager<M, C>[src]

impl<M: MessageData, C: Control<M, C>> Control<M, C> for Tile<M, C>[src]

impl<M: MessageData, C: Control<M, C>> Control<M, C> for DropdownList<M, C>[src]

impl<M: MessageData, C: Control<M, C>> Control<M, C> for Expander<M, C>[src]

impl<M: MessageData, C: Control<M, C>> Control<M, C> for FileBrowser<M, C>[src]

impl<M: MessageData, C: Control<M, C>> Control<M, C> for FileSelector<M, C>[src]

impl<M: MessageData, C: Control<M, C>> Control<M, C> for Grid<M, C>[src]

impl<M: MessageData, C: Control<M, C>> Control<M, C> for Image<M, C>[src]

impl<M: MessageData, C: Control<M, C>> Control<M, C> for ListView<M, C>[src]

impl<M: MessageData, C: Control<M, C>> Control<M, C> for ListViewItem<M, C>[src]

impl<M: MessageData, C: Control<M, C>> Control<M, C> for Menu<M, C>[src]

impl<M: MessageData, C: Control<M, C>> Control<M, C> for MenuItem<M, C>[src]

impl<M: MessageData, C: Control<M, C>> Control<M, C> for MessageBox<M, C>[src]

impl<M: MessageData, C: Control<M, C>> Control<M, C> for NumericUpDown<M, C>[src]

impl<M: MessageData, C: Control<M, C>> Control<M, C> for Popup<M, C>[src]

impl<M: MessageData, C: Control<M, C>> Control<M, C> for ProgressBar<M, C>[src]

impl<M: MessageData, C: Control<M, C>> Control<M, C> for ScrollBar<M, C>[src]

impl<M: MessageData, C: Control<M, C>> Control<M, C> for ScrollPanel<M, C>[src]

impl<M: MessageData, C: Control<M, C>> Control<M, C> for ScrollViewer<M, C>[src]

impl<M: MessageData, C: Control<M, C>> Control<M, C> for StackPanel<M, C>[src]

impl<M: MessageData, C: Control<M, C>> Control<M, C> for TabControl<M, C>[src]

impl<M: MessageData, C: Control<M, C>> Control<M, C> for Text<M, C>[src]

impl<M: MessageData, C: Control<M, C>> Control<M, C> for TextBox<M, C>[src]

impl<M: MessageData, C: Control<M, C>> Control<M, C> for Tree<M, C>[src]

impl<M: MessageData, C: Control<M, C>> Control<M, C> for TreeRoot<M, C>[src]

impl<M: MessageData, C: Control<M, C>> Control<M, C> for Vec3Editor<M, C>[src]

impl<M: MessageData, C: Control<M, C>> Control<M, C> for VectorImage<M, C>[src]

impl<M: MessageData, C: Control<M, C>> Control<M, C> for Window<M, C>[src]

impl<M: MessageData, C: Control<M, C>> Control<M, C> for WrapPanel<M, C>[src]

Loading content...