[][src]Struct egui::Context

pub struct Context { /* fields omitted */ }

Contains the input, style and output of all GUI commands. Ui:s keep an Arc pointer to this. This allows us to create several child Ui:s at once, all working against the same shared Context.

Implementations

impl Context[src]

pub fn new() -> Arc<Self>[src]

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

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

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

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

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) -> &Texture[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 set_fonts(&self, font_definitions: FontDefinitions)[src]

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

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

pub fn set_style(&self, style: 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]

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

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

pub fn begin_frame(self: &mut Arc<Self>, new_input: RawInput) -> Ui[src]

Call at the start of every frame. Returns a master fullscreen UI, covering the entire screen.

#[must_use]pub fn end_frame(&self) -> (Output, PaintBatches)[src]

Call at the end of each frame. Returns what has happened this frame (Output) as well as what you need to paint.

pub fn make_unique_id<IdSource>(&self, source: IdSource, pos: Pos2) -> Id where
    IdSource: Hash + Debug + Copy
[src]

Generate a id from the given source. If it is not unique, an error will be printed at the given position.

pub fn register_unique_id(
    &self,
    id: Id,
    source_name: impl Debug,
    pos: Pos2
) -> Id
[src]

If the given Id is not unique, an error will be printed at the given position.

pub fn contains_mouse(&self, layer: Layer, clip_rect: Rect, rect: Rect) -> bool[src]

pub fn interact(
    &self,
    layer: Layer,
    clip_rect: Rect,
    rect: Rect,
    interaction_id: Option<Id>,
    sense: Sense
) -> InteractInfo
[src]

pub fn show_error(&self, pos: Pos2, text: impl Into<String>)[src]

pub fn debug_text(&self, pos: Pos2, text: impl Into<String>)[src]

pub fn debug_rect(&self, rect: Rect, name: impl Into<String>)[src]

pub fn floating_text(
    &self,
    layer: Layer,
    pos: Pos2,
    text: String,
    text_style: TextStyle,
    align: (Align, Align),
    text_color: Option<Color>
) -> Rect
[src]

Show some text anywhere on screen. To center the text at the given position, use align: (Center, Center).

pub fn add_galley(
    &self,
    layer: Layer,
    pos: Pos2,
    galley: Galley,
    text_style: TextStyle,
    color: Option<Color>
)
[src]

Already layed out text.

pub fn add_paint_cmd(&self, layer: Layer, paint_cmd: PaintCmd)[src]

impl Context[src]

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]

impl Context[src]

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

Trait Implementations

impl Clone for Context[src]

impl Default for Context[src]

Auto Trait Implementations

impl !RefUnwindSafe for Context

impl Send for Context

impl Sync for Context

impl Unpin for Context

impl !UnwindSafe for Context

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.