Struct arcdps_imgui::Context
source · pub struct Context { /* private fields */ }
Expand description
An imgui-rs context.
A context needs to be created to access most library functions. Due to current Dear ImGui design choices, at most one active Context can exist at any time. This limitation will likely be removed in a future Dear ImGui version.
If you need more than one context, you can use suspended contexts. As long as only one context is active at a time, it’s possible to have multiple independent contexts.
§Examples
Creating a new active context:
let ctx = arcdps_imgui::Context::create();
// ctx is dropped naturally when it goes out of scope, which deactivates and destroys the
// context
Never try to create an active context when another one is active:
let ctx1 = arcdps_imgui::Context::create();
let ctx2 = arcdps_imgui::Context::create(); // PANIC
Suspending an active context allows you to create another active context:
let ctx1 = arcdps_imgui::Context::create();
let suspended1 = ctx1.suspend();
let ctx2 = arcdps_imgui::Context::create(); // this is now OK
Implementations§
source§impl Context
impl Context
Creates a new active imgui-rs context with a shared font atlas.
§Panics
Panics if an active context already exists
sourcepub fn suspend(self) -> SuspendedContext
pub fn suspend(self) -> SuspendedContext
Suspends this context so another context can be the active context.
sourcepub fn ini_filename(&self) -> Option<PathBuf>
pub fn ini_filename(&self) -> Option<PathBuf>
Returns the path to the ini file, or None if not set
sourcepub fn set_ini_filename<T: Into<Option<PathBuf>>>(&mut self, ini_filename: T)
pub fn set_ini_filename<T: Into<Option<PathBuf>>>(&mut self, ini_filename: T)
Sets the path to the ini file (default is “imgui.ini”)
Pass None to disable automatic .Ini saving.
sourcepub fn log_filename(&self) -> Option<PathBuf>
pub fn log_filename(&self) -> Option<PathBuf>
Returns the path to the log file, or None if not set
sourcepub fn set_log_filename<T: Into<Option<PathBuf>>>(&mut self, log_filename: T)
pub fn set_log_filename<T: Into<Option<PathBuf>>>(&mut self, log_filename: T)
Sets the log filename (default is “imgui_log.txt”).
sourcepub fn platform_name(&self) -> Option<&str>
pub fn platform_name(&self) -> Option<&str>
Returns the backend platform name, or None if not set
sourcepub fn set_platform_name<T: Into<Option<String>>>(&mut self, platform_name: T)
pub fn set_platform_name<T: Into<Option<String>>>(&mut self, platform_name: T)
Sets the backend platform name
sourcepub fn renderer_name(&self) -> Option<&str>
pub fn renderer_name(&self) -> Option<&str>
Returns the backend renderer name, or None if not set
sourcepub fn set_renderer_name<T: Into<Option<String>>>(&mut self, renderer_name: T)
pub fn set_renderer_name<T: Into<Option<String>>>(&mut self, renderer_name: T)
Sets the backend renderer name
sourcepub fn load_ini_settings(&mut self, data: &str)
pub fn load_ini_settings(&mut self, data: &str)
Loads settings from a string slice containing settings in .Ini file format
sourcepub fn save_ini_settings(&mut self, buf: &mut String)
pub fn save_ini_settings(&mut self, buf: &mut String)
Saves settings to a mutable string buffer in .Ini file format
sourcepub fn set_clipboard_backend<T: ClipboardBackend>(&mut self, backend: T)
pub fn set_clipboard_backend<T: ClipboardBackend>(&mut self, backend: T)
Sets the clipboard backend used for clipboard operations