a lot of fixes
This commit is contained in:
parent
1052e13474
commit
e9082e0efe
5 changed files with 777 additions and 834 deletions
13
README.adoc
13
README.adoc
|
|
@ -1,6 +1,6 @@
|
|||
= High level GTK3 (and GTK4) bindings for the Nim programming language
|
||||
(c) Stefan Salewski
|
||||
//Version 0.5
|
||||
//Version 0.5.3
|
||||
:experimental:
|
||||
:imagesdir: http://ssalewski.de/tmp
|
||||
:source-highlighter: pygments
|
||||
|
|
@ -19,7 +19,16 @@ TIP: A more fancy copy of this document with dark source code background is avai
|
|||
NOTE: This work is partly based on earlier works of J. Mansour and has been supported by A. Rumpf and other _Nim_ and _GTK/Gnome_ developers.
|
||||
The `combinatorics` module was kindly provided by R. Behrends.
|
||||
|
||||
NOTE: Starting with current release 0.5.0 we also support GTK4. GTK4 is still work in progress and not intended for
|
||||
NOTE: Starting with current release 0.5.3 we do not generate field entries for objects and we do
|
||||
not generate class structs and private objects. Also we stopped exporting the low level functions
|
||||
like gtk_button_new(). For a real high-level binding we should not need these. If that is a serious
|
||||
limitation for you, then use release 0.5.2 for now and create an github issue for your use case, we
|
||||
will try to fix it, maybe undo these changes. Also starting with v0.5.3 we try to support array
|
||||
parameters like TargetEntryArray, PageRangeArray and KeymapKeyArray. Use of these array parameters is rare,
|
||||
if you will use functions with these parameters you may inspect the source code first, as the
|
||||
code is auto-generated and still untested.
|
||||
|
||||
NOTE: Starting with release 0.5.0 we also support GTK4. GTK4 is still work in progress and not intended for
|
||||
end users yet, but it is good to have it available for migration testing. For GTK4 we have a new module gsk, and
|
||||
new versions of modules gtk, gdk and gdkX11, which are not backward compatible with the old once of GTK3. The other
|
||||
modules can be used by GTK3 and GTK4 in parallel. Due to this fact we use a single nimble package which can be used for
|
||||
|
|
|
|||
|
|
@ -10,23 +10,23 @@ const
|
|||
|
||||
var list: TreeView
|
||||
|
||||
# this is copied from gtk.nim
|
||||
#proc getModel*(self: TreeView): TreeModel =
|
||||
# new(result)
|
||||
# result.impl = gtk_tree_view_get_model(cast[ptr TreeView00](self.impl))
|
||||
# we need the following two procs for now -- later we will not use that ugly cast...
|
||||
proc typeTest(o: gobject.Object; s: string): bool =
|
||||
let gt = g_type_from_name(s)
|
||||
return g_type_check_instance_is_a(cast[ptr TypeInstance00](o.impl), gt).toBool
|
||||
|
||||
proc getListStore(self: TreeView): ListStore =
|
||||
new(result)
|
||||
result.impl = gtk_tree_view_get_model(cast[ptr TreeView00](self.impl))
|
||||
proc listStore(o: gobject.Object): gtk.ListStore =
|
||||
assert(typeTest(o, "GtkListStore"))
|
||||
cast[gtk.ListStore](o)
|
||||
|
||||
proc appendItem(widget: Button; entry: Entry) =
|
||||
var
|
||||
val: Value
|
||||
iter: TreeIter
|
||||
let store = getListStore(list)
|
||||
let store = listStore(getModel(list))
|
||||
let gtype = typeFromName("gchararray")
|
||||
discard gValueInit(val, gtype)
|
||||
gValueSetString(val, entry.text)
|
||||
discard init(val, gtype)
|
||||
setString(val, entry.text)
|
||||
store.append(iter)
|
||||
store.setValue(iter, LIST_ITEM, val)
|
||||
entry.text = ""
|
||||
|
|
@ -35,7 +35,7 @@ proc removeItem(widget: Button; selection: TreeSelection) =
|
|||
var
|
||||
ls: ListStore
|
||||
iter: TreeIter
|
||||
let store = getListStore(list)
|
||||
let store = list.getModel.listStore#getListStore(list)
|
||||
if not store.getIterFirst(iter):
|
||||
return
|
||||
if getSelected(selection, ls, iter):
|
||||
|
|
@ -44,7 +44,8 @@ proc removeItem(widget: Button; selection: TreeSelection) =
|
|||
proc onRemoveAll(widget: Button; selection: TreeSelection) =
|
||||
var
|
||||
iter: TreeIter
|
||||
let store = getListStore(list)
|
||||
#let store = getListStore(list)
|
||||
let store = list.getModel.listStore
|
||||
if not store.getIterFirst(iter):
|
||||
return
|
||||
clear(store)
|
||||
|
|
|
|||
15
examples/gtk3/makeAll
Normal file
15
examples/gtk3/makeAll
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
nim c app0.nim
|
||||
nim c builder.nim
|
||||
nim c button.nim
|
||||
nim c cairo_anim.nim
|
||||
nim c connect_args.nim
|
||||
nim c count_button.nim
|
||||
nim c darea_test.nim
|
||||
nim c drawingarea.nim
|
||||
nim c gaction.nim
|
||||
nim c gsettings.nim
|
||||
nim c label.nim
|
||||
nim c listview.nim
|
||||
nim c menubar.nim
|
||||
nim c t0.nim
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
# Package
|
||||
|
||||
version = "0.5.2"
|
||||
version = "0.5.3"
|
||||
author = "Stefan Salewski"
|
||||
description = "High level GObject-Introspection based GTK3/GTK4 bindings"
|
||||
license = "MIT"
|
||||
|
|
|
|||
1556
tests/gen.nim
1556
tests/gen.nim
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue