Comments (6)
Thanks for the proposal! I hope I can get some time this weekend to look more closely at it. π
from gi-gtk-declarative.
Hey, sorry it took a while longer.
OK, so in this library I've deliberately not used the concept of models from GTK+. As you say, they effectively implement a bidrectional mutating data flow between the application state and the widgets, and I want gi-gtk-declarative to be unidirectional. The only way for information from the user interface to flow back up to the application logic is through events. (I should document this stuff in some sort of general guidelines for gi-gtk-declarative widget implementation.) I'm not sure I like the "unidirectional" terminology much, but it as at least established in the React world.
When it comes to the TreeView
widget, it's likely more complicated than the previously implemented widgets, but can probably be done in a similar way as them. As an example, the Menu
widget that's already in this library defines a few data types to model how menus can be built up. It may not cover all features in GTK+ menus (yet), but it fits with the library.
I propose you start by defining such data types for the TreeView
widget, and build the Patchable
and EventSource
instances around that. Also, do leave out drag-and-drop and other advanced features for now, we can always add more events later on. If you do have any TreeView-specific events you want to report up to the user, define a data type for those events and emit them from your subscribe
implementation(s).
Does that make sense? Please ask more questions if you have any. I'm glad your here and want to help implement more widget support! π
from gi-gtk-declarative.
@owickstrom I'm interested in implementing this but it definitely requires discussion and your sign-off on the design before I can start working on it.
from gi-gtk-declarative.
The idea of a model underlying a widget recurs in GTK, for instance, GtkMenu
and GtkMenuBar
, as subclasses of GtkMenuShell
, can take GMenuModel
(defined in the gio
lib with a very abstract and opaque concept of actions
) as a model, and update themselves in response to changes in the model in a similar way to GtkTreeView
with a GtkTreeModel
. If we can figure this out on TreeView
then I think we will have a good example to work from when implementing other widgets with underlying models.
from gi-gtk-declarative.
One subtle thing here is that the widget itself can update the model. Users can drag-and-drop to reorder rows, rows can be editable, etc. We need some way to feed this back into the application state (via events probably) without the changes in the application state immediately triggering another update, causing model inconsistency and infinite loops.
from gi-gtk-declarative.
@owickstrom Have you gotten a chance to look at this more closely? I'd really like to start implementing it.
from gi-gtk-declarative.
Related Issues (20)
- Allow haskell-gi 0.25.0 dependency version?
- Error while buillding with stack - Could not find module βGI.GModule.Structs.Moduleβ HOT 3
- Want to add support for 'gridAttachNextTo' for Grid somehow
- CustomWidget is always modified or replaced? HOT 2
- Window is not destroyed when event loop stops, only when program exits
- How do I make a dialog with its own local state? HOT 1
- Use value-changed signal on adjustment of scrolled window
- Some initial build issues re: Tom Ellis
- Ignored exception in update handler
- How do I start a background process and monitor it in gi-gtk-declarative? HOT 2
- Menu API is very limited
- ListBox content change leads to cursor position reset HOT 1
- Line Wrapping not working in Labels HOT 1
- [Question] Handling forms HOT 2
- Adding Buttons to/Using FileChooserDialog HOT 7
- [Dependencies] Build fails given current dependency constraints HOT 8
- GTK4? HOT 2
- Parameterize Streaming Implementation for App.Simple?
- Dependency version bumps are not released to Hackage. HOT 2
- An example without `App.Simple`? HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gi-gtk-declarative.