[][src]Trait sixtyfps_corelib::eventloop::GenericWindow

pub trait GenericWindow {
    pub fn set_component(self: Rc<Self>, component: &ComponentRc);
pub fn draw(self: Rc<Self>);
pub fn process_mouse_input(
        self: Rc<Self>,
        pos: PhysicalPosition<f64>,
        what: MouseEventType
    );
pub fn process_key_input(self: Rc<Self>, event: &KeyEvent);
pub fn with_platform_window(&self, callback: &dyn Fn(&Window));
pub fn map_window(self: Rc<Self>, event_loop: &EventLoop);
pub fn unmap_window(self: Rc<Self>);
pub fn request_redraw(&self);
pub fn scale_factor(&self) -> f32;
pub fn set_scale_factor(&self, factor: f32);
pub fn set_width(&self, width: f32);
pub fn set_height(&self, height: f32);
pub fn get_geometry(&self) -> Rect;
pub fn free_graphics_resources<'a>(
        self: Rc<Self>,
        items: &Slice<'a, Pin<ItemRef<'a>>>
    );
pub fn set_cursor_blink_binding(&self, prop: &Property<bool>);
pub fn current_keyboard_modifiers(&self) -> KeyboardModifiers;
pub fn set_current_keyboard_modifiers(&self, modifiers: KeyboardModifiers);
pub fn set_focus_item(self: Rc<Self>, focus_item: &ItemRc);
pub fn set_focus(self: Rc<Self>, have_focus: bool);
pub fn show_popup(&self, popup: &ComponentRc, position: Point);
pub fn close_popup(&self); }

This trait represents the interface that the generated code and the run-time require in order to implement functionality such as device-independent pixels, window resizing and other typicaly windowing system related tasks.

crate::graphics provides an implementation of this trait for use with crate::graphics::GraphicsBackend.

Required methods

pub fn set_component(self: Rc<Self>, component: &ComponentRc)[src]

Associates this window with the specified component. Further event handling and rendering, etc. will be done with that component.

pub fn draw(self: Rc<Self>)[src]

Draw the items of the specified component in the given window.

pub fn process_mouse_input(
    self: Rc<Self>,
    pos: PhysicalPosition<f64>,
    what: MouseEventType
)
[src]

Receive a mouse event and pass it to the items of the component to change their state.

Arguments:

  • pos: The position of the mouse event in window physical coordinates.
  • what: The type of mouse event.
  • component: The SixtyFPS compiled component that provides the tree of items.

pub fn process_key_input(self: Rc<Self>, event: &KeyEvent)[src]

Receive a key event and pass it to the items of the component to change their state.

Arguments:

  • event: The key event received by the windowing system.
  • component: The SixtyFPS compiled component that provides the tree of items.

pub fn with_platform_window(&self, callback: &dyn Fn(&Window))[src]

Calls the callback function with the underlying winit::Window that this GenericWindow backs.

pub fn map_window(self: Rc<Self>, event_loop: &EventLoop)[src]

Requests for the window to be mapped to the screen.

Arguments:

  • event_loop: The event loop used to drive further event handling for this window as it will receive events.
  • component: The component that holds the root item of the scene. If the item is a crate::items::Window, then the width and height properties are read and the values are passed to the windowing system as request for the initial size of the window. Then bindings are installed on these properties to keep them up-to-date with the size as it may be changed by the user or the windowing system in general.

pub fn unmap_window(self: Rc<Self>)[src]

Removes the window from the screen. The window is not destroyed though, it can be show (mapped) again later by calling GenericWindow::map_window.

pub fn request_redraw(&self)[src]

Issue a request to the windowing system to re-render the contents of the window. This is typically an asynchronous request.

pub fn scale_factor(&self) -> f32[src]

Returns the scale factor set on the window, as provided by the windowing system.

pub fn set_scale_factor(&self, factor: f32)[src]

Sets an overriding scale factor for the window. This is typically only used for testing.

pub fn set_width(&self, width: f32)[src]

Sets the size of the window to the specified width. This method is typically called in response to receiving a window resize event from the windowing system.

pub fn set_height(&self, height: f32)[src]

Sets the size of the window to the specified height. This method is typically called in response to receiving a window resize event from the windowing system.

pub fn get_geometry(&self) -> Rect[src]

Returns the geometry of the window

pub fn free_graphics_resources<'a>(
    self: Rc<Self>,
    items: &Slice<'a, Pin<ItemRef<'a>>>
)
[src]

This function is called by the generated code when a component and therefore its tree of items are destroyed. The implementation typically uses this to free the underlying graphics resources cached via crate::graphics::RenderingCache.

Installs a binding on the specified property that's toggled whenever the text cursor is supposed to be visible or not.

pub fn current_keyboard_modifiers(&self) -> KeyboardModifiers[src]

Returns the currently active keyboard notifiers.

pub fn set_current_keyboard_modifiers(&self, modifiers: KeyboardModifiers)[src]

Sets the currently active keyboard notifiers. This is used only for testing or directly from the event loop implementation.

pub fn set_focus_item(self: Rc<Self>, focus_item: &ItemRc)[src]

Sets the focus to the item pointed to by item_ptr. This will remove the focus from any currently focused item.

pub fn set_focus(self: Rc<Self>, have_focus: bool)[src]

Sets the focus on the window to true or false, depending on the have_focus argument. This results in WindowFocusReceived and WindowFocusLost events.

pub fn show_popup(&self, popup: &ComponentRc, position: Point)[src]

Show a popup at the given position

pub fn close_popup(&self)[src]

Close the active popup if any

Loading content...

Implementors

impl<Backend: GraphicsBackend> GenericWindow for GraphicsWindow<Backend>[src]

pub fn current_keyboard_modifiers(&self) -> KeyboardModifiers[src]

Returns the currently active keyboard notifiers.

pub fn set_current_keyboard_modifiers(&self, state: KeyboardModifiers)[src]

Sets the currently active keyboard notifiers. This is used only for testing or directly from the event loop implementation.

Loading content...