Expand description
The window’s own frame, for windows drawn without the system’s
decorations: a title bar (a caption to drag, double click to
maximize, the minimize, maximize and close buttons, room for a logo
and for the application’s items) and resize edges along the window’s
sides, never thinner than MIN_GRIP_PX physical pixels.
In full screen the bar stays (it holds the application’s menus and
items) without what only a window needs: no minimize, a button leaving
full screen where maximize was (FrameRequest::ExitFullscreen), no
drag, a double click asking nothing, and no resize edges.
The frame publishes its hit regions every frame, per window, in
physical client pixels (HitRegions, read through HitTable):
what a platform layer needs to answer the system’s hit tests itself
(on Windows, WM_NCHITTEST, so that Snap Layouts show over the
maximize button). HitRegions::hit maps a point to its region.
The widget only reports what was asked (FrameRequest); dragging
and resizing are handed to the system at once. What a request does is
the application’s (egui-pop’s frame plugin turns them into steps
plugins may veto or replace).
use egui_pop_core::frame::{self, FrameRequest};
fn ui(ui: &mut egui::Ui) {
frame::resize_edges(ui.ctx());
let out = frame::TitleBar::new("My application").show(ui, |_| {}, |_| {});
match out.request {
Some(FrameRequest::Close) => ui.ctx().send_viewport_cmd(egui::ViewportCommand::Close),
Some(FrameRequest::Minimize) => {
ui.ctx().send_viewport_cmd(egui::ViewportCommand::Minimized(true))
}
_ => {}
}
}Structs§
- Frame
Layout - A frame’s parts in points, as drawn.
- HitRegions
- A window’s frame regions, in physical client pixels.
- HitTable
- Every window’s published regions, shared: a platform layer keeps a
clone and reads a window’s regions without calling into egui. The
lock is held only to swap or clone an
Arc. - Placement
- Where a window stands, for its corners: maximized, in full screen,
against a screen’s edges.
Noneis a state the backend does not tell. - RectPx
- A rectangle in physical client pixels (from the window’s client area’s top left corner).
- Stuck
- The sides of a window against an edge of its screen (tiled or snapped there): its corners on those sides stay square.
- Title
Bar - The title bar.
- Title
BarOutput - What
TitleBar::showgives back. - Window
Edge - The line and corners of the current window’s own edge
(
window_edge).
Enums§
- Button
- A window button.
- Frame
Request - What the user asked of the window through its frame.
- Hit
- What a point of a window is, for the system’s hit test.
Constants§
- MIN_
GRIP_ PX - The thinnest resize edge, in physical pixels, whatever the scale.
Functions§
- compositor_
grab - Says that the compositor takes the pointer from this pass on, for an
interactive move or resize of the window (
ViewportCommand::StartDrag,BeginResize): the next pass of this window starts with the primary button released, if egui still holds it down. - corner_
radius - A window’s corners from its theme’s
radius(in points) and where it stands: rounded only while it floats free, a corner square on a side against a screen’s edge; all square when maximized, in full screen, or when the backend does not tell those states. - full_
screen - Whether the current window is in full screen.
- grip
- The resize edges’ width in points here: the token, never under
MIN_GRIP_PXphysical pixels. - hide_
title_ bar - Says the current window shows no title bar this pass (full screen
without its bar, a zen mode): its caption and buttons are left out of
the next
publish. - native_
hover - The window button the system says the pointer is over.
- outline
- The line the kit draws around a window the application draws
(
window.rest.border-width), dimmer while another window has the focus (window.inactive.border-color), or none in full screen. A maximized window keeps it. - paint_
window_ edge - Draws the current window’s edge: its line over everything, inside the window, and, with rounded corners, rounds at the end of the pass what egui painted at the window’s corners (the panels’ and bars’ backgrounds), so the transparent window shows through outside them. A mesh there (a picture) is left as painted.
- publish
- Publishes the current window’s regions from what the frame drew this
pass (the title bar and the edges);
TitleBar::showcalls it. - regions
- The current window’s published regions.
- resize_
edges - Lets the window be resized from its edges and corners, as a system frame would; call it before drawing the window’s content. Returns the edge under the pointer.
- round_
shape - Rounds
shape’s corners that coverwindow’s, bycorners: a rectangle (and those in a list of shapes) over a corner of the window or within a line’s width of it (the shell inside the window’s line), its radius less what it stands in from the corner. A plain fill reaching past the window is cut back to it first; a line, a picture or a shadow keeps its place. - rounding
- Whether
set_roundingturned rounded corners on. - set_
native_ hover - Says which window button the pointer is over when the system, not
egui, sees the pointer there (on Windows the buttons answer the
system’s hit test, so their hover never reaches egui): the button is
drawn hot.
Nonewhen the pointer left them. - set_
rounding - Says whether the windows the application decorates are built
transparent, so that
window_edgemay round their corners. - window_
edge - The current window’s edge as the kit and its placement say, its sides
against
screens(in points) square.