Skip to content

Winamp-styled tableview for macos (without Winamp controls), using in reAMP playlist

License

Notifications You must be signed in to change notification settings

alexfreud/RETableView

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RETableView

macOS 10.13+ ONLY!

Winamp-styled table (without Winamp controls), using in reAMP playlist.

Screenshot from reAMP playlist window

Install

Swift package only, add this repo URL to your project, setup delegate and enjoy!

import RETableView
...
// Init RETableView
let tableView = RETableView(frame: frame)
tableView.delegate = self
addSubview(tableView)

// Use you own NSSlider
tableView.slider = slider

// Enable drag&drop support
tableView.registerForDraggedTypes([.fileURL])

// Load data to table
tableView.reloadData()

// Use you own color theme
let newTheme = RETableViewTheme(font: NSFont.boldSystemFont(ofSize: 12),
                                                    backgroundColor: .black,
                                                      textColor: .white,
                                                      textActiveColor: .green,
                                                      selectionColor: .blue)
tableView.theme = newTheme

Delegate methods

    /// Return the number of rows in a table view.
    var numberOfRows: Int { get }

    /// Item to insert in a particular location of the table view.
    /// - Parameter index: An index locating a row in tableView.
    func getItem(at index: Int) -> RETableViewItem

    /// Add dragged URLs at index position
    /// - Parameters:
    ///   - urls: Array of dragged URLs
    ///   - index: Index, where URLs must be inserted
    func add(_ urls: [URL], at index: Int)

    /// Doubleclicked or enter-pressed item index
    /// - Parameter index: Item index
    func itemDidPressed(at index: Int)

    /// Selected items in table
    /// - Parameter indexSet: Set of selected items indexes
    func didSelect(rows indexSet: Set<Int>)

    /// Items to be removed from table
    /// - Parameter indexSet: Indexes of removable items
    func didRemove(indexSet: Set<Int>)

    /// Begin items moving in table
    func didBeginMovingItems()

    /// End items moving in table
    func didEndMovingItems()

    /// Moving items in table
    /// - Parameters:
    ///   - difference: Step by which the elements in the table have shifted
    ///   - movingIndexes: Moving items indexes
    func didMoveItems(difference: Int, movingIndexes: Set<Int>)

About Me

License

MIT

About

Winamp-styled tableview for macos (without Winamp controls), using in reAMP playlist

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages