pub struct ViewportBuilder {Show 27 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 clamp_size_to_monitor_size: Option<bool>,
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>
§clamp_size_to_monitor_size: Option<bool>
Whether clamp the window’s size to monitor’s size. The default is true
on linux, otherwise it is false
.
Note: On some Linux systems, a window size larger than the monitor causes crashes
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_shown: Option<bool>
§drag_and_drop: Option<bool>
§taskbar: Option<bool>
§window_level: Option<WindowLevel>
§mouse_passthrough: Option<bool>
§window_type: Option<X11WindowType>
Implementations§
§impl ViewportBuilder
impl ViewportBuilder
pub fn with_title(self, title: impl Into<String>) -> ViewportBuilder
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
pub fn with_decorations(self, decorations: bool) -> ViewportBuilder
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
pub fn with_fullscreen(self, fullscreen: bool) -> ViewportBuilder
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
pub fn with_maximized(self, maximized: bool) -> ViewportBuilder
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
pub fn with_resizable(self, resizable: bool) -> ViewportBuilder
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
pub fn with_transparent(self, transparent: bool) -> ViewportBuilder
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!
pub fn with_icon(self, icon: impl Into<Arc<IconData>>) -> ViewportBuilder
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 IconData::default()
.
pub fn with_active(self, active: bool) -> ViewportBuilder
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
pub fn with_visible(self, visible: bool) -> ViewportBuilder
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
pub fn with_fullsize_content_view(self, value: bool) -> ViewportBuilder
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
.
pub fn with_title_shown(self, title_shown: bool) -> ViewportBuilder
pub fn with_title_shown(self, title_shown: bool) -> ViewportBuilder
macOS: Set to false
to hide the window title.
macOS: Set to false
to hide the titlebar button (close, minimize, maximize)
pub fn with_titlebar_shown(self, shown: bool) -> ViewportBuilder
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.
pub fn with_taskbar(self, show: bool) -> ViewportBuilder
pub fn with_taskbar(self, show: bool) -> ViewportBuilder
windows: Whether show or hide the window icon in the taskbar.
pub fn with_inner_size(self, size: impl Into<Vec2>) -> ViewportBuilder
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
pub fn with_min_inner_size(self, size: impl Into<Vec2>) -> ViewportBuilder
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
pub fn with_max_inner_size(self, size: impl Into<Vec2>) -> ViewportBuilder
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
pub fn with_clamp_size_to_monitor_size(self, value: bool) -> ViewportBuilder
pub fn with_clamp_size_to_monitor_size(self, value: bool) -> ViewportBuilder
Sets whether clamp the window’s size to monitor’s size. The default is true
on linux, otherwise it is false
.
Note: On some Linux systems, a window size larger than the monitor causes crashes
Does not work on X11.
Does not work on X11.
Does not work on X11.
pub fn with_drag_and_drop(self, value: bool) -> ViewportBuilder
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.
pub fn with_position(self, pos: impl Into<Pos2>) -> ViewportBuilder
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.
pub fn with_app_id(self, app_id: impl Into<String>) -> ViewportBuilder
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.
pub fn with_window_level(self, level: WindowLevel) -> ViewportBuilder
pub fn with_window_level(self, level: WindowLevel) -> ViewportBuilder
Control if window is always-on-top, always-on-bottom, or neither.
pub fn with_always_on_top(self) -> ViewportBuilder
pub fn with_always_on_top(self) -> ViewportBuilder
This window is always on top
pub fn with_mouse_passthrough(self, value: bool) -> ViewportBuilder
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
.
pub fn with_window_type(self, value: X11WindowType) -> ViewportBuilder
pub fn with_window_type(self, value: X11WindowType) -> ViewportBuilder
§On X11
This sets the window type.
Maps directly to _NET_WM_WINDOW_TYPE
.
pub fn patch(
&mut self,
new_vp_builder: ViewportBuilder
) -> (Vec<ViewportCommand>, bool)
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§
§impl Clone for ViewportBuilder
impl Clone for ViewportBuilder
§fn clone(&self) -> ViewportBuilder
fn clone(&self) -> ViewportBuilder
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl Debug for ViewportBuilder
impl Debug for ViewportBuilder
§impl Default for ViewportBuilder
impl Default for ViewportBuilder
§fn default() -> ViewportBuilder
fn default() -> ViewportBuilder
§impl PartialEq for ViewportBuilder
impl PartialEq for ViewportBuilder
§fn eq(&self, other: &ViewportBuilder) -> bool
fn eq(&self, other: &ViewportBuilder) -> bool
self
and other
values to be equal, and is used
by ==
.impl Eq for ViewportBuilder
impl StructuralPartialEq for ViewportBuilder
Auto Trait Implementations§
impl Freeze for ViewportBuilder
impl RefUnwindSafe for ViewportBuilder
impl Send for ViewportBuilder
impl Sync for ViewportBuilder
impl Unpin for ViewportBuilder
impl UnwindSafe for ViewportBuilder
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
source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request