Code: Select all
; // Value used in WebViewWndProc For Gestures
#WM_GESTURE =$0119
#WM_GESTURENOTIFY =$011A
;
; // Gesture Information Flags
#GF_BEGIN=$01
#GF_INERTIA=$02
#GF_END=$04
;
; // Gesture IDs
Enumeration 1
#GID_BEGIN ; 1
#GID_END ;2
#GID_ZOOM ;3
#GID_PAN ;4
#GID_ROTATE ;5
#GID_TWOFINGERTAP ;6
#GID_PRESSANDTAP ;7
EndEnumeration
#GID_ROLLOVER=#GID_PRESSANDTAP
;
#GC_ALLGESTURES=$01
; // Zoom Gesture Confiration Flags
#GC_ZOOM=$01
;
; // Pan Gesture Configuration Flags
#GC_PAN=$01
#GC_PAN_WITH_SINGLE_FINGER_VERTICALLY=$02
#GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY=$04
#GC_PAN_WITH_GUTTER=$08
#GC_PAN_WITH_INERTIA=$10
;
; // Rotate Gesture Configuration Flags
#GC_ROTATE=$01
;
; // Two finger tap configuration flags
#GC_TWOFINGERTAP=$01
;
; // Press And tap Configuration Flags
#GC_PRESSANDTAP=$01
#GC_ROLLOVER=#GC_PRESSANDTAP
;
; // GESTUREINFO struct definition
Structure GESTUREINFO
cbSize.l ; // size, in bytes, of this structure (including variable length Args field)
dwFlags.l ; // see GF_* flags
dwID.l ; // gesture ID, see GID_* defines
hwndTarget.l ; // handle to window targeted by this gesture
ptsLocation.points ; // current location of this gesture
dwInstanceID.l ; // internally used
dwSequenceID.l ; // internally used
ullArguments.q ; // arguments for gestures whose arguments fit in 8 BYTES
cbExtraArgs.l ; // size, in bytes, of extra arguments, if any, that accompany this gesture
EndStructure
;
; // GESTURECONFIG struct defintion
Structure GESTURECONFIG
dwID.l ; // gesture ID
dwWant.l ; // settings related to gesture ID that are to be turned on
dwBlock.l ; // settings related to gesture ID that are to be turned off
EndStructure
; * Gesture notification Structure
; * - The WM_GESTURENOTIFY message lParam contains a pointer To this Structure.
; * - The WM_GESTURENOTIFY message notifies a window that gesture recognition is
; * in progress And a gesture will be generated If one is recognized under the
; * current gesture settings.
Structure GESTURENOTIFY
cbSize.l ; // size, in bytes, of this structure
dwFlags.l ; // unused
hwndTarget.l ; // handle to window targeted by the gesture
ptsLocation.points ; // starting location
dwInstanceID.l ; // internally used
EndStructure
Global Dim GestureConfig.l(2)
GestureConfig(1)=#GC_ALLGESTURES
CompilerIf #PB_Compiler_OS=#PB_OS_Windows
Procedure MainWinddowCallback(hWnd,uMsg,wParam,lParam)
result=#PB_ProcessPureBasicEvents
Select uMsg
Case #WM_NOTIFY
Case #WM_GESTURE
lib=OpenLibrary(#PB_Any,"user32.dll")
If lib
Debug("lib open")
gi.GESTUREINFO\cbSize=SizeOf(GESTUREINFO)
If CallFunction(lib,"GetGestureInfo",lParam,@gi)
Select gi\dwID
Case #GID_BEGIN:Debug("Gesture begin")
Case #GID_END:Debug("Gesture end")
Case #GID_ZOOM:Debug("Gesture zoom")
result=#False
Case #GID_PAN:Debug("Gesture pan")
result=#False
Case #GID_ROTATE:Debug("Gesture rotate")
result=#False
Case #GID_TWOFINGERTAP:Debug("Gesture two finger tap")
result=#False
Case #GID_PRESSANDTAP:Debug("Gesture press and tap")
result=#False
Default
Debug("Gesture unknown")
EndSelect
CallFunction(lib,"CloseGestureInfoHandle",lParam)
EndIf
CloseLibrary(lib)
EndIf
Case #WM_GESTURENOTIFY
; *gesturenotify.GESTURENOTIFY=lParam
lib=OpenLibrary(#PB_Any,"user32.dll")
If lib
CallFunction(lib,"SetGestureConfig",hWnd,0,1,@GestureConfig(0),3*4)
CloseLibrary(lib)
EndIf
EndSelect
ProcedureReturn result
EndProcedure
CompilerEndIf
;
; Open a window, and do some stuff with it...
;
#W_Main=0
If OpenWindow(#W_Main, 100, 200, 195, 260, "PureBasic Window", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget)
CompilerIf #PB_Compiler_OS=#PB_OS_Windows
SetWindowCallback(@MainWinddowCallback(),#W_Main)
CompilerEndIf
Repeat
Event = WaitWindowEvent()
If Event = #PB_Event_CloseWindow ; If the user has pressed on the close button
Quit = 1
EndIf
Until Quit = 1
EndIf
End ; All the opened windows are closed automatically by PureBasic

