From ebeb92aa8e8c88171035354a62023f1f086856ed Mon Sep 17 00:00:00 2001 From: Zhaoxian Li Date: Sun, 21 Jun 2020 22:05:57 +0800 Subject: [PATCH] Expose background drawlist --- src/lib.rs | 5 +++++ src/window_draw_list.rs | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index e1f326f..9e11184 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -515,6 +515,11 @@ impl<'ui> Ui<'ui> { pub fn get_window_draw_list(&'ui self) -> WindowDrawList<'ui> { WindowDrawList::new(self) } + + #[must_use] + pub fn get_background_draw_list(&'ui self) -> WindowDrawList<'ui> { + WindowDrawList::new(self).background() + } } /// Condition for applying a setting diff --git a/src/window_draw_list.rs b/src/window_draw_list.rs index d5e28ac..090e818 100644 --- a/src/window_draw_list.rs +++ b/src/window_draw_list.rs @@ -82,6 +82,13 @@ impl<'ui> WindowDrawList<'ui> { } } + pub(crate) fn background(&mut self) -> Self { + Self { + draw_list: unsafe { sys::igGetBackgroundDrawList() }, + _phantom: PhantomData, + } + } + /// Split into *channels_count* drawing channels. /// At the end of the closure, the channels are merged. The objects /// are then drawn in the increasing order of their channel number, and not