From 093546df8c606308d375d8becc8fedbb608bc07b Mon Sep 17 00:00:00 2001 From: Malik Olivier Boussejra Date: Mon, 28 Oct 2019 15:42:36 +0900 Subject: [PATCH 1/2] Implement ChildWindow::movable This commit adds the API that allows to set the NO_MOVE flag for a child window. This API was missing: the NO_MOVE flag could only be set for a Window. If the NO_MOVE flag is set to True, (by calling `ChildWindow::movable(false)`), then the window will not move when a child window is dragged on. We can see this behavior in imgui's code: https://github.com/ocornut/imgui/blob/f0f53016/imgui.cpp#L3354 --- src/window/child_window.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/window/child_window.rs b/src/window/child_window.rs index 56d025e..06e9542 100644 --- a/src/window/child_window.rs +++ b/src/window/child_window.rs @@ -83,6 +83,14 @@ impl<'a> ChildWindow<'a> { self.border = border; self } + /// Enables/disables moving the window when child window is dragged. + /// + /// Enabled by default. + #[inline] + pub fn movable(mut self, value: bool) -> Self { + self.flags.set(WindowFlags::NO_MOVE, !value); + self + } /// Enables/disables scrollbars (scrolling is still possible with the mouse or /// programmatically). /// From f891dd76a8b3196b139d742d042a72d4821e59cd Mon Sep 17 00:00:00 2001 From: Malik Olivier Boussejra Date: Mon, 2 Dec 2019 19:28:47 +0900 Subject: [PATCH 2/2] Add ChildWindow::movable to CHANGELOG --- CHANGELOG.markdown | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.markdown b/CHANGELOG.markdown index f92aaab..e16f90e 100644 --- a/CHANGELOG.markdown +++ b/CHANGELOG.markdown @@ -2,6 +2,10 @@ ## [Unreleased] +### Added + +- Add `ChildWindow::movable` + ### Changed - Upgrade to cimgui / imgui 1.73