Compare commits
1 Commits
master
...
windows-dr
Author | SHA1 | Date |
---|---|---|
|
19b2f58d6f |
|
@ -1,9 +1,12 @@
|
||||||
! Copyright (C) 2005, 2009 Slava Pestov.
|
! Copyright (C) 2005, 2009 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors kernel memoize namespaces ui.commands ui.gadgets
|
USING: accessors io io.encodings.string io.encodings.utf8 kernel
|
||||||
ui.gadgets.borders ui.gadgets.buttons ui.gadgets.buttons.private
|
libc literals memoize multiline namespaces prettyprint sequences
|
||||||
ui.gadgets.glass ui.gadgets.menus ui.gadgets.status-bar
|
system ui.commands ui.gadgets ui.gadgets.borders
|
||||||
ui.gadgets.worlds ui.gestures ui.operations ui.pens.solid ui.theme ;
|
ui.gadgets.buttons ui.gadgets.buttons.private ui.gadgets.glass
|
||||||
|
ui.gadgets.menus ui.gadgets.status-bar ui.gadgets.worlds
|
||||||
|
ui.gestures ui.operations ui.pens.solid ui.theme
|
||||||
|
windows.kernel32 ;
|
||||||
IN: ui.gadgets.presentations
|
IN: ui.gadgets.presentations
|
||||||
|
|
||||||
TUPLE: presentation < button object hook ;
|
TUPLE: presentation < button object hook ;
|
||||||
|
@ -56,6 +59,51 @@ PRIVATE>
|
||||||
M: presentation-menu hide-glass-hook
|
M: presentation-menu hide-glass-hook
|
||||||
presentation>> button-pen-boundary >>boundary drop ;
|
presentation>> button-pen-boundary >>boundary drop ;
|
||||||
|
|
||||||
|
SYMBOL: platform-drag-object
|
||||||
|
|
||||||
|
HOOK: start-platform-drag os ( obj -- )
|
||||||
|
|
||||||
|
M: object start-platform-drag
|
||||||
|
drop ;
|
||||||
|
|
||||||
|
! TODO: move to windows
|
||||||
|
! TODO: add a null?
|
||||||
|
: string>global-alloc ( string -- alien )
|
||||||
|
flags{ GMEM_ZEROINIT GMEM_MOVEABLE } over length GlobalAlloc
|
||||||
|
[
|
||||||
|
[
|
||||||
|
! TODO: CopyMemory instead? same thing?
|
||||||
|
swap utf8 encode dup length memcpy
|
||||||
|
] with-global-lock
|
||||||
|
] keep ;
|
||||||
|
|
||||||
|
! check out: https://web.archive.org/web/20080514153357/http://www.catch22.net/tuts/dragdrop5.asp
|
||||||
|
! TODO: move to windows
|
||||||
|
M: windows start-platform-drag
|
||||||
|
[
|
||||||
|
![[
|
||||||
|
platform-drag-object get [
|
||||||
|
[ "platform-drag-object already set" print flush ] with-global
|
||||||
|
drop
|
||||||
|
] [
|
||||||
|
object>>
|
||||||
|
[ DoDragDrop ]
|
||||||
|
[ platform-drag-object set ]
|
||||||
|
[ . flush ] tri
|
||||||
|
] if
|
||||||
|
|
||||||
|
flags{ DROPEFFECT_COPY DROPEFFECT_MOVE }
|
||||||
|
f
|
||||||
|
DoDragDrop
|
||||||
|
|
||||||
|
]]
|
||||||
|
object>> unparse string>global-alloc drop
|
||||||
|
! DoDragDrop
|
||||||
|
!
|
||||||
|
|
||||||
|
"start drag " write nano-count . flush
|
||||||
|
] with-global ;
|
||||||
|
|
||||||
presentation H{
|
presentation H{
|
||||||
{ T{ button-down f f 3 } [ show-presentation-menu ] }
|
{ T{ button-down f f 3 } [ show-presentation-menu ] }
|
||||||
{ mouse-leave [ [ hide-status ] [ button-update ] bi ] }
|
{ mouse-leave [ [ hide-status ] [ button-update ] bi ] }
|
||||||
|
@ -65,4 +113,5 @@ presentation H{
|
||||||
! nested presentation and is still inside the parent, the
|
! nested presentation and is still inside the parent, the
|
||||||
! parent doesn't receive a mouse-enter
|
! parent doesn't receive a mouse-enter
|
||||||
{ motion [ show-mouse-help ] }
|
{ motion [ show-mouse-help ] }
|
||||||
|
{ T{ drag f 1 } [ start-platform-drag ] }
|
||||||
} set-gestures
|
} set-gestures
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
! Copyright (C) 2008, 2009 Joe Groff, Slava Pestov.
|
! Copyright (C) 2008, 2009 Joe Groff, Slava Pestov.
|
||||||
! Copyright (C) 2017-2018 Alexander Ilin.
|
! Copyright (C) 2017-2018 Alexander Ilin.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors alien.accessors classes.struct kernel
|
USING: accessors alien.accessors classes.struct io kernel math
|
||||||
namespaces sequences ui.backend.windows ui.gadgets.worlds
|
namespaces sequences ui.backend.windows ui.gadgets.worlds
|
||||||
ui.gestures windows.com windows.com.wrapper windows.dropfiles
|
ui.gestures windows.com windows.com.wrapper windows.dropfiles
|
||||||
windows.kernel32 windows.ole32 windows.user32 ;
|
windows.kernel32 windows.ole32 windows.user32 ;
|
||||||
|
@ -40,6 +40,23 @@ SYMBOL: +listener-dragdrop-wrapper+
|
||||||
|
|
||||||
<<
|
<<
|
||||||
{
|
{
|
||||||
|
{ IDropSource {
|
||||||
|
[ ! HRESULT GiveFeedback ( DWORD dwEffect )
|
||||||
|
[ "GiveFeedback" print flush ] with-global
|
||||||
|
2drop DRAGDROP_S_USEDEFAULTCURSORS
|
||||||
|
] [ ! HRESULT QueryContinueDrag ( BOOL fEscapePressed, DWORD grfKeyState )
|
||||||
|
[ "QueryContinueDrag" print flush ] with-global
|
||||||
|
over [
|
||||||
|
3drop DRAGDROP_S_CANCEL
|
||||||
|
] [
|
||||||
|
2nip MK_LBUTTON MK_RBUTTON bitor bitand 0 > [
|
||||||
|
DRAGDROP_S_DROP
|
||||||
|
] [
|
||||||
|
S_OK
|
||||||
|
] if
|
||||||
|
] if
|
||||||
|
]
|
||||||
|
} }
|
||||||
{ IDropTarget {
|
{ IDropTarget {
|
||||||
[ ! HRESULT DragEnter ( IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect )
|
[ ! HRESULT DragEnter ( IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect )
|
||||||
DROPEFFECT_COPY swap 0 set-alien-unsigned-4 3drop
|
DROPEFFECT_COPY swap 0 set-alien-unsigned-4 3drop
|
||||||
|
|
Loading…
Reference in New Issue