added GTK4 support
This commit is contained in:
parent
d7aa177796
commit
fd6cda7fe8
18 changed files with 320 additions and 451 deletions
27
examples/gtk3/gaction.nim
Normal file
27
examples/gtk3/gaction.nim
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
# https://wiki.gnome.org/HowDoI/GAction
|
||||
# nim c gaction.nim
|
||||
import gintro/[gtk, glib, gobject, gio]
|
||||
|
||||
proc saveCb(action: SimpleAction; v: Variant) =
|
||||
echo "saveCb"
|
||||
|
||||
proc appActivate(app: Application) =
|
||||
let window = newApplicationWindow(app)
|
||||
let action = newSimpleAction("save")
|
||||
discard action.connect("activate", saveCB)
|
||||
window.actionMap.addAction(action)
|
||||
let button = newButton()
|
||||
button.label = "Save"
|
||||
window.add(button)
|
||||
button.setActionName("win.save")
|
||||
var h: cstringArray = allocCstringArray(["<Control><Shift>S"])
|
||||
setAccelsForAction(app, "win.save", h)
|
||||
deallocCStringArray(h)
|
||||
showAll(window)
|
||||
|
||||
proc main =
|
||||
let app = newApplication("org.gtk.example")
|
||||
connect(app, "activate", appActivate)
|
||||
discard run(app)
|
||||
|
||||
main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue