Sha256: 9b1c6afd18df946301af30e48df200b63f49359e3492af4f41909a18c48e7fba

Contents?: true

Size: 947 Bytes

Versions: 15

Compression:

Stored size: 947 Bytes

Contents

# @provides MotionKit::NSTableViewHelpers
# @requires MotionKit::NSViewHelpers
module MotionKit
  class NSTableViewHelpers < NSViewHelpers
    targets NSTableView

    def add_column(column_or_identifier, &block)
      if column_or_identifier.is_a?(NSTableColumn)
        column = column_or_identifier
      else
        column = NSTableColumn.alloc.initWithIdentifier(column_or_identifier)
        column.headerCell.stringValue = column_or_identifier
      end
      target.addTableColumn(column)
      context(column, &block)

      column
    end
    alias add_table_column add_column

    def column(column_or_identifier, &block)
      if column_or_identifier.is_a?(NSTableColumn)
        column = column_or_identifier
      else
        column_index = target.columnWithIdentifier(column_or_identifier)
        column = target.tableColumns[column_index]
      end
      context(column, &block)
    end
    alias table_column column

  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
motion-kit-1.1.1 lib/motion-kit-osx/helpers/nstableview_helpers.rb
motion-kit-1.1.0 lib/motion-kit-osx/helpers/nstableview_helpers.rb
motion-kit-1.0.3 lib/motion-kit-osx/helpers/nstableview_helpers.rb
motion-kit-1.0.2 lib/motion-kit-osx/helpers/nstableview_helpers.rb
motion-kit-1.0.1 lib/motion-kit-osx/helpers/nstableview_helpers.rb
motion-kit-1.0.0 lib/motion-kit-osx/helpers/nstableview_helpers.rb
motion-kit-0.18.0 lib/motion-kit-osx/helpers/nstableview_helpers.rb
motion-kit-0.17.0 lib/motion-kit-osx/helpers/nstableview_helpers.rb
motion-kit-0.16.0 lib/motion-kit-osx/helpers/nstableview_helpers.rb
motion-kit-0.15.0 lib/motion-kit-osx/helpers/nstableview_helpers.rb
motion-kit-0.14.2 lib/motion-kit-osx/helpers/nstableview_helpers.rb
motion-kit-0.14.1 lib/motion-kit-osx/helpers/nstableview_helpers.rb
motion-kit-0.14.0 lib/motion-kit-osx/helpers/nstableview_helpers.rb
motion-kit-0.13.0 lib/motion-kit-osx/helpers/nstableview_helpers.rb
motion-kit-0.12.0 lib/motion-kit-osx/layouts/nstableview_helpers.rb