added eugtk examples
This commit is contained in:
61
eugtk/examples/test76.ex
Normal file
61
eugtk/examples/test76.ex
Normal file
@@ -0,0 +1,61 @@
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
--# Display size, mouse location within window, etc.
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
include GtkEngine.e
|
||||
|
||||
atom disp = create(GdkDisplay)
|
||||
atom scrn = get(disp,"default screen")
|
||||
|
||||
constant win = create(GtkWindow,
|
||||
"size=200x100,border_width=10,position=1,icon=gnome-run,$destroy=Quit")
|
||||
|
||||
constant panel = create(GtkBox,VERTICAL,10)
|
||||
add(win,panel)
|
||||
|
||||
constant top = create(GtkBox,HORIZONTAL,10)
|
||||
add(panel,top)
|
||||
|
||||
constant pix = create(GdkPixbuf,"thumbnails/gnome-run.png",100,100,1)
|
||||
constant img = create(GtkImage,pix)
|
||||
add(top,img)
|
||||
|
||||
constant lbl = create(GtkLabel,
|
||||
"markup='Show info about computer display\nMove window, click OK button'")
|
||||
add(top,lbl)
|
||||
|
||||
constant
|
||||
btn1 = create(GtkButton,"gtk-quit","Quit"),
|
||||
btn2 = create(GtkButton,"gtk-ok","ShowStats"),
|
||||
btnbox = create(GtkButtonBox)
|
||||
add(btnbox,{btn1,btn2})
|
||||
pack(panel,-btnbox)
|
||||
|
||||
show_all(win)
|
||||
main()
|
||||
|
||||
---------------------------------------------------
|
||||
global function ShowStats()
|
||||
---------------------------------------------------
|
||||
object
|
||||
pointer_loc = get(win,"pointer"),
|
||||
cursor_size = get(disp,"maximal cursor size"),
|
||||
shapes = get(disp,"supports shapes"),
|
||||
composite = get(disp,"supports composite"),
|
||||
scrn_dim = {get(scrn,"width"),get(scrn,"height")},
|
||||
size = get(win,"size"),
|
||||
pos = get(win,"position")
|
||||
|
||||
set(lbl,"markup",format(`
|
||||
<b>Pointer location:</b>[]x[]
|
||||
<b>Cursor size:</b>[]x[]
|
||||
<b>Supports shapes:</b>[]
|
||||
<b>Supports composite:</b>[]
|
||||
<b>Screen dimensions:</b>[]x[]
|
||||
<b>Window size:</b> []x[]
|
||||
<b>Window position:</b> []x[]`,
|
||||
flatten(pointer_loc & cursor_size & shapes & composite & scrn_dim & size & pos)))
|
||||
|
||||
return 1
|
||||
end function
|
||||
Reference in New Issue
Block a user