mirror of
https://github.com/eliasstepanik/imgui-rs.git
synced 2026-01-26 21:08:40 +00:00
Rename enums EditableColor* -> Color*
This commit is contained in:
parent
c718bce60d
commit
ad6a5ada1b
@ -21,6 +21,7 @@ pub fn run<F: FnMut(&Ui) -> bool>(title: String, clear_color: [f32; 4], mut run_
|
|||||||
let display = Display::new(window, context, &events_loop).unwrap();
|
let display = Display::new(window, context, &events_loop).unwrap();
|
||||||
|
|
||||||
let mut imgui = ImGui::init();
|
let mut imgui = ImGui::init();
|
||||||
|
imgui.set_ini_filename(None);
|
||||||
let mut renderer = Renderer::init(&mut imgui, &display).expect("Failed to initialize renderer");
|
let mut renderer = Renderer::init(&mut imgui, &display).expect("Failed to initialize renderer");
|
||||||
|
|
||||||
configure_keys(&mut imgui);
|
configure_keys(&mut imgui);
|
||||||
|
|||||||
@ -470,7 +470,7 @@ fn show_test_window<'a>(ui: &Ui<'a>, state: &mut State, opened: &mut bool) {
|
|||||||
ui.text(im_str!("Color widget with Float Display:"));
|
ui.text(im_str!("Color widget with Float Display:"));
|
||||||
ui.color_edit(im_str!("MyColor##2f"), &mut s.color)
|
ui.color_edit(im_str!("MyColor##2f"), &mut s.color)
|
||||||
.flags(misc_flags)
|
.flags(misc_flags)
|
||||||
.format(EditableColorFormat::Float)
|
.format(ColorFormat::Float)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
ui.text(im_str!("Color button with Picker:"));
|
ui.text(im_str!("Color button with Picker:"));
|
||||||
|
|||||||
@ -54,7 +54,7 @@ pub enum ColorPickerMode {
|
|||||||
|
|
||||||
/// Color component formatting.
|
/// Color component formatting.
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
||||||
pub enum EditableColorFormat {
|
pub enum ColorFormat {
|
||||||
/// Display values formatted as 0..255.
|
/// Display values formatted as 0..255.
|
||||||
U8,
|
U8,
|
||||||
/// Display values formatted as 0.0..1.0.
|
/// Display values formatted as 0.0..1.0.
|
||||||
@ -63,7 +63,7 @@ pub enum EditableColorFormat {
|
|||||||
|
|
||||||
/// Color editor preview style.
|
/// Color editor preview style.
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
||||||
pub enum EditableColorPreview {
|
pub enum ColorPreview {
|
||||||
/// Don't show the alpha component.
|
/// Don't show the alpha component.
|
||||||
Opaque,
|
Opaque,
|
||||||
/// Half of the preview area shows the alpha component using a checkerboard pattern.
|
/// Half of the preview area shows the alpha component using a checkerboard pattern.
|
||||||
@ -149,20 +149,20 @@ impl<'ui, 'p> ColorEdit<'ui, 'p> {
|
|||||||
}
|
}
|
||||||
/// Sets the preview style.
|
/// Sets the preview style.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn preview(mut self, preview: EditableColorPreview) -> Self {
|
pub fn preview(mut self, preview: ColorPreview) -> Self {
|
||||||
self.flags.set(
|
self.flags.set(
|
||||||
ImGuiColorEditFlags::AlphaPreviewHalf,
|
ImGuiColorEditFlags::AlphaPreviewHalf,
|
||||||
preview == EditableColorPreview::HalfAlpha,
|
preview == ColorPreview::HalfAlpha,
|
||||||
);
|
);
|
||||||
self.flags.set(
|
self.flags.set(
|
||||||
ImGuiColorEditFlags::AlphaPreview,
|
ImGuiColorEditFlags::AlphaPreview,
|
||||||
preview == EditableColorPreview::Alpha,
|
preview == ColorPreview::Alpha,
|
||||||
);
|
);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
/// (WIP) Currently only disables 0.0..1.0 limits in RGBA edition.
|
/// (WIP) Currently only disables 0.0..1.0 limits in RGBA edition.
|
||||||
///
|
///
|
||||||
/// Note: you probably want to use EditableColorFormat::Float as well.
|
/// Note: you probably want to use ColorFormat::Float as well.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn hdr(mut self, value: bool) -> Self {
|
pub fn hdr(mut self, value: bool) -> Self {
|
||||||
self.flags.set(ImGuiColorEditFlags::HDR, value);
|
self.flags.set(ImGuiColorEditFlags::HDR, value);
|
||||||
@ -187,14 +187,14 @@ impl<'ui, 'p> ColorEdit<'ui, 'p> {
|
|||||||
}
|
}
|
||||||
/// Sets the formatting style of color components.
|
/// Sets the formatting style of color components.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn format(mut self, format: EditableColorFormat) -> Self {
|
pub fn format(mut self, format: ColorFormat) -> Self {
|
||||||
self.flags.set(
|
self.flags.set(
|
||||||
ImGuiColorEditFlags::Uint8,
|
ImGuiColorEditFlags::Uint8,
|
||||||
format == EditableColorFormat::U8,
|
format == ColorFormat::U8,
|
||||||
);
|
);
|
||||||
self.flags.set(
|
self.flags.set(
|
||||||
ImGuiColorEditFlags::Float,
|
ImGuiColorEditFlags::Float,
|
||||||
format == EditableColorFormat::Float,
|
format == ColorFormat::Float,
|
||||||
);
|
);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
@ -283,14 +283,14 @@ impl<'ui, 'p> ColorPicker<'ui, 'p> {
|
|||||||
}
|
}
|
||||||
/// Sets the preview style.
|
/// Sets the preview style.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn preview(mut self, preview: EditableColorPreview) -> Self {
|
pub fn preview(mut self, preview: ColorPreview) -> Self {
|
||||||
self.flags.set(
|
self.flags.set(
|
||||||
ImGuiColorEditFlags::AlphaPreviewHalf,
|
ImGuiColorEditFlags::AlphaPreviewHalf,
|
||||||
preview == EditableColorPreview::HalfAlpha,
|
preview == ColorPreview::HalfAlpha,
|
||||||
);
|
);
|
||||||
self.flags.set(
|
self.flags.set(
|
||||||
ImGuiColorEditFlags::AlphaPreview,
|
ImGuiColorEditFlags::AlphaPreview,
|
||||||
preview == EditableColorPreview::Alpha,
|
preview == ColorPreview::Alpha,
|
||||||
);
|
);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
@ -327,14 +327,14 @@ impl<'ui, 'p> ColorPicker<'ui, 'p> {
|
|||||||
}
|
}
|
||||||
/// Sets the formatting style of color components.
|
/// Sets the formatting style of color components.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn format(mut self, format: EditableColorFormat) -> Self {
|
pub fn format(mut self, format: ColorFormat) -> Self {
|
||||||
self.flags.set(
|
self.flags.set(
|
||||||
ImGuiColorEditFlags::Uint8,
|
ImGuiColorEditFlags::Uint8,
|
||||||
format == EditableColorFormat::U8,
|
format == ColorFormat::U8,
|
||||||
);
|
);
|
||||||
self.flags.set(
|
self.flags.set(
|
||||||
ImGuiColorEditFlags::Float,
|
ImGuiColorEditFlags::Float,
|
||||||
format == EditableColorFormat::Float,
|
format == ColorFormat::Float,
|
||||||
);
|
);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
@ -402,27 +402,27 @@ impl<'ui, 'p> ColorButton<'ui, 'p> {
|
|||||||
}
|
}
|
||||||
/// Sets the preview style.
|
/// Sets the preview style.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn preview(mut self, preview: EditableColorPreview) -> Self {
|
pub fn preview(mut self, preview: ColorPreview) -> Self {
|
||||||
self.flags.set(
|
self.flags.set(
|
||||||
ImGuiColorEditFlags::AlphaPreviewHalf,
|
ImGuiColorEditFlags::AlphaPreviewHalf,
|
||||||
preview == EditableColorPreview::HalfAlpha,
|
preview == ColorPreview::HalfAlpha,
|
||||||
);
|
);
|
||||||
self.flags.set(
|
self.flags.set(
|
||||||
ImGuiColorEditFlags::AlphaPreview,
|
ImGuiColorEditFlags::AlphaPreview,
|
||||||
preview == EditableColorPreview::Alpha,
|
preview == ColorPreview::Alpha,
|
||||||
);
|
);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
/// Sets the formatting style of color components.
|
/// Sets the formatting style of color components.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn format(mut self, format: EditableColorFormat) -> Self {
|
pub fn format(mut self, format: ColorFormat) -> Self {
|
||||||
self.flags.set(
|
self.flags.set(
|
||||||
ImGuiColorEditFlags::Uint8,
|
ImGuiColorEditFlags::Uint8,
|
||||||
format == EditableColorFormat::U8,
|
format == ColorFormat::U8,
|
||||||
);
|
);
|
||||||
self.flags.set(
|
self.flags.set(
|
||||||
ImGuiColorEditFlags::Float,
|
ImGuiColorEditFlags::Float,
|
||||||
format == EditableColorFormat::Float,
|
format == ColorFormat::Float,
|
||||||
);
|
);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,8 +38,7 @@ pub use sys::{ImDrawIdx, ImDrawVert, ImGuiColorEditFlags, ImGuiInputTextFlags, I
|
|||||||
ImGuiSelectableFlags, ImGuiCond, ImGuiCol, ImGuiStyle, ImGuiTreeNodeFlags,
|
ImGuiSelectableFlags, ImGuiCond, ImGuiCol, ImGuiStyle, ImGuiTreeNodeFlags,
|
||||||
ImGuiWindowFlags, ImVec2, ImVec4};
|
ImGuiWindowFlags, ImVec2, ImVec4};
|
||||||
pub use child_frame::ChildFrame;
|
pub use child_frame::ChildFrame;
|
||||||
pub use color_editors::{ColorButton, ColorEdit, ColorEditMode, ColorPicker, ColorPickerMode,
|
pub use color_editors::{ColorButton, ColorEdit, ColorEditMode, ColorFormat, ColorPicker, ColorPickerMode, ColorPreview, EditableColor};
|
||||||
EditableColor, EditableColorFormat, EditableColorPreview};
|
|
||||||
pub use input::{InputFloat, InputFloat2, InputFloat3, InputFloat4, InputInt, InputInt2, InputInt3,
|
pub use input::{InputFloat, InputFloat2, InputFloat3, InputFloat4, InputInt, InputInt2, InputInt3,
|
||||||
InputInt4, InputText};
|
InputInt4, InputText};
|
||||||
pub use menus::{Menu, MenuItem};
|
pub use menus::{Menu, MenuItem};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user