pub struct Context { /* private fields */ }Expand description
The main ImGui context.
Implementations§
Source§impl Context
impl Context
Sourcepub unsafe fn new() -> Context
pub unsafe fn new() -> Context
Creates a new ImGui context with default values.
SAFETY: It is unsafe because it makes the context current, and that may brake the current context if called at the wrong time.
Sourcepub unsafe fn set_size(&mut self, size: Vector2, scale: f32)
pub unsafe fn set_size(&mut self, size: Vector2, scale: f32)
Sets the size and scale of the context area.
Sourcepub unsafe fn set_current(&mut self) -> CurrentContext<'_>
pub unsafe fn set_current(&mut self) -> CurrentContext<'_>
Makes this context the current one.
SAFETY: Do not make two different contexts current at the same time in the same thread.
Sourcepub fn set_ini_file_name(&mut self, ini_file_name: Option<&str>)
pub fn set_ini_file_name(&mut self, ini_file_name: Option<&str>)
Sets the ini file where ImGui persists its data.
By default is None, that means no file is saved.
Sourcepub fn ini_file_name(&self) -> Option<&str>
pub fn ini_file_name(&self) -> Option<&str>
Gets the ini file set previously by set_ini_file_name.
Methods from Deref<Target = RawContext>§
Sourcepub fn get(&self) -> &ImGuiContext
pub fn get(&self) -> &ImGuiContext
Gets a reference to the native wrapper struct.
Sourcepub unsafe fn inner(&mut self) -> &mut ImGuiContext
pub unsafe fn inner(&mut self) -> &mut ImGuiContext
Gets a reference to the actual DearImGui context struct.
Sourcepub fn platform_io(&self) -> &PlatformIo
pub fn platform_io(&self) -> &PlatformIo
Returns a safe wrapper for the PlatformIo.
Sourcepub unsafe fn platform_io_mut(&mut self) -> &mut PlatformIo
pub unsafe fn platform_io_mut(&mut self) -> &mut PlatformIo
Returns an unsafe mutable wrapper for the PlatformIo.
Sourcepub fn io_mut(&mut self) -> &mut IoMut
pub fn io_mut(&mut self) -> &mut IoMut
Returns a safe mutable wrapper for the IO.
Use io_mut().inner() to get the unsafe wrapper
Sourcepub fn get_main_viewport(&self) -> &Viewport
pub fn get_main_viewport(&self) -> &Viewport
Gets a reference to the main viewport
Methods from Deref<Target = ImGuiContext>§
pub fn ActiveIdMouseButton(&self) -> i32
Trait Implementations§
Source§impl Deref for Context
impl Deref for Context
Source§type Target = RawContext
type Target = RawContext
Source§fn deref(&self) -> &RawContext
fn deref(&self) -> &RawContext
Auto Trait Implementations§
impl Freeze for Context
impl !RefUnwindSafe for Context
impl !Send for Context
impl !Sync for Context
impl Unpin for Context
impl !UnwindSafe for Context
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> 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 more