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
This commit is contained in:
Malik Olivier Boussejra 2019-10-28 15:42:36 +09:00
parent ffff82d5e4
commit 093546df8c

View File

@ -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).
///