factor/library/ui/events.factor

46 lines
1.2 KiB
Factor
Raw Normal View History

2005-02-01 22:00:55 -05:00
! Copyright (C) 2005 Slava Pestov.
! See http://factor.sf.net/license.txt for BSD license.
IN: gadgets
USING: arrays alien gadgets-layouts generic kernel lists math
2005-11-15 12:58:44 -05:00
namespaces sdl sequences strings freetype opengl ;
2005-02-01 22:00:55 -05:00
2005-04-30 14:27:40 -04:00
M: object handle-event ( event -- )
2005-02-01 22:00:55 -05:00
drop ;
M: button-down-event handle-event ( event -- )
2005-11-15 12:58:44 -05:00
update-clicked
button-event-button dup
hand get hand-buttons push
[ button-down ] button-gesture ;
2005-02-01 22:00:55 -05:00
M: button-up-event handle-event ( event -- )
2005-11-15 12:58:44 -05:00
button-event-button dup
hand get hand-buttons delete
[ button-up ] button-gesture ;
2005-02-05 11:52:24 -05:00
: motion-event-loc ( event -- loc )
dup motion-event-x swap motion-event-y 0 3array ;
2005-02-01 22:00:55 -05:00
2005-11-15 12:58:44 -05:00
M: motion-event handle-event ( event -- )
motion-event-loc move-hand ;
2005-02-07 10:24:03 -05:00
M: key-down-event handle-event ( event -- )
2005-02-12 21:15:30 -05:00
dup keyboard-event>binding
2005-10-07 20:26:21 -04:00
hand get hand-focus handle-gesture [
keyboard-event-unicode dup control? [
2005-02-12 21:15:30 -05:00
drop
] [
2005-10-07 20:26:21 -04:00
hand get hand-focus user-input drop
2005-09-24 15:21:17 -04:00
] if
2005-02-12 21:15:30 -05:00
] [
drop
2005-09-24 15:21:17 -04:00
] if ;
2005-11-15 12:58:44 -05:00
M: quit-event handle-event ( event -- )
drop stop-world ;
M: resize-event handle-event ( event -- )
flush-fonts
gl-resize
width get height get 0 3array world get set-gadget-dim ;