Platforms to show: All Mac Windows Linux Cross-Platform
Required plugins for this example: MBS MacCF Plugin, MBS Main Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacCF/Gestures
This example is the version from Mon, 5th May 2019.
Project "Gestures.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
EventHandler Sub Open()
if TargetMachO then
e=new MyEvents
e.Listen
init
else
MsgBox "This example requires Mac OS X 10.5.5"
quit
end if
End EventHandler
EventHandler Sub Paint(g As Graphics, areas() As REALbasic.Rect)
draw g
End EventHandler
Sub draw(g as Graphics)
g.ForeColor=&cFFFFFF
g.FillRect 0,0,g.Width,g.Height
g.DrawObject v,g.Width/2,g.Height/2
End Sub
Sub init()
dim r as new RectShape
r.Width=100
r.Height=100
v=r
End Sub
Sub redraw()
#if RBVersion >= 2013 then
self.Invalidate
#else
self.Refresh
#endif
End Sub
Property e As MyEvents
Property v As Object2D
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
Class MyEvents Inherits CarbonApplicationEventsMBS
EventHandler Function GestureEnded(GlobalMouseX as double, GlobalMouseY as double, WindowHandle as integer, WindowMouseX as double, WindowMouseY as double, WindowPartCode as integer, KeyModifiers as integer) As boolean
window1.v.FillColor=&c000000
window1.redraw
End EventHandler
EventHandler Function GestureMagnify(GlobalMouseX as double, GlobalMouseY as double, WindowHandle as integer, WindowMouseX as double, WindowMouseY as double, WindowPartCode as integer, KeyModifiers as integer, MagnificationAmount as double) As boolean
window1.v.Scale=window1.v.Scale+MagnificationAmount
window1.redraw
End EventHandler
EventHandler Function GestureRotate(GlobalMouseX as double, GlobalMouseY as double, WindowHandle as integer, WindowMouseX as double, WindowMouseY as double, WindowPartCode as integer, KeyModifiers as integer, RotationAmount as double) As boolean
const pi=3.14159265
window1.v.Rotation=window1.v.Rotation-RotationAmount/180.0*pi
window1.redraw
End EventHandler
EventHandler Function GestureStarted(GlobalMouseX as double, GlobalMouseY as double, WindowHandle as integer, WindowMouseX as double, WindowMouseY as double, WindowPartCode as integer, KeyModifiers as integer) As boolean
window1.v.FillColor=&cFF0000
window1.redraw
End EventHandler
EventHandler Function GestureSwipe(GlobalMouseX as double, GlobalMouseY as double, WindowHandle as integer, WindowMouseX as double, WindowMouseY as double, WindowPartCode as integer, KeyModifiers as integer, SwipeDirectionX as double, SwipeDirectionY as double) As boolean
window1.init
window1.redraw
End EventHandler
End Class
End Project
The items on this page are in the following plugins: MBS MacCF Plugin.