Struct rerun::external::eframe::egui::viewport::ViewportBuilder

source ·
pub struct ViewportBuilder {
Show 26 fields pub title: Option<String>, pub app_id: Option<String>, pub position: Option<Pos2>, pub inner_size: Option<Vec2>, pub min_inner_size: Option<Vec2>, pub max_inner_size: Option<Vec2>, pub fullscreen: Option<bool>, pub maximized: Option<bool>, pub resizable: Option<bool>, pub transparent: Option<bool>, pub decorations: Option<bool>, pub icon: Option<Arc<IconData>>, pub active: Option<bool>, pub visible: Option<bool>, pub fullsize_content_view: Option<bool>, pub title_shown: Option<bool>, pub titlebar_buttons_shown: Option<bool>, pub titlebar_shown: Option<bool>, pub drag_and_drop: Option<bool>, pub taskbar: Option<bool>, pub close_button: Option<bool>, pub minimize_button: Option<bool>, pub maximize_button: Option<bool>, pub window_level: Option<WindowLevel>, pub mouse_passthrough: Option<bool>, pub window_type: Option<X11WindowType>,
}
Expand description

Control the building of a new egui viewport (i.e. native window).

See crate::viewport for how to build new viewports (native windows).

The fields are public, but you should use the builder pattern to set them, and that’s where you’ll find the documentation too.

Since egui is immediate mode, ViewportBuilder is accumulative in nature. Setting any option to None means “keep the current value”, or “Use the default” if it is the first call.

The default values are implementation defined, so you may want to explicitly configure the size of the window, and what buttons are shown.

Fields§

§title: Option<String>

The title of the viewport. eframe will use this as the title of the native window.

§app_id: Option<String>

This is wayland only. See Self::with_app_id.

§position: Option<Pos2>

The desired outer position of the window.

§inner_size: Option<Vec2>§min_inner_size: Option<Vec2>§max_inner_size: Option<Vec2>§fullscreen: Option<bool>§maximized: Option<bool>§resizable: Option<bool>§transparent: Option<bool>§decorations: Option<bool>§icon: Option<Arc<IconData>>§active: Option<bool>§visible: Option<bool>§fullsize_content_view: Option<bool>§title_shown: Option<bool>§titlebar_buttons_shown: Option<bool>§titlebar_shown: Option<bool>§drag_and_drop: Option<bool>§taskbar: Option<bool>§close_button: Option<bool>§minimize_button: Option<bool>§maximize_button: Option<bool>§window_level: Option<WindowLevel>§mouse_passthrough: Option<bool>§window_type: Option<X11WindowType>

Implementations§

source§

impl ViewportBuilder

source

pub fn with_title(self, title: impl Into<String>) -> ViewportBuilder

Sets the initial title of the window in the title bar.

Look at winit for more details

source

pub fn with_decorations(self, decorations: bool) -> ViewportBuilder

Sets whether the window should have a border, a title bar, etc.

The default is true.

Look at winit for more details

source

pub fn with_fullscreen(self, fullscreen: bool) -> ViewportBuilder

Sets whether the window should be put into fullscreen upon creation.

The default is None.

Look at winit for more details This will use borderless

source

pub fn with_maximized(self, maximized: bool) -> ViewportBuilder

Request that the window is maximized upon creation.

The default is false.

Look at winit for more details

source

pub fn with_resizable(self, resizable: bool) -> ViewportBuilder

Sets whether the window is resizable or not.

The default is true.

Look at winit for more details

source

pub fn with_transparent(self, transparent: bool) -> ViewportBuilder

Sets whether the background of the window should be transparent.

You should avoid having a crate::CentralPanel, or make sure its frame is also transparent.

In eframe you control the transparency with eframe::App::clear_color().

If this is true, writing colors with alpha values different than 1.0 will produce a transparent window. On some platforms this is more of a hint for the system and you’d still have the alpha buffer.

The default is false. If this is not working, it’s because the graphic context doesn’t support transparency, you will need to set the transparency in the eframe!

source

pub fn with_icon(self, icon: impl Into<Arc<IconData>>) -> ViewportBuilder

The application icon, e.g. in the Windows task bar or the alt-tab menu.

The default icon is a white e on a black background (for “egui” or “eframe”). If you prefer the OS default, set this to None.

source

pub fn with_active(self, active: bool) -> ViewportBuilder

Whether the window will be initially focused or not.

The window should be assumed as not focused by default

§Platform-specific:

Android / iOS / X11 / Wayland / Orbital: Unsupported.

Look at winit for more details

source

pub fn with_visible(self, visible: bool) -> ViewportBuilder

Sets whether the window will be initially visible or hidden.

The default is to show the window.

Look at winit for more details

source

pub fn with_fullsize_content_view(self, value: bool) -> ViewportBuilder

macOS: Makes the window content appear behind the titlebar.

You often want to combine this with Self::with_titlebar_shown and Self::with_title_shown.

source

pub fn with_title_shown(self, title_shown: bool) -> ViewportBuilder

macOS: Set to false to hide the window title.

source

pub fn with_titlebar_buttons_shown( self, titlebar_buttons_shown: bool ) -> ViewportBuilder

macOS: Set to false to hide the titlebar button (close, minimize, maximize)

source

pub fn with_titlebar_shown(self, shown: bool) -> ViewportBuilder

macOS: Set to false to make the titlebar transparent, allowing the content to appear behind it.

source

pub fn with_taskbar(self, show: bool) -> ViewportBuilder

windows: Whether show or hide the window icon in the taskbar.

source

pub fn with_inner_size(self, size: impl Into<Vec2>) -> ViewportBuilder

Requests the window to be of specific dimensions.

If this is not set, some platform-specific dimensions will be used.

Should be bigger than 0 Look at winit for more details

source

pub fn with_min_inner_size(self, size: impl Into<Vec2>) -> ViewportBuilder

Sets the minimum dimensions a window can have.

If this is not set, the window will have no minimum dimensions (aside from reserved).

Should be bigger than 0 Look at winit for more details

source

pub fn with_max_inner_size(self, size: impl Into<Vec2>) -> ViewportBuilder

Sets the maximum dimensions a window can have.

If this is not set, the window will have no maximum or will be set to the primary monitor’s dimensions by the platform.

Should be bigger than 0 Look at winit for more details

source

pub fn with_close_button(self, value: bool) -> ViewportBuilder

Does not work on X11.

source

pub fn with_minimize_button(self, value: bool) -> ViewportBuilder

Does not work on X11.

source

pub fn with_maximize_button(self, value: bool) -> ViewportBuilder

Does not work on X11.

source

pub fn with_drag_and_drop(self, value: bool) -> ViewportBuilder

On Windows: enable drag and drop support. Drag and drop can not be disabled on other platforms.

See winit’s documentation for information on why you might want to disable this on windows.

source

pub fn with_position(self, pos: impl Into<Pos2>) -> ViewportBuilder

The initial “outer” position of the window, i.e. where the top-left corner of the frame/chrome should be.

source

pub fn with_app_id(self, app_id: impl Into<String>) -> ViewportBuilder

§On Wayland

On Wayland this sets the Application ID for the window.

The application ID is used in several places of the compositor, e.g. for grouping windows of the same application. It is also important for connecting the configuration of a .desktop file with the window, by using the application ID as file name. This allows e.g. a proper icon handling under Wayland.

See Waylands XDG shell documentation for more information on this Wayland-specific option.

The app_id should match the .desktop file distributed with your program.

For details about application ID conventions, see the Desktop Entry Spec

§eframe

On eframe, the app_id of the root window is also used to determine the storage location of persistence files.

source

pub fn with_window_level(self, level: WindowLevel) -> ViewportBuilder

Control if window is always-on-top, always-on-bottom, or neither.

source

pub fn with_always_on_top(self) -> ViewportBuilder

This window is always on top

source

pub fn with_mouse_passthrough(self, value: bool) -> ViewportBuilder

On desktop: mouse clicks pass through the window, used for non-interactable overlays.

Generally you would use this in conjunction with Self::with_transparent and Self::with_always_on_top.

source

pub fn with_window_type(self, value: X11WindowType) -> ViewportBuilder

§On X11

This sets the window type. Maps directly to _NET_WM_WINDOW_TYPE.

source

pub fn patch( &mut self, new_vp_builder: ViewportBuilder ) -> (Vec<ViewportCommand>, bool)

Update this ViewportBuilder with a delta, returning a list of commands and a bool indicating if the window needs to be recreated.

Trait Implementations§

source§

impl Clone for ViewportBuilder

source§

fn clone(&self) -> ViewportBuilder

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ViewportBuilder

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Default for ViewportBuilder

source§

fn default() -> ViewportBuilder

Returns the “default value” for a type. Read more
source§

impl PartialEq for ViewportBuilder

source§

fn eq(&self, other: &ViewportBuilder) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for ViewportBuilder

source§

impl StructuralPartialEq for ViewportBuilder

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> Az for T

source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
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<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

source§

fn cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> CheckedAs for T

source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
source§

impl<T> Downcast<T> for T

source§

fn downcast(&self) -> &T

source§

impl<T> Downcast for T
where T: Any,

source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
source§

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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<Src, Dst> LosslessTryInto<Dst> for Src
where Dst: LosslessTryFrom<Src>,

source§

fn lossless_try_into(self) -> Option<Dst>

Performs the conversion.
source§

impl<Src, Dst> LossyInto<Dst> for Src
where Dst: LossyFrom<Src>,

source§

fn lossy_into(self) -> Dst

Performs the conversion.
source§

impl<T> NoneValue for T
where T: Default,

§

type NoneType = T

source§

fn null_value() -> T

The none-equivalent value.
source§

impl<T> OverflowingAs for T

source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> SaturatingAs for T

source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

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

§

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.
source§

impl<T> UnwrappedAs for T

source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> Upcast<T> for T

source§

fn upcast(&self) -> Option<&T>

source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> WrappingAs for T

source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> WasmNotSend for T
where T: Send,

source§

impl<T> WasmNotSendSync for T

source§

impl<T> WasmNotSync for T
where T: Sync,