Track enabled/disabled status.
This commit is contained in:
parent
2433506c92
commit
73271a6265
1 changed files with 9 additions and 0 deletions
|
@ -237,6 +237,8 @@ impl std::fmt::Debug for OutputEvent {
|
||||||
pub struct WidgetInfo {
|
pub struct WidgetInfo {
|
||||||
/// The type of widget this is.
|
/// The type of widget this is.
|
||||||
pub typ: WidgetType,
|
pub typ: WidgetType,
|
||||||
|
// Whether the widget is enabled.
|
||||||
|
pub enabled: bool,
|
||||||
/// The text on labels, buttons, checkboxes etc.
|
/// The text on labels, buttons, checkboxes etc.
|
||||||
pub label: Option<String>,
|
pub label: Option<String>,
|
||||||
/// The contents of some editable text (for `TextEdit` fields).
|
/// The contents of some editable text (for `TextEdit` fields).
|
||||||
|
@ -257,6 +259,7 @@ impl std::fmt::Debug for WidgetInfo {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
let Self {
|
let Self {
|
||||||
typ,
|
typ,
|
||||||
|
enabled,
|
||||||
label,
|
label,
|
||||||
text_value,
|
text_value,
|
||||||
prev_text_value,
|
prev_text_value,
|
||||||
|
@ -269,6 +272,7 @@ impl std::fmt::Debug for WidgetInfo {
|
||||||
let mut s = f.debug_struct("WidgetInfo");
|
let mut s = f.debug_struct("WidgetInfo");
|
||||||
|
|
||||||
s.field("typ", typ);
|
s.field("typ", typ);
|
||||||
|
s.field("enabled", enabled);
|
||||||
|
|
||||||
if let Some(label) = label {
|
if let Some(label) = label {
|
||||||
s.field("label", label);
|
s.field("label", label);
|
||||||
|
@ -300,6 +304,7 @@ impl WidgetInfo {
|
||||||
pub fn new(typ: WidgetType) -> Self {
|
pub fn new(typ: WidgetType) -> Self {
|
||||||
Self {
|
Self {
|
||||||
typ,
|
typ,
|
||||||
|
enabled: true,
|
||||||
label: None,
|
label: None,
|
||||||
text_value: None,
|
text_value: None,
|
||||||
prev_text_value: None,
|
prev_text_value: None,
|
||||||
|
@ -372,6 +377,7 @@ impl WidgetInfo {
|
||||||
pub fn description(&self) -> String {
|
pub fn description(&self) -> String {
|
||||||
let Self {
|
let Self {
|
||||||
typ,
|
typ,
|
||||||
|
enabled,
|
||||||
label,
|
label,
|
||||||
text_value,
|
text_value,
|
||||||
prev_text_value: _,
|
prev_text_value: _,
|
||||||
|
@ -432,6 +438,9 @@ impl WidgetInfo {
|
||||||
description += &value.to_string();
|
description += &value.to_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !enabled {
|
||||||
|
description += ": disabled";
|
||||||
|
}
|
||||||
description.trim().to_owned()
|
description.trim().to_owned()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue