added eugtk examples
This commit is contained in:
58
eugtk/examples/test176.ex
Normal file
58
eugtk/examples/test176.ex
Normal file
@@ -0,0 +1,58 @@
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
--# GtkToggleToolButtons
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
include GtkEngine.e
|
||||
|
||||
constant docs = `<u><b>ToggleToolButtons</b></u>
|
||||
Choose none, several, or all options.
|
||||
Click buttons above.
|
||||
`
|
||||
constant names = {"Clown","Dragon","Fish"}
|
||||
|
||||
constant win = create(GtkWindow,"border=10,size=300x300,position=1,$destroy=Quit")
|
||||
|
||||
constant panel = create(GtkBox,VERTICAL)
|
||||
add(win,panel)
|
||||
|
||||
constant bar = create(GtkToolbar)
|
||||
pack(panel,bar)
|
||||
|
||||
object tb = repeat(0,3)
|
||||
|
||||
constant img1 = create(GdkPixbuf,"thumbnails/clown.png",25,25)
|
||||
tb[1]= create(GtkToggleToolButton,"1","Show",1)
|
||||
set(tb[1],"icon widget",create(GtkImage,img1))
|
||||
|
||||
constant img2 = create(GdkPixbuf,"thumbnails/dragon.png",25,25)
|
||||
tb[2] = create(GtkToggleToolButton,"2","Show",2)
|
||||
set(tb[2],"icon widget",create(GtkImage,img2))
|
||||
|
||||
constant img3 = create(GdkPixbuf,"thumbnails/fish.png",25,25)
|
||||
tb[3] = create(GtkToggleToolButton,"3","Show",3)
|
||||
set(tb[3],"icon widget",create(GtkImage,img3))
|
||||
|
||||
add(bar,tb)
|
||||
|
||||
constant lbl1 = create(GtkLabel)
|
||||
set(lbl1,"markup",docs)
|
||||
add(panel,lbl1)
|
||||
|
||||
constant lbl2 = create(GtkLabel,"font=18,color=red")
|
||||
add(panel,lbl2)
|
||||
|
||||
show_all(win)
|
||||
main()
|
||||
|
||||
--------------------------------------------
|
||||
global function Show(atom ctl, atom data)
|
||||
--------------------------------------------
|
||||
object txt = "", char = " "
|
||||
for i = 1 to 3 do
|
||||
if get(tb[i],"active") then char = "✔" else char = " " end if
|
||||
txt &= sprintf("%s %s\n",{names[i],char})
|
||||
end for
|
||||
set(lbl2,"markup",txt)
|
||||
return 1
|
||||
end function
|
||||
Reference in New Issue
Block a user