added eugtk examples
This commit is contained in:
38
eugtk/examples/test2.ex
Normal file
38
eugtk/examples/test2.ex
Normal file
@@ -0,0 +1,38 @@
|
||||
|
||||
------------------------------------------------------------------------
|
||||
--# How to use a custom cursor;
|
||||
------------------------------------------------------------------------
|
||||
|
||||
include GtkEngine.e
|
||||
|
||||
constant goose = locate_file("thumbnails/mongoose.png") -- image to use for cursor;
|
||||
|
||||
constant win = create(GtkWindow,
|
||||
"title=OpenEuphoria,border=10,position=1,icon=face-smile,$destroy=Quit")
|
||||
|
||||
constant panel = create(GtkBox,"orientation=VERTICAL")
|
||||
add(win,panel)
|
||||
|
||||
constant img = create(GtkImage,"thumbnails/euphoria.gif")
|
||||
add(panel,img)
|
||||
|
||||
show_all(win)
|
||||
|
||||
------------------------------------------------------------
|
||||
-- custom cursors must be created AFTER the window they are
|
||||
-- to be used in is instantiated (a.k.a. shown)
|
||||
------------------------------------------------------------
|
||||
constant -- create custom cursor from image file;
|
||||
pix = create(GdkPixbuf,goose,32,32) -- size 32x32px;
|
||||
set(win,"cursor",pix,12,5) -- location of 'hot spot';
|
||||
|
||||
-- if you prefer a pre-built cursor, use one of the enums in
|
||||
-- GtkEnums:
|
||||
-- set(win,"cursor",GDK_WATCH)
|
||||
|
||||
-- this can also be used as a 'wait' indication while some long
|
||||
-- process takes place...
|
||||
|
||||
main()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user