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

77 lines
2.0 KiB
Elixir

---------------------------------------------------------------
--# GtkHeaderBar
---------------------------------------------------------------
include GtkEngine.e
requires("3.10","GtkHeaderBar")
constant msg = {"Euphoria is great!","C is too much work"}
constant sub = {"Easy to use","overly complex"}
constant goose = create(GdkPixbuf,"thumbnails/mongoose.png",30,0,1)
constant win = create(GtkWindow,{
{"title","GtkHeaderBar"},
{"border width",10},
{"default size",300,300},
{"position",GTK_WIN_POS_CENTER},
{"connect","destroy","Quit"}})
constant panel = create(GtkBox,"orientation=VERTICAL,spacing=10")
add(win,panel)
constant bar = create(GtkHeaderBar,{
{"title","Header Bar"},
{"subtitle","New in GTK 10"},
{"show close button",FALSE}})
pack(panel,bar)
constant list = create(GtkListBox,"$row-activated=Boo")
add(panel,list)
constant item1 = create(GtkButtonBox),
cap1 = create(GtkLabel,"Euphoria Mascot"),
img1 = create(GtkImage,goose)
add(item1,{cap1,img1})
constant item2 = create(GtkButtonBox),
cap2 = create(GtkLabel,"C Mascot"),
btn2 = create(GtkButton,"Click me","ShowInfo")
add(item2,{cap2,btn2})
constant item3 = create(GtkLabel,{{"text",LGPL}})
set(item3,"tooltip text","Click me")
set(list,{
{"insert",item1,-1},
{"insert",item2,-1},
{"insert",item3,-1}})
constant box = create(GtkButtonBox),
okbtn = create(GtkButton,"gtk-quit","Quit")
pack(panel,-box)
add(box,okbtn)
show_all(win)
main()
---------------------------------------------------------
global function Boo(atom ctl, ListBoxRow row, atom data)
---------------------------------------------------------
integer i = get(row,"index")
if i > 0 and i < 3 then
set(bar,"title",msg[i])
set(bar,"subtitle",sub[i])
else
Info(,,"LGPL","EuGTK is licensed under the LGPL",,goose)
end if
return 1
end function
--------------------------
global function ShowInfo()
--------------------------
return Info(,"Mascots","The C Mascot","is an aspirin tablet")
end function