Struct HtmlWindow

Source
pub struct HtmlWindow<'open> { /* private fields */ }
Expand description

A window capable of displaying HTML content inside.

It’s API mimics egui’s Window API.

Note: hframe is automatically aware of this window.

Implementations§

Source§

impl<'open> HtmlWindow<'open>

Source

pub fn new(title: &str) -> Self

Create a new HtmlWindow.

This function mimics new from egui’s Window. It takes the window title which must be unique as it is used to compute the window id and also to set ids for HTML elements. Check the id method if you want to set a different id.

Source

pub fn open(self, open: &'open mut bool) -> Self

Mimics the open method of egui’s Window.

Source

pub fn id(self, id: &str) -> Self

Set a specific id explicitly.

Source

pub fn content(self, content: &str) -> Self

Set/change the HTML content of the window.

The initially provided HTML will be used to generete the HTML element. As long as the HTML doesn’t change, this will not re-render the content.

If you change the content, then the HTML will be re-rendered which is useful if you need to display controlled and reactive content.

Source

pub fn show(self, ctx: &Context)

Displays the window and it’s content.

Note: You will still need to call sync at the end of the update loop to make this work propertly.

Auto Trait Implementations§

§

impl<'open> Freeze for HtmlWindow<'open>

§

impl<'open> RefUnwindSafe for HtmlWindow<'open>

§

impl<'open> Send for HtmlWindow<'open>

§

impl<'open> Sync for HtmlWindow<'open>

§

impl<'open> Unpin for HtmlWindow<'open>

§

impl<'open> !UnwindSafe for HtmlWindow<'open>

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> 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, 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.