[][src]Struct egui::CtxRef

pub struct CtxRef(_);

A wrapper around CtxRef. This is how you will normally access a Context.

Implementations

impl CtxRef[src]

pub fn begin_frame(&mut self, new_input: RawInput)[src]

Call at the start of every frame. Put your widgets into a SidePanel, TopPanel, CentralPanel, Window or Area.

pub fn debug_painter(&self) -> Painter[src]

Methods from Deref<Target = Context>

pub fn available_rect(&self) -> Rect[src]

How much space is still available after panels has been added. This is the "background" area, what Egui doesn't cover with panels (but may cover with windows). This is also the area to which windows are constrained.

pub fn memory(&self) -> MutexGuard<'_, Memory>[src]

pub fn graphics(&self) -> MutexGuard<'_, GraphicLayers>[src]

pub fn output(&self) -> MutexGuard<'_, Output>[src]

pub fn request_repaint(&self)[src]

Call this if there is need to repaint the UI, i.e. if you are showing an animation. If this is called at least once in a frame, then there will be another frame right after this. Call as many times as you wish, only one repaint will be issued.

pub fn input(&self) -> &InputState[src]

pub fn fonts(&self) -> &Fonts[src]

Not valid until first call to begin_frame() That's because since we don't know the proper pixels_per_point until then.

pub fn texture(&self) -> Arc<Texture>[src]

The Egui texture, containing font characters etc.. Not valid until first call to begin_frame() That's because since we don't know the proper pixels_per_point until then.

pub fn set_fonts(&self, font_definitions: FontDefinitions)[src]

Will become active at the start of the next frame. pixels_per_point will be ignored (overwritten at start of each frame with the contents of input)

pub fn style(&self) -> Arc<Style>[src]

pub fn set_style(&self, style: impl Into<Arc<Style>>)[src]

pub fn pixels_per_point(&self) -> f32[src]

pub fn round_to_pixel(&self, point: f32) -> f32[src]

Useful for pixel-perfect rendering

pub fn round_pos_to_pixels(&self, pos: Pos2) -> Pos2[src]

Useful for pixel-perfect rendering

pub fn round_vec_to_pixels(&self, vec: Vec2) -> Vec2[src]

Useful for pixel-perfect rendering

pub fn round_rect_to_pixels(&self, rect: Rect) -> Rect[src]

Useful for pixel-perfect rendering

#[must_use]pub fn end_frame(&self) -> (Output, Vec<(Rect, PaintCmd)>)[src]

Call at the end of each frame. Returns what has happened this frame (Output) as well as what you need to paint. You can transform the returned paint commands into triangles with a call to Context::tesselate.

pub fn tesselate(&self, paint_commands: Vec<(Rect, PaintCmd)>) -> PaintJobs[src]

Tesselate the given paint commands into triangle meshes.

pub fn used_rect(&self) -> Rect[src]

How much space is used by panels and windows.

pub fn used_size(&self) -> Vec2[src]

How much space is used by panels and windows. You can shrink your Egui area to this size and still fit all Egui components.

pub fn is_mouse_over_area(&self) -> bool[src]

Is the mouse over any Egui area?

pub fn wants_mouse_input(&self) -> bool[src]

True if Egui is currently interested in the mouse. Could be the mouse is hovering over a Egui window, or the user is dragging an Egui widget. If false, the mouse is outside of any Egui area and so you may be interested in what it is doing (e.g. controlling your game). Returns false if a drag starts outside of Egui and then moves over an Egui window.

pub fn is_using_mouse(&self) -> bool[src]

Is Egui currently using the mouse position (e.g. dragging a slider). NOTE: this will return false if the mouse is just hovering over an Egui window.

pub fn wants_keyboard_input(&self) -> bool[src]

If true, Egui is currently listening on text input (e.g. typing text in a TextEdit).

pub fn layer_id_at(&self, pos: Pos2) -> Option<LayerId>[src]

pub fn animate_bool(&self, id: Id, value: bool) -> f32[src]

Returns a value in the range [0, 1], to indicate "how on" this thing is.

The first time called it will return if value { 1.0 } else { 0.0 } Calling this with value = true will always yield a number larger than zero, quickly going towards one. Calling this with value = false will always yield a number less than one, quickly going towards zero.

The function will call request_repaint() when appropriate.

pub fn settings_ui(&self, ui: &mut Ui)[src]

pub fn inspection_ui(&self, ui: &mut Ui)[src]

pub fn memory_ui(&self, ui: &mut Ui)[src]

pub fn style_ui(&self, ui: &mut Ui)[src]

Trait Implementations

impl AsRef<Context> for CtxRef[src]

impl Borrow<Context> for CtxRef[src]

impl Clone for CtxRef[src]

impl Default for CtxRef[src]

impl Deref for CtxRef[src]

type Target = Context

The resulting type after dereferencing.

impl PartialEq<CtxRef> for CtxRef[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.