Required plugins for this example: MBS MacBase Plugin, MBS MacFrameworks Plugin, MBS Main Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacFrameworks/QuickLook/QuickLook Panel
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
EventHandler Sub Open()
if not QLPreviewPanelMBS.Available then
MsgBox "QuickLook Panel requires Mac OS X 10.6"
end if
End EventHandler
End Class
Class Window1 Inherits Window
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action()
p=nil
p=new MyPreviewPanel
p.LoadList SpecialFolder.Desktop
p.Show
End EventHandler
End Control
Control PushButton2 Inherits PushButton
ControlInstance PushButton2 Inherits PushButton
EventHandler Sub Action()
p=nil
p=new MyPreviewPanel
p.LoadList SpecialFolder.Pictures
p.Show
End EventHandler
End Control
Control Canvas1 Inherits Canvas
ControlInstance Canvas1 Inherits Canvas
EventHandler Function MouseDown(X As Integer, Y As Integer) As Boolean
Return true
End EventHandler
EventHandler Sub MouseUp(X As Integer, Y As Integer)
dim f as FolderItem = SpecialFolder.Temporary.Child("logo.jpg")
dim pic as Picture = LogoMBS(500)
f.SaveAsJPEG pic
p=nil
p=new MyPreviewPanel
p.IsLogo=true
p.pic=pic
p.files.Append f
p.Show
End EventHandler
EventHandler Sub Open()
me.Backdrop=LogoMBS(100)
End EventHandler
End Control
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Property p As MyPreviewPanel
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 MyPreviewPanel Inherits QLPreviewPanelMBS
EventHandler Function handleEvent(e as NSEventMBS) As boolean
Return false
End EventHandler
EventHandler Function numberOfPreviewItems() As integer
Return UBound(files)+1
End EventHandler
EventHandler Function previewItemAtIndex(index as integer) As folderitem
Return files(index)
End EventHandler
EventHandler Function sourceFrameOnScreenForPreviewItem(file as folderitem) As NSRectMBS
if IsLogo then
dim r as NSRectMBS
dim w as window1 = window1
dim c as Canvas = w.canvas1
dim s as screen = screen(0)
r=NSMakeRectMBS(w.Left+c.Left, s.height-(w.top+c.top+c.Height), c.Width, c.Height)
Return r
end if
End EventHandler
Sub LoadList(f as FolderItem)
dim r as integer
dim c as integer = f.Count
for i as integer=1 to c
dim g as FolderItem = f.trueitem(i)
if g.Visible and not g.Directory then
files.Append g
end if
next
End Sub
Property IsLogo As Boolean
Property files() As FolderItem
Property pic As Picture
End Class