Struct arcdps_imgui::ColorEdit

source ·
pub struct ColorEdit<'a, T: AsRef<str> + 'a> { /* private fields */ }
Expand description

Builder for a color editor widget.

§Examples

let ce = ColorEdit::new(im_str!("color_edit"), &mut color);
if ce.build(&ui) {
  println!("The color was changed");
}

Implementations§

source§

impl<'a, T: AsRef<str> + 'a> ColorEdit<'a, T>

source

pub fn new(label: T, value: impl Into<EditableColor<'a>>) -> ColorEdit<'a, T>

Constructs a new color editor builder.

source

pub fn flags(self, flags: ColorEditFlags) -> Self

Replaces all current settings with the given flags.

source

pub fn alpha(self, value: bool) -> Self

Enables/disables the use of the alpha component.

source

pub fn picker(self, value: bool) -> Self

Enables/disables the picker that appears when clicking on colored square.

source

pub fn options(self, value: bool) -> Self

Enables/disables toggling of the options menu when right-clicking on inputs or the small preview.

source

pub fn small_preview(self, value: bool) -> Self

Enables/disables the colored square preview next to the inputs.

source

pub fn inputs(self, value: bool) -> Self

Enables/disables the input sliders/text widgets.

source

pub fn tooltip(self, value: bool) -> Self

Enables/disables the tooltip that appears when hovering the preview.

source

pub fn label(self, value: bool) -> Self

Enables/disables display of the inline text label (the label is in any case forwarded to the tooltip and picker).

source

pub fn alpha_bar(self, value: bool) -> Self

Enables/disables the vertical alpha bar/gradient in the color picker.

source

pub fn preview(self, preview: ColorPreview) -> Self

Sets the preview style.

source

pub fn hdr(self, value: bool) -> Self

(WIP) Currently only disables 0.0..1.0 limits in RGBA edition.

Note: you probably want to use ColorFormat::Float as well.

source

pub fn input_mode(self, input_mode: ColorEditInputMode) -> Self

Sets the data format for input and output data.

source

pub fn display_mode(self, mode: ColorEditDisplayMode) -> Self

Sets the color editor display mode.

source

pub fn format(self, format: ColorFormat) -> Self

Sets the formatting style of color components.

source

pub fn build(self, ui: &Ui<'_>) -> bool

Builds the color editor.

Returns true if the color value was changed.

Trait Implementations§

source§

impl<'a, T: Debug + AsRef<str> + 'a> Debug for ColorEdit<'a, T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, T> Freeze for ColorEdit<'a, T>
where T: Freeze,

§

impl<'a, T> RefUnwindSafe for ColorEdit<'a, T>
where T: RefUnwindSafe,

§

impl<'a, T> Send for ColorEdit<'a, T>
where T: Send,

§

impl<'a, T> Sync for ColorEdit<'a, T>
where T: Sync,

§

impl<'a, T> Unpin for ColorEdit<'a, T>
where T: Unpin,

§

impl<'a, T> !UnwindSafe for ColorEdit<'a, T>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.