eumandy/eugtk/examples/test119.ex
2016-11-25 00:33:18 -07:00

52 lines
1.3 KiB
Elixir

-----------------------------------------------------------------
--# GtkToolBar
-----------------------------------------------------------------
include GtkEngine.e
constant docs = `<u><b>ToolBar</b></u>
demos different styles of toolbar,
this one uses stock button items.
`
constant cap = {"application-exit","gtk-apply","gtk-find"}
constant items = {
create(GtkToolButton,cap[1],0,"Quit"),
create(GtkToolButton,cap[2],0,_("Foo"),2),
create(GtkToolButton,cap[3],0,_("Foo"),3)
}
constant tips = {
"Stock <b><i>gtk-quit</i></b> button\nClick to exit",
"Stock <b><i>gtk-apply</i></b> button",
"Stock <b><i>gtk-find</i></b> button"
}
constant win = create(GtkWindow,"size=300x100,position=1,$destroy=Quit")
constant panel = create(GtkBox,"orientation=VERTICAL")
add(win,panel)
constant toolbar = create(GtkToolbar,{
{"icon size",GTK_ICON_SIZE_LARGE_TOOLBAR}})
add(panel,toolbar)
for i = 1 to length(items) do
set(toolbar,"insert",items[i],-1)
set(items[i],"tooltip markup",tips[i])
end for
constant doclbl = create(GtkLabel,{{"markup",docs}})
add(panel,doclbl)
show_all(win)
main()
----------------------------------------------
function Foo(atom ctl, integer i)
----------------------------------------------
Info(win,,"You clicked",cap[i],,cap[i])
return 1
end function