Hide all builder "new" functions

These are very unsafe when used outside the Ui::* functions.
This commit is contained in:
Joonas Javanainen 2017-07-12 23:39:09 +03:00
parent c4cc165c5d
commit eca0ad9ec0
No known key found for this signature in database
GPG Key ID: D39CCA5CB19B9179
9 changed files with 20 additions and 20 deletions

View File

@ -18,7 +18,7 @@ pub struct ChildFrame<'p> {
}
impl<'p> ChildFrame<'p> {
pub fn new<S: Into<ImVec2>>(name: &'p ImStr, size: S) -> ChildFrame<'p> {
pub(crate) fn new<S: Into<ImVec2>>(name: &'p ImStr, size: S) -> ChildFrame<'p> {
ChildFrame {
name,
size: size.into(),

View File

@ -135,7 +135,7 @@ pub struct InputText<'ui, 'p> {
}
impl<'ui, 'p> InputText<'ui, 'p> {
pub fn new(label: &'p ImStr, buf: &'p mut ImString) -> Self {
pub(crate) fn new(label: &'p ImStr, buf: &'p mut ImString) -> Self {
InputText {
label: label,
buf: buf,
@ -172,7 +172,7 @@ pub struct InputInt<'ui, 'p> {
}
impl<'ui, 'p> InputInt<'ui, 'p> {
pub fn new(label: &'p ImStr, value: &'p mut i32) -> Self {
pub(crate) fn new(label: &'p ImStr, value: &'p mut i32) -> Self {
InputInt {
label: label,
value: value,
@ -209,7 +209,7 @@ pub struct InputFloat<'ui, 'p> {
}
impl<'ui, 'p> InputFloat<'ui, 'p> {
pub fn new(label: &'p ImStr, value: &'p mut f32) -> Self {
pub(crate) fn new(label: &'p ImStr, value: &'p mut f32) -> Self {
InputFloat {
label: label,
value: value,
@ -249,7 +249,7 @@ macro_rules! impl_input_floatn {
}
impl<'ui, 'p> $InputFloatN<'ui, 'p> {
pub fn new(label: &'p ImStr, value: &'p mut [f32;$N]) -> Self {
pub(crate) fn new(label: &'p ImStr, value: &'p mut [f32;$N]) -> Self {
$InputFloatN {
label: label,
value: value,
@ -290,7 +290,7 @@ macro_rules! impl_input_intn {
}
impl<'ui, 'p> $InputIntN<'ui, 'p> {
pub fn new(label: &'p ImStr, value: &'p mut [i32;$N]) -> Self {
pub(crate) fn new(label: &'p ImStr, value: &'p mut [i32;$N]) -> Self {
$InputIntN {
label: label,
value: value,
@ -325,7 +325,7 @@ pub struct ColorEdit3<'ui, 'p> {
}
impl<'ui, 'p> ColorEdit3<'ui, 'p> {
pub fn new(label: &'p ImStr, value: &'p mut [f32; 3]) -> Self {
pub(crate) fn new(label: &'p ImStr, value: &'p mut [f32; 3]) -> Self {
ColorEdit3 {
label: label,
value: value,
@ -347,7 +347,7 @@ pub struct ColorEdit4<'ui, 'p> {
}
impl<'ui, 'p> ColorEdit4<'ui, 'p> {
pub fn new(label: &'p ImStr, value: &'p mut [f32; 4]) -> Self {
pub(crate) fn new(label: &'p ImStr, value: &'p mut [f32; 4]) -> Self {
ColorEdit4 {
label: label,
value: value,

View File

@ -12,7 +12,7 @@ pub struct Menu<'ui, 'p> {
}
impl<'ui, 'p> Menu<'ui, 'p> {
pub fn new(label: &'p ImStr) -> Self {
pub(crate) fn new(label: &'p ImStr) -> Self {
Menu {
label: label,
enabled: true,
@ -43,7 +43,7 @@ pub struct MenuItem<'ui, 'p> {
}
impl<'ui, 'p> MenuItem<'ui, 'p> {
pub fn new(label: &'p ImStr) -> Self {
pub(crate) fn new(label: &'p ImStr) -> Self {
MenuItem {
label: label,
shortcut: None,

View File

@ -16,7 +16,7 @@ pub struct PlotHistogram<'p> {
}
impl<'p> PlotHistogram<'p> {
pub fn new(label: &'p ImStr, values: &'p [f32]) -> Self {
pub(crate) fn new(label: &'p ImStr, values: &'p [f32]) -> Self {
PlotHistogram {
label: label,
values: values,

View File

@ -15,7 +15,7 @@ pub struct PlotLines<'p> {
}
impl<'p> PlotLines<'p> {
pub fn new(label: &'p ImStr, values: &'p [f32]) -> Self {
pub(crate) fn new(label: &'p ImStr, values: &'p [f32]) -> Self {
PlotLines {
label: label,
values: values,

View File

@ -19,7 +19,7 @@ impl<'p> ProgressBar<'p> {
/// The progress bar will be automatically sized to fill
/// the entire width of the window if no custom size is
/// specified.
pub fn new(fraction: f32) -> Self {
pub(crate) fn new(fraction: f32) -> Self {
ProgressBar {
fraction: fraction,
size: ImVec2::new(-1.0, 0.0),

View File

@ -16,7 +16,7 @@ pub struct SliderInt<'ui, 'p> {
}
impl<'ui, 'p> SliderInt<'ui, 'p> {
pub fn new(label: &'p ImStr, value: &'p mut i32, min: i32, max: i32) -> Self {
pub(crate) fn new(label: &'p ImStr, value: &'p mut i32, min: i32, max: i32) -> Self {
SliderInt {
label: label,
value: value,
@ -55,7 +55,7 @@ macro_rules! impl_slider_intn {
}
impl<'ui, 'p> $SliderIntN<'ui, 'p> {
pub fn new(label: &'p ImStr, value: &'p mut [i32; $N], min: i32, max: i32) -> Self {
pub(crate) fn new(label: &'p ImStr, value: &'p mut [i32; $N], min: i32, max: i32) -> Self {
$SliderIntN {
label: label,
value: value,
@ -100,7 +100,7 @@ pub struct SliderFloat<'ui, 'p> {
}
impl<'ui, 'p> SliderFloat<'ui, 'p> {
pub fn new(label: &'p ImStr, value: &'p mut f32, min: f32, max: f32) -> Self {
pub(crate) fn new(label: &'p ImStr, value: &'p mut f32, min: f32, max: f32) -> Self {
SliderFloat {
label: label,
value: value,
@ -147,7 +147,7 @@ macro_rules! impl_slider_floatn {
}
impl<'ui, 'p> $SliderFloatN<'ui, 'p> {
pub fn new(label: &'p ImStr, value: &'p mut [f32; $N], min: f32, max: f32) -> Self {
pub(crate) fn new(label: &'p ImStr, value: &'p mut [f32; $N], min: f32, max: f32) -> Self {
$SliderFloatN {
label: label,
value: value,

View File

@ -16,7 +16,7 @@ pub struct TreeNode<'ui, 'p> {
}
impl<'ui, 'p> TreeNode<'ui, 'p> {
pub fn new(id: &'p ImStr) -> Self {
pub(crate) fn new(id: &'p ImStr) -> Self {
TreeNode {
id: id,
label: None,
@ -62,7 +62,7 @@ pub struct CollapsingHeader<'ui, 'p> {
}
impl<'ui, 'p> CollapsingHeader<'ui, 'p> {
pub fn new(label: &'p ImStr) -> Self {
pub(crate) fn new(label: &'p ImStr) -> Self {
CollapsingHeader {
label: label,
flags: ImGuiTreeNodeFlags::empty(),

View File

@ -26,7 +26,7 @@ pub struct Window<'ui, 'p> {
}
impl<'ui, 'p> Window<'ui, 'p> {
pub fn new(name: &'p ImStr) -> Window<'ui, 'p> {
pub(crate) fn new(name: &'p ImStr) -> Window<'ui, 'p> {
Window {
pos: (0.0, 0.0),
pos_cond: ImGuiSetCond::empty(),