! See http://factorcode.org/license.txt for BSD license.
USING: alien alien.c-types alien.strings arrays assocs ui
ui.gadgets ui.backend ui.clipboards ui.gadgets.worlds
- ui.gestures io kernel math math.vectors namespaces prettyprint
+ ui.gestures io kernel math math.vectors namespaces
sequences strings vectors words windows.kernel32 windows.gdi32
windows.user32 windows.opengl32 windows.messages windows.types
windows.nt windows threads libc combinators continuations
SINGLETON: windows-ui-backend
- : crlf>lf CHAR: \r swap remove ;
- : lf>crlf [ [ dup CHAR: \n = [ CHAR: \r , ] when , ] each ] "" make ;
+ : crlf>lf ( str -- str' )
+ CHAR: \r swap remove ;
+
+ : lf>crlf ( str -- str' )
+ [ [ dup CHAR: \n = [ CHAR: \r , ] when , ] each ] "" make ;
: enum-clipboard ( -- seq )
0
{ 123 "F12" }
} ;
- : key-state-down?
+ : key-state-down? ( key -- ? )
GetKeyState 16 bit? ;
: left-shift? ( -- ? ) VK_LSHIFT key-state-down? ;
"uint" { "void*" "uint" "long" "long" } "stdcall" [
[
pick
- trace-messages? get-global [ dup windows-message-name . ] when
+ trace-messages? get-global [ dup windows-message-name word-name print flush ] when
wm-handlers get-global at* [ call ] [ drop DefWindowProc ] if
] ui-try
] alien-callback ;
] [ cleanup-win32-ui ] [ ] cleanup
] ui-running ;
+M: windows-ui-backend beep ( -- )
+ 0 MessageBeep drop ;
+
windows-ui-backend ui-backend set-global
[ "ui" ] main-vocab-hook set-global