Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Scale widget #83

Closed
can-lehmann opened this issue Sep 16, 2023 · 29 comments
Closed

Add Scale widget #83

can-lehmann opened this issue Sep 16, 2023 · 29 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@can-lehmann
Copy link
Owner

Gtk's Scale widget is currently missing. See https://docs.gtk.org/gtk4/class.Scale.html

@can-lehmann can-lehmann added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Sep 16, 2023
@PhilippMDoerner
Copy link
Contributor

PhilippMDoerner commented Sep 26, 2023

I've been taking a look at this out of curiosity:
I don't quite get how the hooks know how to connect signals.

For example here:

renderable Entry of BaseWidget:
  text: string
  placeholder: string ## Shown when the Entry is empty.
  width: int = -1
  maxWidth: int = -1
  xAlign: float = 0.0
  visibility: bool = true
  invisibleChar: Rune = '*'.Rune

  proc changed(text: string) ## Called when the text in the Entry changed
  proc activate() ## Called when the user presses enter/return

  hooks:
    beforeBuild:
      state.internalWidget = gtk_entry_new()
    connectEvents:
      proc changedCallback(widget: GtkWidget, data: ptr EventObj[proc (text: string)]) {.cdecl.} =
        let text = $gtk_editable_get_text(widget)
        EntryState(data[].widget).text = text
        data[].callback(text)
        data[].redraw()
      
      state.connect(state.changed, "changed", changedCallback)
      state.connect(state.activate, "activate", eventCallback)
    disconnectEvents:
      state.internalWidget.disconnect(state.changed)
      state.internalWidget.disconnect(state.activate)

Owlkettle knows based on the fact that procs were defined on the renderable that there's a changed and an activate "field" on the type which can be connected to the GTK signals so that these procs get called.

But what are "changedCallback" and "eventCallback" and how does one know when to use which?

The only pattern I somewhat recognize across the file is that you're apparently supposed to always write:

state.connect(state.<procName>, "<signal-name>", <procName>EventCallback

with procName in the above examples being changed and activate to the signal-names "changed" and "activate", though the entire eventCallback for activate kinda throws off the pattern. Does what I type as the last parameter just not matter?

@can-lehmann
Copy link
Owner Author

The last parameter refers to the proc that is passed directly to GTK for handling the event. Its job is to:

  1. Read back any state changes from GTK
  2. Call the owlkettle event handler (and pass any arguments it might have)
  3. Call redraw to update the UI after the event was handled.

E.g. for the changed event, which is called when the user input some text, we need to read back the new text and update the Entry.text field with it. Then we call owlkettle's Entry.changed handler and finally we call redraw to update the UI. changedCallback is responsible for doing that.

Other events like activate are simpler, because we do not need to read back state & pass arguments to the owlkettle event handler. This is why there is also a general handler called eventCallback.

In case of the Scale widget, you will need to implement a custom valueChangedCallback, that actually reads back the new position of the scale.

@PhilippMDoerner
Copy link
Contributor

How can you know what the signature of the callback for a given gpointer for a given signal is?
For example for the ColorButton it is defined:

void
color_set (
  GtkColorButton* self,
  gpointer user_data
)

You wrapped that as:

      proc colorSetCallback(widget: GtkWidget, data: ptr EventObj[proc (color: tuple[r, g, b, a: float])]) {.cdecl.} =
        var gdkColor: GdkRgba
        gtk_color_chooser_get_rgba(widget, gdkColor.addr)
        let color = (gdkColor.r.float, gdkColor.g.float, gdkColor.b.float, gdkColor.a.float)
        ColorButtonState(data[].widget).color = color
        data[].callback(color)
        data[].redraw()

So somehow you:

  1. Figured out that gpointer in this context translates to ptr EventObj and
  2. Figured out that the EventObj contains a proc with the signature proc (color: tuple[r, g, b, a: float])

How did you figure that out? Mostly relevant as similarly I need to figure out what's hidden behind the gpointer for valueChanged.

@can-lehmann
Copy link
Owner Author

can-lehmann commented Sep 26, 2023

The type of data is just a pointer to an EventObj that contains your owlkettle callback. Look at the definition of connect: https://github.com/can-lehmann/owlkettle/blob/main/owlkettle/widgetutils.nim#L56

@PhilippMDoerner
Copy link
Contributor

Check. The way I currently see it I don't think it makes sense to wrap https://docs.gtk.org/gtk4/ctor.Scale.new.html as it requires a GtkAdjustment and I don't quite understand what to do with that one.

Wrapping https://docs.gtk.org/gtk4/ctor.Scale.new_with_range.html and using that for instantiation seems "correcter" to me, any thoughts?

@can-lehmann
Copy link
Owner Author

I would personally use gtk_scale_new and pass nil as the Adjustment (see docs), so that it creates its own adjustment internally. The min/max can then be set in the correct hooks via the methods the Range parent class.

@PhilippMDoerner
Copy link
Contributor

Hmm I'll try that out once I've got something functional.
I've got a compileable example for scale at least. But it seems immutable and I can't seem to make it mutable. As in, the slider is frozen at the left-hand side of the scale.

I think this has to do with the Accessible Role: https://docs.gtk.org/gtk4/property.Accessible.accessible-role.html

I can't seem to find a way to define it initially, have you had to deal with that before?

PhilippMDoerner added a commit to PhilippMDoerner/owlkettle that referenced this issue Sep 26, 2023
@PhilippMDoerner
Copy link
Contributor

Above you can see the first "stab" I've taken at the entire thing.
I've so far figured out that accessible relates to general a11y aka accessibility for screen readers etc. not accessing values.

I keep getting stuck at this state of the widget:
image

As you can see its greyed out. It does not move, ever. Similarly the changedValue proc never gets triggered.
But the build-hook for the marks field does trigger and show that echo $(state.internalWidget.gtk_widget_is_sensitive()).bool is true.
I don't know what's going wrong here.

@can-lehmann
Copy link
Owner Author

can-lehmann commented Sep 26, 2023

Are you sure that you set the min/max values for the slider / range? I would assume that if the interval has length 0, it might also trigger this state. You might also need to set a step/page size (if there is not special method for that, then using a method on the adjustemnt obtained via get_adjustment).

Edit: Sorry did not see the code in your fork. It looks like you set the min max, but not the step/page size.

@can-lehmann
Copy link
Owner Author

I just had a look at your branch and believe that I found the issue. It seems like your gtk bindings in gtk.nim are wrong. C's double type should be cdouble in nim. If you change the types at the appropriate locations, your code seems to work:

image

PhilippMDoerner added a commit to PhilippMDoerner/owlkettle that referenced this issue Sep 27, 2023
double in C translates to cdouble in nim, not cfloat.
@PhilippMDoerner
Copy link
Contributor

image

Yep, that was quite a dumb mistake 😆
Thanks for pointing that out, that helped quite a fair bit and got me the basics, now to figure out all the hooks etc.

PhilippMDoerner added a commit to PhilippMDoerner/owlkettle that referenced this issue Sep 27, 2023
@PhilippMDoerner
Copy link
Contributor

Hmmm somewhat stuck on 2 separate problems now:

  1. GTK is behaving super weirdly with the window if the scale has marks on it. Compile the example as it is right now and if you slide the slider around up to near the max value, the window will start expanding. No clue where the hack that is coming from or if that's a GTK bug. See the screencast for an example.
Screencast.from.2023-09-27.22-12-51.webm
  1. I can't seem to update currentValue properly. I want to have a field that is accessible from the outside that always depicts the current value of the scale. But I don't quite get why, it just doesn't update the value. It always remains the value of "currentValue" that the parent-widget passes on. Not sure how to fix that one.
Screencast.from.2023-09-27.22-18-02.webm

@can-lehmann
Copy link
Owner Author

For 2., that is expected given that you set currentValue = 0.5 in your example. It is always immediately reverted to 0.5 after being updated in the event handler. Since you also don't have a hook for currentValue, the GTK widget is never updated to reflect the owlkettle widget state.

PhilippMDoerner added a commit to PhilippMDoerner/owlkettle that referenced this issue Sep 28, 2023
@PhilippMDoerner
Copy link
Contributor

Ahhh right. Okay, got an update and a build-hook now, which means I do get initial values.

I am not entirely sure if the hooks updating all three of GTK (via gtk_range_set_value) and the state (via valueChangedEventCallback where it is set via ScaleState(data[].widget).currentValue = scaleValue) and the widget (via update-hook, widget.valCurrentValue = state.currentValue) is the right way to go, but it works for now.

  hooks currentValue:
    build:
      gtk_range_set_value(state.internalWidget, widget.valCurrentValue)
      echo "Build: ", widget.valCurrentValue, " - ", state.currentValue
    update:
      gtk_range_set_value(state.internalWidget, state.currentValue) # This seemed more correct as state.currentValue keeps being the one thing that 
      widget.valCurrentValue = state.currentValue # Necessary as otherwise widget.valCurrentValue remains at 0.5, meaning out of sync with the value in state
      echo "Update: ", widget.valCurrentValue, " - ", state.currentValue

I think looking back having a "currentValue" field might have been the wrong approach for what I wanted.
What I want is for the user to be able to access the currentValue of a Widget whenever they want (e.g. the Scale might be used inside a Form and when somebody clicks the Okay button you want to extract the values of your individual input widgets).
Having a currentValue field I thought might've been the correct move, but I think in fact what I want is an initialValue field and after that a proc getValue(): float64 that you can call on the Scale-Widget to call gtk_range_get_value.

Is that doable? Or is that even the right approach?

PhilippMDoerner added a commit to PhilippMDoerner/owlkettle that referenced this issue Sep 28, 2023
PhilippMDoerner added a commit to PhilippMDoerner/owlkettle that referenced this issue Sep 28, 2023
@PhilippMDoerner
Copy link
Contributor

I might be facing an actual problem with the Scale being actually "2 way" in its bindings.
By that I mean, I want there to be a field on the Scale widget called value (previously called "currentValue").

  1. If I update value from the application, the value as it is depicted in the rendered widget should update to reflect that.
  2. If the user uses the widget to update the value, then the value in the widget-state should be updated.

However, 1) requires me to have an update field-hook on the value field which updates the widget-state with the value within the value field, like so:

  hooks value:
    update:
      echo "Updated value to ", widget.valValue
      gtk_range_set_value(state.internalWidget, widget.valValue)

If I do that though, then changes to the widget will be impossible because they also trigger the update field-hook on value during the redraw and that will override the value-change from the user using the widget.

I can't seem to figure that one out. You can provide an initial value, but programmatically after that basically only the user can update the value =/

PhilippMDoerner added a commit to PhilippMDoerner/owlkettle that referenced this issue Sep 28, 2023
PhilippMDoerner added a commit to PhilippMDoerner/owlkettle that referenced this issue Sep 28, 2023
PhilippMDoerner added a commit to PhilippMDoerner/owlkettle that referenced this issue Sep 28, 2023
@PhilippMDoerner
Copy link
Contributor

Welp, I managed to fix the "window expands infinitely" issue at least:
Whenver the update-hook of "Marks" was called, it added new marks, but never cleared them.
So basically after the update hook ran 4 times, I told GTK to add 16 marks in total.
By changing the hook to include state.internalWidget.gtk_scale_clear_marks() like so:

  hooks marks:
    (build, update):
      state.internalWidget.gtk_scale_clear_marks()
      let hasScaleMarks = widget.hasMarks and widget.valMarks.len > 0
      if hasScaleMarks:
        for mark in widget.valMarks:
          let label: string = if mark.label.isSome(): mark.label.get() else: $mark.value
          gtk_scale_add_mark(state.internalWidget, mark.value , mark.position.toGtk(), label.cstring)

It fixes the issue

PhilippMDoerner added a commit to PhilippMDoerner/owlkettle that referenced this issue Sep 28, 2023
@can-lehmann
Copy link
Owner Author

I might be facing an actual problem with the Scale being actually "2 way" in its bindings.

Have a look at how it works for Entry. The text field just has a property hook that updates the GTK.Entry's text. In your example code, the valueChanged callback needs to update the value in app, so that a two way binding actually exists.

On a more general note: You should have property hooks for all fields of the widget, not handle them in beforeBuild. The hook for marks can also be a property hook.

@PhilippMDoerner
Copy link
Contributor

PhilippMDoerner commented Sep 29, 2023

Okay, I think I got most functionality that is configurable from Range and Scale itself covered.
Now I could also go through GtkWidget, GObject, GtkAccessible and GtkOrientable to look for more set procs that could be configured via properties on Scale.

Is that within the scope of the ticket?
Do you maybe have a list of properties for any of those that any renderable widget should cover?
Basically, where should I draw the line?

Off the cuff, I could make out just as an overview the following function that might be of interest and possibly worth wrapping:

GTK_Accessible:

GTK.Orientable:

GTK.Widget:

@can-lehmann
Copy link
Owner Author

Since you inherit from BaseWidget, all relevant fields from GtkWidget should already be available (in case anything should be missing, that is probably a separate PR). Since you have a orient field, adding a property hook for it that uses gtk_orientable_set_orientation makes sense. To be honest, I have not looked into GTK's accessability APIs yet, so since they are currently not supported by any other widget, adding support is definitely out of scope for this PR.

I think that feature wise, this issue is mostly complete (other than the orient field). Please open a PR, so we can discuss the remaining steps.

PhilippMDoerner added a commit to PhilippMDoerner/owlkettle that referenced this issue Sep 29, 2023
PhilippMDoerner added a commit to PhilippMDoerner/owlkettle that referenced this issue Sep 29, 2023
PhilippMDoerner added a commit to PhilippMDoerner/owlkettle that referenced this issue Sep 29, 2023
PhilippMDoerner added a commit to PhilippMDoerner/owlkettle that referenced this issue Sep 29, 2023
PhilippMDoerner added a commit to PhilippMDoerner/owlkettle that referenced this issue Sep 29, 2023
PhilippMDoerner added a commit to PhilippMDoerner/owlkettle that referenced this issue Sep 29, 2023
PhilippMDoerner added a commit to PhilippMDoerner/owlkettle that referenced this issue Sep 29, 2023
PhilippMDoerner added a commit to PhilippMDoerner/owlkettle that referenced this issue Sep 29, 2023
PhilippMDoerner added a commit to PhilippMDoerner/owlkettle that referenced this issue Sep 29, 2023
PhilippMDoerner added a commit to PhilippMDoerner/owlkettle that referenced this issue Sep 29, 2023
PhilippMDoerner added a commit to PhilippMDoerner/owlkettle that referenced this issue Sep 29, 2023
PhilippMDoerner added a commit to PhilippMDoerner/owlkettle that referenced this issue Sep 29, 2023
PhilippMDoerner added a commit to PhilippMDoerner/owlkettle that referenced this issue Sep 30, 2023
PhilippMDoerner added a commit to PhilippMDoerner/owlkettle that referenced this issue Sep 30, 2023
PhilippMDoerner added a commit to PhilippMDoerner/owlkettle that referenced this issue Sep 30, 2023
PhilippMDoerner added a commit to PhilippMDoerner/owlkettle that referenced this issue Sep 30, 2023
PhilippMDoerner added a commit to PhilippMDoerner/owlkettle that referenced this issue Sep 30, 2023
PhilippMDoerner added a commit to PhilippMDoerner/owlkettle that referenced this issue Oct 1, 2023
PhilippMDoerner added a commit to PhilippMDoerner/owlkettle that referenced this issue Oct 1, 2023
can-lehmann added a commit that referenced this issue Oct 2, 2023
* debug attempt

* #83 Add first attempt at scale widget

* #83 Fix types on bindings

double in C translates to cdouble in nim, not cfloat.

* #83 improve examples and implementation

* stuff

* #83 Add support for initial widget value

* #83 Add support for inverting widget

* #83 fix some bugs

* #83 add update of ScaleState to change proc

* #83 let pageSize just default to double the pageSize

* #83 add support for showing or hiding fill level and precision

* #83 Fix bug causing infinite window growth

* #83 refactor state-variables to use property hooks

* #83 implement suggestion for value 2way bindings

* #83 Fix example

* #83 Add support for configuring value position

* #83 Make orientation configurable

* #83 Fix example datatype (this was int but needs to be float64)

* #83 Fix semantics on marks

* #83 Ensure order of hooks is the same as order of properties

* #83 Add build hook to make initial value assignment work again

* #83 slightly beautify example

* #83 Adjust proc-calling to code conventions

* #83 Add widgets example

* ##83 add doc comments to Scale widget

* #83 Update widgets.md

* Add notice that there's a nimble task to generate docs as well

* #83 Remove nonsense workflow change

* #83 Add scale to example README and mild improvements

* #83 Mild doc comment improvements

* #83 Fix error introduced by last commit in doc comments

* #83 Remove build hook

* #83 Move float64 to float

* #83 Minor doc update

* #83 Improve Scale example to make it more configurable

* Improve example

* Fix Text View example image width

---------

Co-authored-by: Can Lehmann <can.l@posteo.de>
@PhilippMDoerner
Copy link
Contributor

This issue thus closed?

@can-lehmann
Copy link
Owner Author

Yes 😄

PhilippMDoerner added a commit to PhilippMDoerner/owlkettle that referenced this issue Oct 2, 2023
can-lehmann added a commit that referenced this issue Oct 8, 2023
* debug attempt

* #83 Add first attempt at scale widget

* #83 Fix types on bindings

double in C translates to cdouble in nim, not cfloat.

* #83 improve examples and implementation

* stuff

* #83 Add support for initial widget value

* #83 Add support for inverting widget

* #83 fix some bugs

* #83 add update of ScaleState to change proc

* #83 let pageSize just default to double the pageSize

* #83 add support for showing or hiding fill level and precision

* #83 Fix bug causing infinite window growth

* #83 refactor state-variables to use property hooks

* #83 implement suggestion for value 2way bindings

* #83 Fix example

* #83 Add support for configuring value position

* #83 Make orientation configurable

* #83 Fix example datatype (this was int but needs to be float64)

* #83 Fix semantics on marks

* #83 Ensure order of hooks is the same as order of properties

* #83 Add build hook to make initial value assignment work again

* #83 slightly beautify example

* #83 Adjust proc-calling to code conventions

* #83 Add widgets example

* ##83 add doc comments to Scale widget

* #83 Update widgets.md

* Add notice that there's a nimble task to generate docs as well

* #83 Remove nonsense workflow change

* #83 Add scale to example README and mild improvements

* Remove nonsense workflow change from myself

* #83 Mild doc comment improvements

* #83 Fix error introduced by last commit in doc comments

* #83 Remove build hook

* #83 Move float64 to float

* #83 Minor doc update

* #83 Improve Scale example to make it more configurable

* #93 Add AutoForm function

Generates a Box widget with editable
dataentry widgets for each field on the state.
You can exclude certain fields as desired.

* #93 Minor Fix to Scale Widget example

* #93 add support for DateTime with Calendar widget

* Add Autoform to calendar

* Add Autoform to drop_down

* #93 Add ability to deal with tuples generally

* #93 add basewidget fields

* Add Basewidget fields to dropdown

* Add autoform to picture.nim with Basewidget fields

* Add autoform to popover_menu.nim

Note:
It appears while `hasArrow` and `tooltip`
are available for PopoverMenu, they don't really do much

* Add Autoform to radio group

Orientation of radio group appears to
not change when you change the orientation.
It appears to solely rely on Box.
Is that a bug or just gtk behaviour?

* Fix radiogroup not allow runtime orient updates

Radiogroup was missing a property hook for
orient.
This commit adds said missing property hook.
This enables runtime-changing of the orientation of RadioGroup

* Add autoform to text_view

* Fix popover_menu example

* Fixed wrong fix for popover_menu

* Beautify Scale

* Improve example

* Fix Text View example image width

* Update gitignore

* #93 Update Autoform for scale

* debug attempt

* Remove nonsense workflow change from myself

* #93 Add BaseWidget attributes back to example

* #93 Add an auto mini form generator

* Update calendar example

* Update Dropdown example

* Update picture example

* Update Popover example

* Update radiogroup

* Update text_view example

* Update calendar image

* #93 Add nicer form fields specifically for sizeRequest tuple

* #93 Fully move over to the non-form-generating approach

* Update calendar image

* Update popover_menu example screenshot

* Update images of remaining examples

* #93 Minor fixes

* #93 update callback useable for calendar

* Remove pointless AlignedChild export

* Update Autoform to use FormulaEntry

* Move Calendar into a dialog

* #93 remove completely pointless overload for ints

A fully generic approach using T and SomeNumber does the job better
and covers more ground.

* #93 Change Default widget for objects and Co

It now no longer is one that represents tuples etc.
as JSON and parses that back.

Instead, it now provides a dummy widget
that will explain to the user that they must implement a
`toFormField` proc with a more elaborate tooltip.

* Minimize example to menubutton instead of sidebar

* #93 Move all toFormFields into autoform

* #93 Update widget examples

They now provide the form as a menu button popover

* Undo changes to example images

* #93 Overhaul autoform

The new implementation enables
generating an entire form based on either
`toFormField` for individual entries with custom datatypes
or `toListFormField` for seq[T] of custom datatypes.

* #93 Remove unused imports

* #93 Move examples back from WindowSurface to Window

* Update doc comments

* Undo examples changes

* Update example headerbars

* Make menubutton for form flat as per adw standards

* Make headerbar buttons into flat buttons

* Rename autoform to playground

* Variousf ixes to popover example

* Lots of example fixes

* Undo unnecessary changes

* Remove unnecessary defaultsize

---------

Co-authored-by: Can Lehmann <can.l@posteo.de>
can-lehmann added a commit that referenced this issue Oct 8, 2023
* debug attempt

* #83 Add first attempt at scale widget

* #83 Fix types on bindings

double in C translates to cdouble in nim, not cfloat.

* #83 improve examples and implementation

* stuff

* #83 Add support for initial widget value

* #83 Add support for inverting widget

* #83 fix some bugs

* #83 add update of ScaleState to change proc

* #83 let pageSize just default to double the pageSize

* #83 add support for showing or hiding fill level and precision

* #83 Fix bug causing infinite window growth

* #83 refactor state-variables to use property hooks

* #83 implement suggestion for value 2way bindings

* #83 Fix example

* #83 Add support for configuring value position

* #83 Make orientation configurable

* #83 Fix example datatype (this was int but needs to be float64)

* #83 Fix semantics on marks

* #83 Ensure order of hooks is the same as order of properties

* #83 Add build hook to make initial value assignment work again

* #83 slightly beautify example

* #83 Adjust proc-calling to code conventions

* #83 Add widgets example

* ##83 add doc comments to Scale widget

* #83 Update widgets.md

* Add notice that there's a nimble task to generate docs as well

* #83 Remove nonsense workflow change

* #83 Add scale to example README and mild improvements

* Remove nonsense workflow change from myself

* #83 Mild doc comment improvements

* #83 Fix error introduced by last commit in doc comments

* #83 Remove build hook

* #83 Move float64 to float

* #83 Minor doc update

* #83 Improve Scale example to make it more configurable

* #93 Add AutoForm function

Generates a Box widget with editable
dataentry widgets for each field on the state.
You can exclude certain fields as desired.

* #93 Minor Fix to Scale Widget example

* #93 add support for DateTime with Calendar widget

* #93 Add ability to deal with tuples generally

* #93 add basewidget fields

* Improve example

* Fix Text View example image width

* Update gitignore

* #93 Update Autoform for scale

* debug attempt

* Remove nonsense workflow change from myself

* #93 Add BaseWidget attributes back to example

* #93 Add an auto mini form generator

* #93 Add nicer form fields specifically for sizeRequest tuple

* #93 Fully move over to the non-form-generating approach

* #86 Add Status Page widget + example

* #86 Add mention of freedesktop spec

Also update other docs to point to the tooling section.

* #86 Update link to not point to localhost

* #86 Update Status Page docs

* #86 Remove autoform and refine example

* #86 update image

* Update examples/widgets/adw/status_page.nim

Co-authored-by: Can Lehmann <85876381+can-lehmann@users.noreply.github.com>

* #86 Fix incorrect alt attribute on example README

---------

Co-authored-by: Can Lehmann <can.l@posteo.de>
PhilippMDoerner added a commit to PhilippMDoerner/owlkettle that referenced this issue Oct 8, 2023
* debug attempt

* can-lehmann#83 Add first attempt at scale widget

* can-lehmann#83 Fix types on bindings

double in C translates to cdouble in nim, not cfloat.

* can-lehmann#83 improve examples and implementation

* stuff

* can-lehmann#83 Add support for initial widget value

* can-lehmann#83 Add support for inverting widget

* can-lehmann#83 fix some bugs

* can-lehmann#83 add update of ScaleState to change proc

* can-lehmann#83 let pageSize just default to double the pageSize

* can-lehmann#83 add support for showing or hiding fill level and precision

* can-lehmann#83 Fix bug causing infinite window growth

* can-lehmann#83 refactor state-variables to use property hooks

* can-lehmann#83 implement suggestion for value 2way bindings

* can-lehmann#83 Fix example

* can-lehmann#83 Add support for configuring value position

* can-lehmann#83 Make orientation configurable

* can-lehmann#83 Fix example datatype (this was int but needs to be float64)

* can-lehmann#83 Fix semantics on marks

* can-lehmann#83 Ensure order of hooks is the same as order of properties

* can-lehmann#83 Add build hook to make initial value assignment work again

* can-lehmann#83 slightly beautify example

* can-lehmann#83 Adjust proc-calling to code conventions

* can-lehmann#83 Add widgets example

* #can-lehmann#83 add doc comments to Scale widget

* can-lehmann#83 Update widgets.md

* Add notice that there's a nimble task to generate docs as well

* can-lehmann#83 Remove nonsense workflow change

* can-lehmann#83 Add scale to example README and mild improvements

* Remove nonsense workflow change from myself

* can-lehmann#83 Mild doc comment improvements

* can-lehmann#83 Fix error introduced by last commit in doc comments

* can-lehmann#83 Remove build hook

* can-lehmann#83 Move float64 to float

* can-lehmann#83 Minor doc update

* can-lehmann#83 Improve Scale example to make it more configurable

* can-lehmann#93 Add AutoForm function

Generates a Box widget with editable
dataentry widgets for each field on the state.
You can exclude certain fields as desired.

* can-lehmann#93 Minor Fix to Scale Widget example

* can-lehmann#93 add support for DateTime with Calendar widget

* can-lehmann#93 Add ability to deal with tuples generally

* can-lehmann#93 add basewidget fields

* Improve example

* Fix Text View example image width

* Update gitignore

* can-lehmann#93 Update Autoform for scale

* debug attempt

* Remove nonsense workflow change from myself

* can-lehmann#93 Add BaseWidget attributes back to example

* can-lehmann#93 Add an auto mini form generator

* can-lehmann#93 Add nicer form fields specifically for sizeRequest tuple

* can-lehmann#93 Fully move over to the non-form-generating approach

* can-lehmann#86 Add Status Page widget + example

* can-lehmann#86 Add mention of freedesktop spec

Also update other docs to point to the tooling section.

* can-lehmann#86 Update link to not point to localhost

* can-lehmann#86 Update Status Page docs

* can-lehmann#86 Remove autoform and refine example

* can-lehmann#86 update image

* Update examples/widgets/adw/status_page.nim

Co-authored-by: Can Lehmann <85876381+can-lehmann@users.noreply.github.com>

* can-lehmann#86 Fix incorrect alt attribute on example README

---------

Co-authored-by: Can Lehmann <can.l@posteo.de>
can-lehmann added a commit that referenced this issue Oct 8, 2023
* debug attempt

* #83 Add first attempt at scale widget

* #83 Fix types on bindings

double in C translates to cdouble in nim, not cfloat.

* #83 improve examples and implementation

* stuff

* #83 Add support for initial widget value

* #83 Add support for inverting widget

* #83 fix some bugs

* #83 add update of ScaleState to change proc

* #83 let pageSize just default to double the pageSize

* #83 add support for showing or hiding fill level and precision

* #83 Fix bug causing infinite window growth

* #83 refactor state-variables to use property hooks

* #83 implement suggestion for value 2way bindings

* #83 Fix example

* #83 Add support for configuring value position

* #83 Make orientation configurable

* #83 Fix example datatype (this was int but needs to be float64)

* #83 Fix semantics on marks

* #83 Ensure order of hooks is the same as order of properties

* #83 Add build hook to make initial value assignment work again

* #83 slightly beautify example

* #83 Adjust proc-calling to code conventions

* #83 Add widgets example

* ##83 add doc comments to Scale widget

* #83 Update widgets.md

* Add notice that there's a nimble task to generate docs as well

* #83 Remove nonsense workflow change

* #83 Add scale to example README and mild improvements

* Remove nonsense workflow change from myself

* #83 Mild doc comment improvements

* #83 Fix error introduced by last commit in doc comments

* #83 Remove build hook

* #83 Move float64 to float

* #83 Minor doc update

* #83 Improve Scale example to make it more configurable

* #93 Add AutoForm function

Generates a Box widget with editable
dataentry widgets for each field on the state.
You can exclude certain fields as desired.

* #93 Minor Fix to Scale Widget example

* #93 add support for DateTime with Calendar widget

* #93 Add ability to deal with tuples generally

* #93 add basewidget fields

* Improve example

* Fix Text View example image width

* Update gitignore

* #93 Update Autoform for scale

* debug attempt

* Remove nonsense workflow change from myself

* #93 Add BaseWidget attributes back to example

* #93 Add an auto mini form generator

* #93 Add nicer form fields specifically for sizeRequest tuple

* #93 Fully move over to the non-form-generating approach

* #85 Add Expander Widget including example

* #85 Add BaseWidget fields

* #85 Add example to README.md

* #85 add Activation callback and doc comments

* #85 Update and expand docs

* #85 Fix expander callback delivering outdated values

* #85 Move expander example over to autoform

* #85 Update docs and example screenshot

* #85 Refine example and remove autoform

* #85 Update widgets.md

The introduction of gtkminor in an earlier PR changed this doc comment.
That caused a change in widgets.md

* Update owlkettle/widgets.nim

Co-authored-by: Can Lehmann <85876381+can-lehmann@users.noreply.github.com>

* #85 Move Expander to make sure list is sorted alphabetically

* #85 Update docs

---------

Co-authored-by: Can Lehmann <can.l@posteo.de>
Co-authored-by: Can Lehmann <85876381+can-lehmann@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants