Feedback implemented

This commit is contained in:
Benjamin Adamson 2017-07-08 02:15:59 -07:00
parent 2f1cc2e9a8
commit 23de1746f4
2 changed files with 7 additions and 22 deletions

View File

@ -3,11 +3,9 @@ use ImStr;
use ImVec2;
use ImGuiWindowFlags;
use super::{ImGuiWindowFlags_NoTitleBar, ImGuiWindowFlags_NoResize, ImGuiWindowFlags_NoMove,
ImGuiWindowFlags_NoScrollbar, ImGuiWindowFlags_NoScrollWithMouse,
use super::{ImGuiWindowFlags_NoMove, ImGuiWindowFlags_NoScrollbar, ImGuiWindowFlags_NoScrollWithMouse,
ImGuiWindowFlags_NoCollapse, ImGuiWindowFlags_AlwaysAutoResize,
ImGuiWindowFlags_ShowBorders, ImGuiWindowFlags_NoSavedSettings,
ImGuiWindowFlags_NoInputs, ImGuiWindowFlags_MenuBar,
ImGuiWindowFlags_ShowBorders, ImGuiWindowFlags_NoInputs, ImGuiWindowFlags_MenuBar,
ImGuiWindowFlags_HorizontalScrollbar, ImGuiWindowFlags_NoFocusOnAppearing,
ImGuiWindowFlags_NoBringToFrontOnFocus, ImGuiWindowFlags_AlwaysVerticalScrollbar,
ImGuiWindowFlags_AlwaysHorizontalScrollbar, ImGuiWindowFlags_AlwaysUseWindowPadding};
@ -28,16 +26,6 @@ impl<'p> ChildFrame<'p> {
}
}
#[inline]
pub fn show_title(mut self, value: bool) -> Self {
self.flags.set(ImGuiWindowFlags_NoTitleBar, !value);
self
}
#[inline]
pub fn resizable(mut self, value: bool) -> Self {
self.flags.set(ImGuiWindowFlags_NoResize, !value);
self
}
#[inline]
pub fn movable(mut self, value: bool) -> Self {
self.flags.set(ImGuiWindowFlags_NoMove, !value);
self
@ -68,11 +56,6 @@ impl<'p> ChildFrame<'p> {
self
}
#[inline]
pub fn save_settings(mut self, value: bool) -> Self {
self.flags.set(ImGuiWindowFlags_NoSavedSettings, !value);
self
}
#[inline]
pub fn input_allow(mut self, value: bool) -> Self {
self.flags.set(ImGuiWindowFlags_NoInputs, !value);
self
@ -125,7 +108,10 @@ impl<'p> ChildFrame<'p> {
self
}
pub fn build<F: FnOnce()>(self, f: F) {
let show_border = self.flags.contains(ImGuiWindowFlags_ShowBorders);
// See issue for history.
// https://github.com/Gekkio/imgui-rs/pull/58
let show_border = false;
let render_child_frame = unsafe { imgui_sys::igBeginChild(self.name.as_ptr(), self.size, show_border, self.flags) };
if render_child_frame {
f();

View File

@ -757,10 +757,9 @@ impl<'ui> Ui<'ui> {
/// ui.child_frame(im_str!("child frame"), ImVec2::new(400.0, 100.0))
/// .show_borders(true)
/// .always_show_vertical_scroll_bar(true)
/// .show_title(true)
/// .build(|| {
/// ui.text_colored((1.0, 0.0, 0.0, 1.0), im_str!("hello mate!"));
/// });
/// });
pub fn child_frame<'p>(&self, name: &'p ImStr, size: ImVec2) -> ChildFrame<'p> { ChildFrame::new(name, size) }
pub fn child_frame<'p, S: Into<ImVec2>>(&self, name: &'p ImStr, size: S) -> ChildFrame<'p> { ChildFrame::new(name, size.into()) }
}