Window management: Difference between revisions

Content added Content deleted
m (moved Categorys to top)
m (→‎{{header|Nimrod}}: Added IUP example)
Line 317: Line 317:


=={{header|Nimrod}}==
=={{header|Nimrod}}==
==={{libheader|Gtk2}}===
<lang nimrod>import
<lang nimrod>import
gdk2, glib2, gtk2,
gdk2, glib2, gtk2,
Line 396: Line 397:
show_all(window)
show_all(window)
main()</lang>
main()</lang>
==={{libheader|IUP}}===
<lang nimrod>import iup


# assumes you have the iup .dll or .so installed

proc toCB(fp: proc): ICallback =
return cast[ICallback](fp)

discard iup.open(nil,nil)

var btnRestore = button("restore","")
var btnFull = button("Full screen","")
var btnMin = button("minimize","")
var btnMax = button("maximize","")
var btnHide = button("Transparent","")
#var btnHide = button("Hide (close)","")
var btnShow = button("Show","")

var hbox = Hbox(btnRestore, btnFull, btnMax, btnMin, btnShow, btnHide, nil)
setAttribute(hbox,"MARGIN", "10x10")
setAttribute(hbox,"PADDING", "5x5")

var dlg = Dialog(hbox)
#SetAttribute(dlg, "SIZE", "100x50")

proc doFull(ih:PIhandle): cint {.cdecl.} =
setAttribute(dlg,"FULLSCREEN","YES")
return IUP_DEFAULT

proc doMax(ih:PIhandle): cint {.cdecl.} =
#setAttribute(dlg,"FULLSCREEN","YES")
setAttribute(dlg,"PLACEMENT","MAXIMIZED")
# this is a work-around to get the dialog minimised (on win platform)
setAttribute(dlg,"VISIBLE","YES")
return IUP_DEFAULT

proc doMin(ih:PIhandle): cint {.cdecl.} =
setAttribute(dlg,"PLACEMENT","MINIMIZED")
# this is a work-around to get the dialog minimised (on win platform)
setAttribute(dlg,"VISIBLE","YES")
return IUP_DEFAULT

proc doRestore(ih:PIhandle): cint {.cdecl.} =
setAttribute(dlg,"OPACITY","255")
setAttribute(dlg,"FULLSCREEN","NO")
setAttribute(dlg,"PLACEMENT","NORMAL")
setAttribute(dlg,"VISIBLE","YES")
return IUP_DEFAULT

proc doHide(ih:PIhandle): cint {.cdecl.} =
#setAttribute(dlg,"VISIBLE","NO")
setAttribute(dlg,"OPACITY","60")
return IUP_DEFAULT

proc doShow(ih:PIhandle): cint {.cdecl.} =
setAttribute(dlg,"OPACITY","255")
setAttribute(dlg,"VISIBLE","YES")
return IUP_DEFAULT
discard setCallback(btnRestore,"ACTION", toCB(doRestore))
discard setCallback(btnFull,"ACTION", toCB(doFull))
discard setCallback(btnMax,"ACTION", toCB(doMax))
discard setCallback(btnMin,"ACTION", toCB(doMin))
discard setCallback(btnShow,"ACTION", toCB(doShow))
discard setCallback(btnHide,"ACTION", toCB(doHide))

discard dlg.show()
discard mainloop()
iup.Close()</lang>


=={{header|Oz}}==
=={{header|Oz}}==