From dd3c50f3ac173c8019915bcf143e75e49c3b9c93 Mon Sep 17 00:00:00 2001 From: "ay9thqi3tbqiwbegqsg a[soiaosshasdg" <30902201+alx365@users.noreply.github.com> Date: Mon, 26 Oct 2020 13:41:57 +0000 Subject: [PATCH] fixed widget docs issues, with missing descriptions and renamed a widget (#47) * fixed widget docs issues, with missing descriptions and combo box is renamed to combo box text, cause thats what it's actually is * forgot this one thing * Update src/widgets/widget_definitions.rs Co-authored-by: ElKowar <5300871+elkowar@users.noreply.github.com> * Update src/widgets/widget_definitions.rs Co-authored-by: ElKowar <5300871+elkowar@users.noreply.github.com> * Update src/widgets/widget_definitions.rs Co-authored-by: ElKowar <5300871+elkowar@users.noreply.github.com> * Update src/widgets/widget_definitions.rs Co-authored-by: ElKowar <5300871+elkowar@users.noreply.github.com> * Update src/widgets/widget_definitions.rs Co-authored-by: ElKowar <5300871+elkowar@users.noreply.github.com> Co-authored-by: ElKowar <5300871+elkowar@users.noreply.github.com> --- src/widgets/widget_definitions.rs | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/widgets/widget_definitions.rs b/src/widgets/widget_definitions.rs index 6427c40..a9d26b2 100644 --- a/src/widgets/widget_definitions.rs +++ b/src/widgets/widget_definitions.rs @@ -23,7 +23,7 @@ pub(super) fn widget_to_gtk_widget(bargs: &mut BuilderArgs) -> Result build_gtk_color_button(bargs)?.upcast(), "expander" => build_gtk_expander(bargs)?.upcast(), "color-chooser" => build_gtk_color_chooser(bargs)?.upcast(), - "combo-box" => build_gtk_combo_box(bargs)?.upcast(), + "combo-box-text" => build_gtk_combo_box_text(bargs)?.upcast(), _ => return Ok(None), }; Ok(Some(gtk_widget)) @@ -148,12 +148,13 @@ pub(super) fn resolve_orientable_attrs(bargs: &mut BuilderArgs, gtk_widget: >k // concrete widgets -/// @widget combo-box -fn build_gtk_combo_box(bargs: &mut BuilderArgs) -> Result { +/// @widget combo-box-text +/// @desc A combo box allowing the user to choose between several items. +fn build_gtk_combo_box_text(bargs: &mut BuilderArgs) -> Result { let gtk_widget = gtk::ComboBoxText::new(); let on_change_handler_id: Rc>> = Rc::new(RefCell::new(None)); resolve_block!(bargs, gtk_widget, { - // @prop items + // @prop items - Items that should be displayed in the combo box prop(items: as_vec) { gtk_widget.remove_all(); for i in items { @@ -173,7 +174,7 @@ fn build_gtk_combo_box(bargs: &mut BuilderArgs) -> Result { Ok(gtk_widget) } /// @widget expander extends container -/// @desc a widget that can expand and collapse, showing / hiding it's children. +/// @desc A widget that can expand and collapse, showing/hiding it's children. fn build_gtk_expander(bargs: &mut BuilderArgs) -> Result { let gtk_widget = gtk::Expander::new(None); resolve_block!(bargs, gtk_widget, { @@ -186,6 +187,7 @@ fn build_gtk_expander(bargs: &mut BuilderArgs) -> Result { } /// @widget color-button +/// @desc A button opening a color chooser window fn build_gtk_color_button(bargs: &mut BuilderArgs) -> Result { let gtk_widget = gtk::ColorButtonBuilder::new().build(); let on_change_handler_id: Rc>> = Rc::new(RefCell::new(None)); @@ -208,6 +210,7 @@ fn build_gtk_color_button(bargs: &mut BuilderArgs) -> Result { } /// @widget color-chooser +/// @desc A color chooser widget fn build_gtk_color_chooser(bargs: &mut BuilderArgs) -> Result { let gtk_widget = gtk::ColorChooserWidget::new(); let on_change_handler_id: Rc>> = Rc::new(RefCell::new(None)); @@ -230,7 +233,7 @@ fn build_gtk_color_chooser(bargs: &mut BuilderArgs) -> Result Result { let gtk_widget = gtk::Scale::new( gtk::Orientation::Horizontal, @@ -247,7 +250,7 @@ fn build_gtk_scale(bargs: &mut BuilderArgs) -> Result { } /// @widget input -/// @desc an input field. For this to be useful, set `focusable="true"` on the window. +/// @desc An input field. For this to be useful, set `focusable="true"` on the window. fn build_gtk_input(bargs: &mut BuilderArgs) -> Result { let gtk_widget = gtk::Entry::new(); let on_change_handler_id: Rc>> = Rc::new(RefCell::new(None)); @@ -271,6 +274,7 @@ fn build_gtk_input(bargs: &mut BuilderArgs) -> Result { } /// @widget button extends container +/// @desc A button fn build_gtk_button(bargs: &mut BuilderArgs) -> Result { let gtk_widget = gtk::Button::new(); let on_click_handler_id: Rc>> = Rc::new(RefCell::new(None)); @@ -289,6 +293,7 @@ fn build_gtk_button(bargs: &mut BuilderArgs) -> Result { } /// @widget image +/// @desc A widget displaying an image fn build_gtk_image(bargs: &mut BuilderArgs) -> Result { let gtk_widget = gtk::Image::new(); resolve_block!(bargs, gtk_widget, { @@ -319,6 +324,7 @@ fn build_gtk_box(bargs: &mut BuilderArgs) -> Result { } /// @widget label +/// @desc A text widget giving you more control over how the text is displayed fn build_gtk_label(bargs: &mut BuilderArgs) -> Result { let gtk_widget = gtk::Label::new(None); @@ -341,7 +347,7 @@ fn build_gtk_label(bargs: &mut BuilderArgs) -> Result { } /// @widget literal -/// @desc a tag that allows you to render arbitrary XML. +/// @desc A widget that allows you to render arbitrary XML. fn build_gtk_literal(bargs: &mut BuilderArgs) -> Result { let gtk_widget = gtk::Frame::new(None); // TODO these clones here are dumdum @@ -370,6 +376,7 @@ fn build_gtk_literal(bargs: &mut BuilderArgs) -> Result { } /// @widget calendar +/// @widget A widget that displays a calendar fn build_gtk_calendar(bargs: &mut BuilderArgs) -> Result { let gtk_widget = gtk::Calendar::new(); let on_click_handler_id: Rc>> = Rc::new(RefCell::new(None));