support for cstringArray/seq[string]

This commit is contained in:
Stefan Salewski 2019-06-29 21:23:08 +02:00
commit 5c31092dc6
7 changed files with 518 additions and 259 deletions

View file

@ -807,9 +807,7 @@ proc appActivate(app: Application) =
button.label = "Save"
window.add(button)
button.setActionName("win.save")
var h: cstringArray = allocCstringArray(["<Control><Shift>S"])
setAccelsForAction(app, "win.save", h)
deallocCStringArray(h)
setAccelsForAction(app, "win.save", "<Control><Shift>S")
showAll(window)
proc main =
@ -935,9 +933,7 @@ proc appActivate(app: Application) =
# parameter type mismatch (parameter type s, target type NULL)
button.setDetailedActionName("win.justify::center")
#button.setActionName("app.quit") # for a stateless action
var h: cstringArray = allocCstringArray(["<Control><Shift>R"]) # ugly
setAccelsForAction(app, "win.justify::right", h)
deallocCStringArray(h)
setAccelsForAction(app, "win.justify::right", "<Control><Shift>R")
window.add(button)
showAll(window)

View file

@ -104,7 +104,7 @@ proc drawingAreaDrawCb(darea: DrawingArea; cr: Context; this: PDA): bool =
cr.setSource(0, 0, 0)
cr.setLineWidth(2)
cr.stroke
return SignalEventStopPropagation
return gdk.EVENT_STOP # EVENT_PROPAGATE
#return true # TRUE to stop other handlers from being invoked for the event. FALSE to propagate the event further.
# clamp to correct values, 0 <= value <= (adj.upper - adj.pageSize), block calling onAdjustmentEvent()

View file

@ -14,9 +14,7 @@ proc appActivate(app: Application) =
button.label = "Save"
window.add(button)
button.setActionName("win.save")
var h: cstringArray = allocCstringArray(["<Control><Shift>S"])
setAccelsForAction(app, "win.save", h)
deallocCStringArray(h)
setAccelsForAction(app, "win.save", "<Control><Shift>S")
showAll(window)
proc main =

View file

@ -87,10 +87,8 @@ proc appActivate(app: Application) =
#window.add(button) # do not add it here already: (menubar:10010): Gtk-WARNING **: 22:00:33.230: actionhelper:
# action win.justify can't be activated due to parameter type mismatch (parameter type s, target type NULL)
button.setDetailedActionName("win.justify::center")
#button.setActionName("app.quit") # for a stateless action
var h: cstringArray = allocCstringArray(["<Control><Shift>R"]) # ugly
setAccelsForAction(app, "win.justify::right", h)
deallocCStringArray(h)
#button.setActionName("app.quit") # for a stateless action
setAccelsForAction(app, "win.justify::right", "<Control><Shift>R")
window.add(button)
showAll(window)

View file

@ -4,7 +4,7 @@ import gintro/[gtk4, glib, gobject, gio]
proc appActivate(app: Application) =
let window = newApplicationWindow(app)
window.title = "GTK3 & Nim"
window.title = "GTK4 & Nim"
window.defaultSize = (200, 200)
show(window)

View file

@ -1,6 +1,6 @@
# Package
version = "0.5.0"
version = "0.5.1"
author = "Stefan Salewski"
description = "High level GObject-Introspection based GTK3/GTK4 bindings"
license = "MIT"

File diff suppressed because it is too large Load diff