From 7b4e9ba4f62ef7868392636c67f2ee73d902f70d Mon Sep 17 00:00:00 2001 From: elkowar <5300871+elkowar@users.noreply.github.com> Date: Wed, 27 Apr 2022 20:10:47 +0200 Subject: [PATCH] Adjust widget documentation to match new action system --- crates/eww/src/widgets/widget_definitions.rs | 30 ++++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/crates/eww/src/widgets/widget_definitions.rs b/crates/eww/src/widgets/widget_definitions.rs index 884e28e00..eff426d37 100644 --- a/crates/eww/src/widgets/widget_definitions.rs +++ b/crates/eww/src/widgets/widget_definitions.rs @@ -219,7 +219,7 @@ pub(super) fn resolve_range_attrs(bargs: &mut BuilderArgs, gtk_widget: >k::Ran // @prop max - the maximum value prop(max: as_f64) { gtk_widget.adjustment().set_upper(max)}, // @prop timeout - timeout of the command - // @prop onchange - command executed once the value is changes. The placeholder `{}`, used in the command will be replaced by the new value. + // @prop onchange - executed once the value changes. Event object: `{"value": }` prop(timeout: as_duration = Duration::from_millis(200), onchange: as_action) { let scope_sender = graph.event_sender.clone(); gtk_widget.set_sensitive(true); @@ -258,7 +258,7 @@ fn build_gtk_combo_box_text(bargs: &mut BuilderArgs) -> Result}` prop(timeout: as_duration = Duration::from_millis(200), onchange: as_action) { let scope_sender = graph.event_sender.clone(); connect_signal_handler!(gtk_widget, gtk_widget.connect_changed(move |gtk_widget| { @@ -304,8 +304,8 @@ fn build_gtk_checkbox(bargs: &mut BuilderArgs) -> Result { let calling_scope = bargs.calling_scope.clone(); def_widget!(bargs, graph, gtk_widget, { // @prop timeout - timeout of the command - // @prop onchecked - action (command) to be executed when checked by the user - // @prop onunchecked - similar to onchecked but when the widget is unchecked + // @prop onchecked - executed when checked by the user + // @prop onunchecked - executed when unchecked by the user prop(timeout: as_duration = Duration::from_millis(200), onchecked: as_action?, onunchecked: as_action?) { let scope_sender = graph.event_sender.clone(); connect_signal_handler!(gtk_widget, gtk_widget.connect_toggled(move |gtk_widget| { @@ -327,7 +327,7 @@ fn build_gtk_color_button(bargs: &mut BuilderArgs) -> Result { // @prop use-alpha - bool to whether or not use alpha prop(use_alpha: as_bool) {gtk_widget.set_use_alpha(use_alpha);}, - // @prop onchange - runs the code when the color was selected + // @prop onchange - executed when a color was selected. Event object: `{"value": }` // @prop timeout - timeout of the command prop(timeout: as_duration = Duration::from_millis(200), onchange: as_action) { let scope_sender = graph.event_sender.clone(); @@ -350,7 +350,7 @@ fn build_gtk_color_chooser(bargs: &mut BuilderArgs) -> Result}` // @prop timeout - timeout of the command prop(timeout: as_duration = Duration::from_millis(200), onchange: as_action) { let scope_sender = graph.event_sender.clone(); @@ -415,7 +415,7 @@ fn build_gtk_input(bargs: &mut BuilderArgs) -> Result { gtk_widget.set_text(&value); }, - // @prop onchange - Command to run when the text changes. The placeholder `{}` will be replaced by the value + // @prop onchange - Executed when the text changes. Event object: `{"value": }` // @prop timeout - timeout of the command prop(timeout: as_duration = Duration::from_millis(200), onchange: as_action) { let scope_sender = graph.event_sender.clone(); @@ -435,9 +435,9 @@ fn build_gtk_button(bargs: &mut BuilderArgs) -> Result { let calling_scope = bargs.calling_scope.clone(); def_widget!(bargs, graph, gtk_widget, { - // @prop onclick - a command that get's run when the button is clicked - // @prop onmiddleclick - a command that get's run when the button is middleclicked - // @prop onrightclick - a command that get's run when the button is rightclicked + // @prop onclick - executed when the button is left-clicked + // @prop onmiddleclick - executed when the button is left-clicked + // @prop onrightclick - executed when the button is left-clicked // @prop timeout - timeout of the command prop( timeout: as_duration = Duration::from_millis(200), @@ -589,7 +589,7 @@ fn build_gtk_event_box(bargs: &mut BuilderArgs) -> Result { def_widget!(bargs, graph, gtk_widget, { // @prop timeout - timeout of the command - // @prop onscroll - event to execute when the user scrolls with the mouse over the widget. The placeholder `{}` used in the command will be replaced with either `up` or `down`. + // @prop onscroll - executed when the user scrolls with the mouse over the widget. Event object: `{"direction": <"up" or "down">}` prop(timeout: as_duration = Duration::from_millis(200), onscroll: as_action) { let scope_sender = graph.event_sender.clone(); gtk_widget.add_events(gdk::EventMask::SCROLL_MASK); @@ -604,7 +604,7 @@ fn build_gtk_event_box(bargs: &mut BuilderArgs) -> Result { })); }, // @prop timeout - timeout of the command - // @prop onhover - event to execute when the user hovers over the widget + // @prop onhover - executed when the user hovers over the widget. Event object: `{"x": , ""}` prop(timeout: as_duration = Duration::from_millis(200), onhover: as_action) { let scope_sender = graph.event_sender.clone(); gtk_widget.add_events(gdk::EventMask::ENTER_NOTIFY_MASK); @@ -617,7 +617,7 @@ fn build_gtk_event_box(bargs: &mut BuilderArgs) -> Result { })); }, // @prop timeout - timeout of the command - // @prop onhoverlost - event to execute when the user losts hovers over the widget + // @prop onhoverlost - executed when the users mouse leaves the widget. Event object: `{"x": , ""}` prop(timeout: as_duration = Duration::from_millis(200), onhoverlost: as_action) { let scope_sender = graph.event_sender.clone(); gtk_widget.add_events(gdk::EventMask::LEAVE_NOTIFY_MASK); @@ -655,7 +655,7 @@ fn build_gtk_event_box(bargs: &mut BuilderArgs) -> Result { })); }, // @prop timeout - timeout of the command - // @prop on_dropped - Command to execute when something is dropped on top of this element. The placeholder `{}` used in the command will be replaced with the uri to the dropped thing. + // @prop on_dropped - executed when something is dropped on top of this element. Event object: `{"data": , "type": <"file" or "text">}` prop(timeout: as_duration = Duration::from_millis(200), ondropped: as_action) { let scope_sender = graph.event_sender.clone(); gtk_widget.drag_dest_set( @@ -808,7 +808,7 @@ fn build_gtk_calendar(bargs: &mut BuilderArgs) -> Result { prop(show_day_names: as_bool) { gtk_widget.set_show_day_names(show_day_names) }, // @prop show-week-numbers - show week numbers prop(show_week_numbers: as_bool) { gtk_widget.set_show_week_numbers(show_week_numbers) }, - // @prop onclick - command to run when the user selects a date. The `{0}` placeholder will be replaced by the selected day, `{1}` will be replaced by the month, and `{2}` by the year. + // @prop onclick - executed when the user selects a date. Event object `{"day": , "month": , "year": }` // @prop timeout - timeout of the command prop(timeout: as_duration = Duration::from_millis(200), onclick: as_action) { let scope_sender = graph.event_sender.clone();