added eugtk examples
This commit is contained in:
68
eugtk/examples/test50.ex
Normal file
68
eugtk/examples/test50.ex
Normal file
@@ -0,0 +1,68 @@
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
--# GtkLevelBar
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
include GtkEngine.e
|
||||
|
||||
requires("3.6","GtkLevelBar")
|
||||
|
||||
constant docs = `
|
||||
The GtkLevelBar is a bar widget that can be used
|
||||
as a level indicator. Typical use cases are
|
||||
displaying the strength of a password,
|
||||
or showing the charge level of a battery.
|
||||
Colors and steps are adjustable.
|
||||
`
|
||||
constant win = create(GtkWindow,
|
||||
"title=Window,size=300x300,border_width=10,icon=face-cool,keep above=1,$destroy=Quit")
|
||||
|
||||
constant panel = create(GtkBox,"orientation=VERTICAL,spacing=10")
|
||||
add(win,panel)
|
||||
|
||||
constant hdr = create(GtkLabel,"markup=<u><b>GtkLevelBar</b></u>")
|
||||
add(panel,hdr)
|
||||
|
||||
constant lb = create(GtkLevelBar)
|
||||
set(lb,{
|
||||
{"name","Levelbar"},
|
||||
{"size request",-1,20},
|
||||
{"min value",0},
|
||||
{"max value",10},
|
||||
{"add offset value","low",3.0},
|
||||
{"add offset value","my-offset",5.00},
|
||||
{"add offset value","high",7.00}})
|
||||
add(panel,lb)
|
||||
|
||||
constant scale = create(GtkScale,HORIZONTAL,0,10,0.001)
|
||||
set(scale,"digits",2)
|
||||
connect(scale,"value changed","Update")
|
||||
add(panel,scale)
|
||||
|
||||
constant lbl = create(GtkLabel,{
|
||||
{"markup",docs}})
|
||||
add(panel,lbl)
|
||||
|
||||
constant box = create(GtkButtonBox)
|
||||
pack_end(panel,box)
|
||||
|
||||
constant mode = create(GtkCheckButton,"Discrete",_("ChangeMode"))
|
||||
|
||||
constant btn = create(GtkButton,"gtk-quit","Quit")
|
||||
add(box,{btn,mode})
|
||||
|
||||
show_all(win)
|
||||
main()
|
||||
|
||||
global function Update()
|
||||
atom val = allocate(32)
|
||||
set(lb,"value",get(scale,"value"))
|
||||
display("Value [.2]",get(lb,"value"),1)
|
||||
return 1
|
||||
end function
|
||||
|
||||
function ChangeMode(atom ctl)
|
||||
set(lb,"mode",get(ctl,"active"))
|
||||
return 1
|
||||
end function
|
||||
|
||||
Reference in New Issue
Block a user