Skip to main content

TestingWindow

Struct TestingWindow 

Source
pub struct TestingWindow {
    pub ime_requests: RefCell<Vec<InputMethodRequest>>,
    pub open_url: Rc<RefCell<Option<SharedString>>>,
    pub debug_logs: Rc<RefCell<Vec<String>>>,
    /* private fields */
}

Fields§

§ime_requests: RefCell<Vec<InputMethodRequest>>§open_url: Rc<RefCell<Option<SharedString>>>§debug_logs: Rc<RefCell<Vec<String>>>

Implementations§

Source§

impl TestingWindow

Source

pub fn use_native_popup(&self, native: bool)

Source

pub fn mouse_cursor(&self) -> MouseCursor

Source

pub fn open_url(&self) -> Option<SharedString>

Source

pub fn take_debug_log(&self) -> Vec<String>

Drain and return all debug_log messages captured since the last call.

Trait Implementations§

Source§

impl RendererSealed for TestingWindow

Source§

fn text_size( &self, text_item: Pin<&dyn RenderString>, item_rc: &ItemRc, max_width: Option<LogicalLength>, text_wrap: TextWrap, ) -> LogicalSize

Returns the size of the given text in logical pixels. When set, max_width means that one need to wrap the text, so it does not go further than that, using the wrapping type passed by text_wrap.
Source§

fn char_size( &self, text_item: Pin<&dyn HasFont>, item_rc: &ItemRc, ch: char, ) -> LogicalSize

Returns the size of the individual character in logical pixels.
Source§

fn font_metrics(&self, font_request: FontRequest) -> FontMetrics

Returns the metrics of the given font.
Source§

fn text_input_byte_offset_for_position( &self, text_input: Pin<&TextInput>, item_rc: &ItemRc, pos: LogicalPoint, ) -> usize

Returns the (UTF-8) byte offset in the text property that refers to the character that contributed to the glyph cluster that’s visually nearest to the given coordinate. This is used for hit-testing, for example when receiving a mouse click into a text field. Then this function returns the “cursor” position.
Source§

fn text_input_cursor_rect_for_byte_offset( &self, text_input: Pin<&TextInput>, item_rc: &ItemRc, byte_offset: usize, ) -> LogicalRect

That’s the opposite of Self::text_input_byte_offset_for_position It takes a (UTF-8) byte offset in the text property, and returns a Rectangle left to the char. It is one logical pixel wide and ends at the baseline.
Source§

fn register_font_from_memory( &self, data: &'static [u8], ) -> Result<(), Box<dyn Error>>

This function can be used to register a custom TrueType font with Slint, for use with the font-family property. The provided slice must be a valid TrueType font.
Source§

fn register_font_from_path(&self, path: &Path) -> Result<(), Box<dyn Error>>

This function can be used to register a custom TrueType font with Slint, for use with the font-family property. The provided path must refer to a valid TrueType font.
Source§

fn set_window_adapter(&self, _window_adapter: &Rc<dyn WindowAdapter>)

Source§

fn window_adapter(&self) -> Option<Rc<dyn WindowAdapter>>

Source§

fn supports_transformations(&self) -> bool

Whether the renderer supports transformations such as rotations and scaling or not.
Source§

fn free_graphics_resources( &self, _component: VRef<'_, ItemTreeVTable>, _items: &mut dyn Iterator<Item = Pin<VRef<'_, ItemVTable>>>, ) -> Result<(), PlatformError>

Clear the caches for the items that are being removed
Source§

fn mark_dirty_region(&self, _region: DirtyRegion)

Mark a given region as dirty regardless whether the items actually are dirty. Read more
Source§

fn register_bitmap_font(&self, _font_data: &'static BitmapFont)

Source§

fn set_rendering_notifier( &self, _callback: Box<dyn RenderingNotifier>, ) -> Result<(), SetRenderingNotifierError>

This function is called through the public API to register a callback that the backend needs to invoke during different phases of rendering.
Source§

fn scale_factor(&self) -> Option<Scale<f32, LogicalPx, PhysicalPx>>

Source§

fn slint_context(&self) -> Option<SlintContext>

Source§

fn resize(&self, _size: PhysicalSize) -> Result<(), PlatformError>

Source§

fn take_snapshot(&self) -> Result<SharedPixelBuffer<Rgba<u8>>, PlatformError>

Re-implement this function to support Window::take_snapshot(), i.e. return the contents of the window in an image buffer.
Source§

impl WindowAdapter for TestingWindow

Source§

fn window(&self) -> &Window

Returns the window API.
Source§

fn size(&self) -> PhysicalSize

Return the size of the Window on the screen
Source§

fn set_size(&self, size: WindowSize)

Request a new size for the window to the specified size on the screen, in physical or logical pixels and excluding a window frame (if present). Read more
Source§

fn renderer(&self) -> &dyn Renderer

Return the renderer. Read more
Source§

fn update_window_properties(&self, properties: WindowProperties<'_>)

Re-implement this function to update the properties such as window title or layout constraints. Read more
Source§

fn set_visible(&self, _visible: bool) -> Result<(), PlatformError>

Show the window if the argument is true, hide otherwise.
Source§

fn position(&self) -> Option<PhysicalPosition>

Returns the position of the window on the screen, in physical screen coordinates and including a window frame (if present). Read more
Source§

fn set_position(&self, _position: WindowPosition)

Sets the position of the window on the screen, in physical screen coordinates and including a window frame (if present). Read more
Source§

fn request_redraw(&self)

Issues a request to the windowing system to re-render the contents of the window. Read more

Auto Trait Implementations§

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> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Renderer for T
where T: RendererSealed,

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.