Comments (9)
What about using type unions for this purpose.
For the GtkTreeModel interface I have used a definition
GtkTreeModelI = Union(GtkListStore, GtkTreeStore)
It would be more convenient to somehow extend the @gtktype
macro so that it accepts additional arguments (i.e. the implemented interfaces) and @gtktype
collects all interfaces and its implementations. At some point it then has to define the type union. But I have no idea how to get the definition order right with this approach.
Alternative: Introduce multiple inheritance in Julia. I am not sure how likely it is that this will ever happen. You have a better feeling about that
from gtk.jl.
I have the same problem in GI.jl (gobject-introspection generated bindings). For instance in Clutter, Container is an abstract interface and not a base object like in Gtk. I'm also considering Union(...) but the problem with this is AFAIK there is no convenient way to add new concrete types to it afterwards, which can happen if you import an extension library that defines more widgets/actors. Right now i just prefix interface methods with the interface name, i e container_add_actor but I don't know the best way to then define the more convenient push!(ClutterContainer, ClutterActor) .
Multiple inheritance of abstract types would have been the simplest indeed.
from gtk.jl.
Yes, the Union method is limited and it will not allow to extend the type. It might be possible that extending Unions are easier to implement than MI in Julia. Will ask in the MI issue in the Julia bug tracker.
Although the Union method is limited, it allows to implement against interfaces and, in the case MI comes, one would only need to change the type definitions and the implemementations can stay.
from gtk.jl.
To be able to use the setter of interfaces using the aforementioned Union method, one has to write one conversion method, i.e.
GtkTreeModelI = Union(GtkListStore,GtkTreeStore)
convert(::Type{Ptr{None}},m::GtkTreeModelI) = convert(Ptr{None},m.handle)
But with that I am able to use the GtkTreeModel setter now (have not tested the getter though)
from gtk.jl.
Actually I have not tried to use a setter of TreeModel yet. But the conversion allows to use a setter of TreeView that has a TreeModel as argument
from gtk.jl.
Automatic getter/setter generation works when putting the interface to the code gen script. (yes I have clang+gtk@mac working now)
from gtk.jl.
@tknopp that error actually means that gtk_get_set_gen didn't know GtkTreeModelI
is a GtkObject. The proper way to fix that error is to add it to the GtkTypeMap
list (esp. now that you can successfully run the code gen script)
from gtk.jl.
I see.
from gtk.jl.
Prototype: https://github.com/JuliaLang/Gtk.jl/tree/jn/iface
from gtk.jl.
Related Issues (20)
- Julia Crash on GTK combo HOT 2
- Connecting event to calendar HOT 4
- CssProviderLeaf performance HOT 2
- Where is gdk library HOT 1
- Julia aborts from a Scale on mac HOT 8
- When CSS on screen has effect?
- In Ubuntu open_dialog() does not close after completing its action
- Crash on load with version 1.2.3 or 1.3.0 on Windows HOT 3
- Error in running finalizer
- issues with headless machine precompile HOT 1
- ComboBoxText no longer working under Julia 1.8.5 HOT 3
- Segfault with showall on trivial glade file on M1 Mac
- Is there a Julia binding to the GtkLayout container?
- circular dependency with libtiff_jll 4.5 HOT 1
- Apple silicon M2 Gtkscale error
- GtkSpinButton MethodError
- race conditions in finalizers HOT 1
- sigatomic_end called in non-sigatomic region HOT 1
- Gtk not working on MacOS Sonoma 14.4 or 14.4.1 HOT 1
- Canβt get to Glade
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 gtk.jl.