pub struct ColorSlider { /* private fields */ }Expand description
ColorSlider — adjusts a single channel along a gradient track.
Implementations§
Source§impl ColorSlider
impl ColorSlider
Sourcepub fn new(
id: impl Into<ElementId>,
value: PickerColor,
channel: ColorChannel,
) -> Self
pub fn new( id: impl Into<ElementId>, value: PickerColor, channel: ColorChannel, ) -> Self
Creates a slider editing channel of value.
Sourcepub fn name(self, name: impl Into<SharedString>) -> Self
pub fn name(self, name: impl Into<SharedString>) -> Self
name — the name this control submits under.
Sourcepub fn form_field(&self) -> Option<FormField>
pub fn form_field(&self) -> Option<FormField>
The Form field this control submits, when it has a name.
v3 discovers a field through the DOM; gpui gives a child no way to reach its ancestor, so the control hands the pair over instead. Borrows, so the control is still yours to place:
let field = control.form_field();
form.field(field.unwrap()).child(control)Sourcepub fn default_value(self, value: PickerColor) -> Self
pub fn default_value(self, value: PickerColor) -> Self
defaultValue — the uncontrolled initial colour.
Supplying it hands the component its own state: the constructor’s
value becomes the seed, and a change moves the component’s copy.
Sourcepub fn color_space(self, space: ColorSpace) -> Self
pub fn color_space(self, space: ColorSpace) -> Self
orientation — a vertical slider runs bottom to top.
colorSpace — the space the channel is read in. Defaults to HSB, the
space PickerColor stores.
Sourcepub fn orientation(self, orientation: Orientation) -> Self
pub fn orientation(self, orientation: Orientation) -> Self
Sets the slider orientation (orientation).
Sourcepub fn on_change_end(
self,
handler: impl Fn(&PickerColor, &mut Window, &mut App) + 'static,
) -> Self
pub fn on_change_end( self, handler: impl Fn(&PickerColor, &mut Window, &mut App) + 'static, ) -> Self
onChangeEnd — fires once when the drag finishes.
Sourcepub fn length(self, length: impl Into<Pixels>) -> Self
pub fn length(self, length: impl Into<Pixels>) -> Self
Sets the length of the slider along its axis.
Sourcepub fn output(
self,
render: impl Fn(PickerColor, &str) -> AnyElement + 'static,
) -> Self
pub fn output( self, render: impl Fn(PickerColor, &str) -> AnyElement + 'static, ) -> Self
ColorSlider.Output’s render function — v3 hands it the color, which
is what this closure takes along with the value as v3 formats it.
Sourcepub fn thumb(
self,
render: impl Fn(ColorSliderThumbState) -> AnyElement + 'static,
) -> Self
pub fn thumb( self, render: impl Fn(ColorSliderThumbState) -> AnyElement + 'static, ) -> Self
ColorSlider.Thumb’s render function — the closure receives the shared
ColorThumb interaction state while the built-in thumb retains its
positioning, focus and drag behavior.
Sourcepub fn show_label(self, v: bool) -> Self
pub fn show_label(self, v: bool) -> Self
Sets whether the label is shown.
Sourcepub fn is_disabled(self, v: bool) -> Self
pub fn is_disabled(self, v: bool) -> Self
Sets whether the slider is disabled (isDisabled).
Trait Implementations§
Source§impl Disableable for ColorSlider
impl Disableable for ColorSlider
Source§fn is_disabled(self, disabled: bool) -> Self
fn is_disabled(self, disabled: bool) -> Self
isDisabled — whether the component is disabled.Source§impl IntoElement for ColorSlider
impl IntoElement for ColorSlider
Source§type Element = ViewElement<ColorSlider>
type Element = ViewElement<ColorSlider>
Source§fn into_element(self) -> Self::Element
fn into_element(self) -> Self::Element
Element.Source§fn into_any_element(self) -> AnyElement
fn into_any_element(self) -> AnyElement
AnyElement.Source§impl RenderOnce for ColorSlider
impl RenderOnce for ColorSlider
Source§fn render(self, window: &mut Window, cx: &mut App) -> impl IntoElement
fn render(self, window: &mut Window, cx: &mut App) -> impl IntoElement
Render::render() method
which takes a mutable reference.Auto Trait Implementations§
impl !RefUnwindSafe for ColorSlider
impl !Send for ColorSlider
impl !Sync for ColorSlider
impl !UnwindSafe for ColorSlider
impl Freeze for ColorSlider
impl Unpin for ColorSlider
impl UnsafeUnpin for ColorSlider
Blanket Implementations§
Source§impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
Source§fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
Source§fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
Source§fn with_spring<T>(
self,
id: impl Into<ElementId>,
animation: SpringAnimation<T>,
animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static,
) -> SpringAnimationElement<Self>
fn with_spring<T>( self, id: impl Into<ElementId>, animation: SpringAnimation<T>, animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static, ) -> SpringAnimationElement<Self>
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> FluentBuilder for Twhere
T: IntoElement,
impl<T> FluentBuilder for Twhere
T: IntoElement,
Source§fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
Source§fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
Source§fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more