56 lines
1.2 KiB
Elixir
56 lines
1.2 KiB
Elixir
|
|
--# GtkNotebook with css styling;
|
|
|
|
include GtkEngine.e
|
|
|
|
constant provider = create(GtkCssProvider,canonical_path("resources/mystyle6.css"))
|
|
|
|
constant pgs = { -- text, bg color, icon, angle
|
|
{"Hello World!","light yellow","face-cool"},
|
|
{"Goodbye World!","sky blue","face-sad"}
|
|
}
|
|
|
|
constant win = create(GtkWindow,"position=1,border=10,$destroy=Quit")
|
|
|
|
constant panel = create(GtkBox,"orientation=VERTICAL")
|
|
add(win,panel)
|
|
|
|
constant nb = create(GtkNotebook,{
|
|
{"name","frame4"},
|
|
{"size request",200,200},
|
|
{"popup enable"}})
|
|
add(panel,nb)
|
|
|
|
for i = 1 to length(pgs) do
|
|
set(nb,"append page",build_page(pgs[i]))
|
|
end for
|
|
|
|
constant box = create(GtkButtonBox)
|
|
pack_end(panel,box)
|
|
|
|
constant btn1 = create(GtkButton,"gtk-quit","Quit")
|
|
add(box,btn1)
|
|
|
|
show_all(win)
|
|
main()
|
|
|
|
------------------------------
|
|
function build_page(object p)
|
|
------------------------------
|
|
object pg = create(GtkBox)
|
|
object eb = create(GtkEventBox)
|
|
pack(pg,eb,1,1)
|
|
object bx = create(GtkBox,"orientation=HORIZONTAL,margin=10")
|
|
add(eb,bx)
|
|
set(eb,"background",p[2])
|
|
add(bx,create(GtkLabel,{{"markup",p[1]}}))
|
|
object img = create(GtkImage,p[3],100,100,1)
|
|
add(bx,img)
|
|
set(pg,"name",p[3])
|
|
return pg
|
|
end function
|
|
|
|
|
|
|
|
|