Comments (5)
On my phone so I'll be short:
This is like Canvas. Should it be wrapper or subtype. I think direct subtype so that convert is indempotent. Known need to fix methods in Gtk.jl anyways
from gtk.jl.
Not sure that I can follow you here. If MyType
subtypes from GtkWidgetI
doesent it than require to have a handle
field? We could of course follow the following sheme
type MyWidget <: GtkWidgetI
handle::Ptr{GObject}
btn::GtkButton
end
function MyWidget(label)
btn = GtkButton(label)
MyWidget(btn.handle, btn)
end
from gtk.jl.
the btn field would not be necessary. I would add a function called reinherit
which transfers ownership of a handle from one Julia object to another and destroys the old reference object. Thus the MyWidget
constructor would look something like:
type MyWidget <: Gtk.GtkButtonI
handle::Ptr{Gtk.GObjectI}
other_fields
function MyWidget(label)
btn = GtkButton(label)
Gtk.gc_move_ref(new(btn), btn)
end
end
where gc_move_ref
is a function I just added to GLib
:
function Gtk.gc_move_ref(old::GObjectI, new::GObjectI)
@assert old.handle == new.handle != C_NULL
Gtk.gc_unref(old) # destroys old, but does nothing to it's gc ref
Gtk.gc_force_floating(new) # forced the gc ref in old to floating
Gtk.gc_ref(new) # adopt the floating gc ref from old and return new
end
from gtk.jl.
@vtjnash: Like that! This should go into the documentation. The button was not the best example though. In practice one would subtype a container
from gtk.jl.
Great. Thanks for documenting this
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.