Platforms to show: All Mac Windows Linux Cross-Platform

/MacFrameworks/IKImageBrowser/IKImageBrowser


Required plugins for this example: MBS MacFrameworks Plugin, MBS AVFoundation Plugin, MBS MacCocoa Plugin, MBS MacBase Plugin, MBS MacOSX Plugin, MBS Main Plugin, MBS MacCG Plugin, MBS MacCF Plugin, MBS MacControls Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacFrameworks/IKImageBrowser/IKImageBrowser

This example is the version from Thu, 27th Mar 2013.

Project "IKImageBrowser.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control MyCocoaControl Inherits CocoaControlMBS
ControlInstance MyCocoaControl Inherits CocoaControlMBS
EventHandler Function GetView() As NSViewMBS Imagebrowser = new MyIKImageBrowserViewMBS(0, 0, me.Width, me.Height) Imagebrowser.allowsReordering = true Imagebrowser.allowsMultipleSelection = true Imagebrowser.allowsEmptySelection = true Imagebrowser.animates = true Imagebrowser.zoomValue = 0.43 Imagebrowser.autoresizesSubviews = true Imagebrowser.cellsStyleMask = Imagebrowser.IKCellsStyleShadowed + Imagebrowser.IKCellsStyleTitled Imagebrowser.isHidden = false dim folder as FolderItem = SpecialFolder.Desktop.Child("test") dim files() as FolderItem = readfolder(folder) Imagebrowser.setfiles files Imagebrowser.reloadData Return Imagebrowser End EventHandler
End Control
Control list Inherits Listbox
ControlInstance list Inherits Listbox
End Control
Function readfolder(folder as FolderItem) As FolderItem() dim files() as FolderItem dim c as integer = folder.Count for i as integer = 1 to c dim item as FolderItem = folder.TrueItem(i) if item <> nil and item.Visible then if item.Directory then dim items() as FolderItem = readfolder(item) for each it as FolderItem in items files.Append it next else files.Append item end if end if next Return files End Function
Property Imagebrowser As MyIKImageBrowserViewMBS
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 MyIKImageBrowserViewMBS Inherits IKImageBrowserViewMBS
EventHandler Function itemAtIndex(index as integer) As IKImageBrowserItemMBS if items(index) = nil then // we auto generate here an ID for each new item we create static counter as integer counter = counter + 1 dim uid as string = str(counter) dim path as string = files(index).UnixpathMBS dim version as integer = 1 dim title as string = files(index).DisplayName items(index) = IKImageBrowserItemMBS.ItemWithPath(uid, path, version, title) end if Return items(index) End EventHandler
EventHandler Function numberOfItems() As integer Return UBound(files)+1 End EventHandler
EventHandler Sub removeItemsAtIndexes(indexes as NSIndexSetMBS) break End EventHandler
EventHandler Sub selectionDidChange() dim s as string dim indexset as NSIndexSetMBS = me.selectionIndexes s = indexset.Operator_Convert s = s + " ("+str(indexset.count)+")" window1.list.AddRow "selection changed to "+s End EventHandler
Sub setFiles(files() as FolderItem) self.files = files redim items(-1) redim items(UBound(files)) End Sub
Property files() As FolderItem
Property items() As IKImageBrowserItemMBS
End Class
End Project

See also:

The items on this page are in the following plugins: MBS MacFrameworks Plugin.


The biggest plugin in space...