Struct egui::output::WidgetInfo
source · [−]pub struct WidgetInfo {
pub typ: WidgetType,
pub enabled: bool,
pub label: Option<String>,
pub current_text_value: Option<String>,
pub prev_text_value: Option<String>,
pub selected: Option<bool>,
pub value: Option<f64>,
pub text_selection: Option<RangeInclusive<usize>>,
}
Expand description
Describes a widget such as a crate::Button
or a crate::TextEdit
.
Fields
typ: WidgetType
The type of widget this is.
enabled: bool
label: Option<String>
The text on labels, buttons, checkboxes etc.
current_text_value: Option<String>
The contents of some editable text (for TextEdit
fields).
prev_text_value: Option<String>
selected: Option<bool>
The current value of checkboxes and radio buttons.
value: Option<f64>
The current value of sliders etc.
text_selection: Option<RangeInclusive<usize>>
Implementations
sourceimpl WidgetInfo
impl WidgetInfo
pub fn new(typ: WidgetType) -> Self
pub fn labeled(typ: WidgetType, label: impl ToString) -> Self
sourcepub fn selected(typ: WidgetType, selected: bool, label: impl ToString) -> Self
pub fn selected(typ: WidgetType, selected: bool, label: impl ToString) -> Self
checkboxes, radio-buttons etc
pub fn drag_value(value: f64) -> Self
pub fn slider(value: f64, label: impl ToString) -> Self
pub fn text_edit(
prev_text_value: impl ToString,
text_value: impl ToString
) -> Self
pub fn text_selection_changed(
text_selection: RangeInclusive<usize>,
current_text_value: impl ToString
) -> Self
sourcepub fn description(&self) -> String
pub fn description(&self) -> String
This can be used by a text-to-speech system to describe the widget.
Trait Implementations
sourceimpl Clone for WidgetInfo
impl Clone for WidgetInfo
sourcefn clone(&self) -> WidgetInfo
fn clone(&self) -> WidgetInfo
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for WidgetInfo
impl Debug for WidgetInfo
sourceimpl<'de> Deserialize<'de> for WidgetInfo
impl<'de> Deserialize<'de> for WidgetInfo
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl PartialEq<WidgetInfo> for WidgetInfo
impl PartialEq<WidgetInfo> for WidgetInfo
sourcefn eq(&self, other: &WidgetInfo) -> bool
fn eq(&self, other: &WidgetInfo) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &WidgetInfo) -> bool
fn ne(&self, other: &WidgetInfo) -> bool
This method tests for !=
.
sourceimpl Serialize for WidgetInfo
impl Serialize for WidgetInfo
impl StructuralPartialEq for WidgetInfo
Auto Trait Implementations
impl RefUnwindSafe for WidgetInfo
impl Send for WidgetInfo
impl Sync for WidgetInfo
impl Unpin for WidgetInfo
impl UnwindSafe for WidgetInfo
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more