added eugtk examples
This commit is contained in:
62
eugtk/examples/test144.ex
Normal file
62
eugtk/examples/test144.ex
Normal file
@@ -0,0 +1,62 @@
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
--# Accelerators a.k.a. 'hot keys'
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
include GtkEngine.e
|
||||
|
||||
constant docs = `<b><u>Keyboard Accelerators</u></b>,
|
||||
Try alt-o, alt-c, or ctl-alt-x
|
||||
or use the File menu.`
|
||||
|
||||
constant win = create(GtkWindow,"size=200x-1,$destroy=Quit")
|
||||
|
||||
constant group = create(GtkAccelGroup)
|
||||
set(win,"add accel group",group)
|
||||
|
||||
constant panel = create(GtkBox,VERTICAL)
|
||||
add(win,panel)
|
||||
|
||||
constant menu = create(GtkMenuBar)
|
||||
pack(panel,menu)
|
||||
|
||||
constant menuitem1 = create(GtkMenuItem,"_File")
|
||||
constant filemenu = create(GtkMenu)
|
||||
|
||||
constant
|
||||
fileopen = create(GtkMenuItem,"_Open","FOpen",0,{group,"<Alt>o"}),
|
||||
fileclose = create(GtkMenuItem,"_Close","FClose",0,{group,"<alt>c"}),
|
||||
filesep = create(GtkSeparatorMenuItem),
|
||||
filequit = create(GtkMenuItem,"_Quit","QuitOK",0,{group,"<ctl><alt>x"})
|
||||
set(filemenu,"append",{fileopen,fileclose,filesep,filequit})
|
||||
set(menuitem1,"submenu",filemenu)
|
||||
set(menu,"append",menuitem1)
|
||||
|
||||
constant img = create(GtkImage,"thumbnails/keybindings.png")
|
||||
|
||||
constant lbl = create(GtkLabel,{{"markup",docs}})
|
||||
add(panel,{img,lbl})
|
||||
|
||||
show_all(win)
|
||||
main()
|
||||
|
||||
------------------------------------------------------------------------
|
||||
global function FOpen()
|
||||
------------------------------------------------------------------------
|
||||
return Info(win,"FOpen","Open a file")
|
||||
end function
|
||||
|
||||
------------------------------------------------------------------------
|
||||
global function FClose()
|
||||
------------------------------------------------------------------------
|
||||
return Info(win,"FClose","Close the file")
|
||||
end function
|
||||
|
||||
------------------------------------------------------------------------
|
||||
global function QuitOK()
|
||||
------------------------------------------------------------------------
|
||||
if Question(win,"Quit","Are you sure?") = MB_YES then Quit()
|
||||
end if
|
||||
return 1
|
||||
end function
|
||||
|
||||
Reference in New Issue
Block a user