2016-11-25 00:33:18 -07:00

39 lines
1.2 KiB
Elixir

------------------------------------------------------------------------
--# 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()