added eugtk examples

This commit is contained in:
2016-11-25 00:33:18 -07:00
parent 87a821e3da
commit c0b98b619e
877 changed files with 96872 additions and 0 deletions

70
eugtk/examples/test164.ex Normal file
View File

@@ -0,0 +1,70 @@
--------------------------------------------------------------------------
--# GtkStack with visible stack switcher
--------------------------------------------------------------------------
include GtkEngine.e
requires("3.10","GtkStack")
integer which = 1
constant txt =
`<span font='bold 16'>GtkStack</span>
The GtkStack widget is a container which only shows one of its children at a time.
In contrast to GtkNotebook, GtkStack does not provide a means for users to change
the visible child. Instead, the GtkStackSwitcher widget (two buttons above)
can be used with GtkStack to provide this functionality.
Transitions between pages can be animated as slides or fades. This can be controlled
with gtk_stack_set_transition_type(). These animations respect the
"gtk-enable-animations" setting.
`
constant win = create(GtkWindow,"border=10,position=1,$destroy=Quit")
constant panel = create(GtkGrid)
add(win,panel)
constant
img1 = create(GtkImage,"thumbnails/mongoose.png"),
img2 = create(GtkImage,"thumbnails/clown.svg"),
lgpl = create(GtkLabel,LGPL),
stk = create(GtkStack,{
{"transition duration",1000},
{"transition type",GTK_STACK_TRANSITION_TYPE_SLIDE_UP_DOWN},
{"add titled",img1,"Eu","Euphoria"},
{"add titled",img2,"C","C"}})
set(panel,"attach",stk,1,6,4,1)
constant switcher = create(GtkStackSwitcher)
set(switcher,"stack",stk)
set(panel,"attach",switcher,2,10,4,4)
constant lbl = create(GtkLabel,{
{"markup",txt},
{"font","8"},
{"line wrap",TRUE}})
set(panel,"attach",lbl,1,15,4,4)
constant box = create(GtkButtonBox)
add(box,{
create(GtkButton,"gtk-quit","Quit"),
create(GtkButton,"Change Mascots","Change")})
set(panel,"attach",box,1,20,4,4)
show_all(win)
main()
-------------------------
global function Change()
-------------------------
object current = get(stk,"visible child name")
if equal("Eu",current) then
set(stk,"visible child name","C")
else
set(stk,"visible child name","Eu")
end if
return 1
end function