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
impl TestingWindow
pub fn use_native_popup(&self, native: bool)
pub fn mouse_cursor(&self) -> MouseCursor
pub fn open_url(&self) -> Option<SharedString>
Sourcepub fn take_debug_log(&self) -> Vec<String>
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
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
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
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
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
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
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>>
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>>
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.fn set_window_adapter(&self, _window_adapter: &Rc<dyn WindowAdapter>)
fn window_adapter(&self) -> Option<Rc<dyn WindowAdapter>>
Source§fn supports_transformations(&self) -> bool
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>
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)
fn mark_dirty_region(&self, _region: DirtyRegion)
Mark a given region as dirty regardless whether the items actually are dirty. Read more
fn register_bitmap_font(&self, _font_data: &'static BitmapFont)
Source§fn set_rendering_notifier(
&self,
_callback: Box<dyn RenderingNotifier>,
) -> Result<(), SetRenderingNotifierError>
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.
fn scale_factor(&self) -> Option<Scale<f32, LogicalPx, PhysicalPx>>
fn slint_context(&self) -> Option<SlintContext>
fn resize(&self, _size: PhysicalSize) -> Result<(), PlatformError>
Source§fn take_snapshot(&self) -> Result<SharedPixelBuffer<Rgba<u8>>, PlatformError>
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
impl WindowAdapter for TestingWindow
Source§fn size(&self) -> PhysicalSize
fn size(&self) -> PhysicalSize
Return the size of the Window on the screen
Source§fn set_size(&self, size: WindowSize)
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 update_window_properties(&self, properties: WindowProperties<'_>)
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>
fn set_visible(&self, _visible: bool) -> Result<(), PlatformError>
Show the window if the argument is true, hide otherwise.
Source§fn position(&self) -> Option<PhysicalPosition>
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)
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)
fn request_redraw(&self)
Issues a request to the windowing system to re-render the contents of the window. Read more
Auto Trait Implementations§
impl !Freeze for TestingWindow
impl !RefUnwindSafe for TestingWindow
impl !Send for TestingWindow
impl !Sync for TestingWindow
impl !UnwindSafe for TestingWindow
impl Unpin for TestingWindow
impl UnsafeUnpin for TestingWindow
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more