Class: MotionKit::NSTableViewHelpers

Inherits:
NSViewHelpers show all
Defined in:
lib/motion-kit-osx/helpers/nstableview_helpers.rb

Direct Known Subclasses

NSTableViewLayout

Instance Attribute Summary

Attributes inherited from BaseLayout

#parent

Instance Method Summary collapse

Methods inherited from NSViewHelpers

#_calculate_frame, #_fix_frame_value, #above, #after, #autoresizing_mask, #before, #below, #bottom, #center, #center_x, #center_y, #compression_priority, #constraints, #content_compression_resistance_priority, #content_hugging_priority, #flipped?, #frame, #from_bottom, #from_bottom_left, #from_bottom_right, #from_center, #from_left, #from_right, #from_top, #from_top_left, #from_top_right, #height, #hugging_priority, #origin, #relative_to, #right, #size, #top, #width, #x, #y

Methods inherited from Layout

#add_child, #constraints, #default_root, #remove_child

Methods inherited from TreeLayout

#add, #all, #all_views, #always, #build, #built?, #child_layouts, #create, #create_default_root_context, #first, #forget, #forget_tree, #forget_view, #get, #get_view, #initial, #initial?, #initialize, #last, #last_view, #name_element, #nearest, #next, #nth, #nth_view, #prev, #reapply, #reapply!, #reapply?, #reapply_blocks, #remove, #remove_view, #root, #run_reapply_blocks, view, #view

Methods inherited from BaseLayout

#add_deferred_block, #apply, #apply_with_context, #apply_with_target, #context, #deferred, #deferred_blocks, delegate_method_fix, #has_context?, #initialize, #ipad?, #iphone35?, #iphone47?, #iphone4?, #iphone55?, #iphone?, #is_parent_layout?, #method_missing, #objc_version, #orientation?, #orientation_block, #parent_layout, #retina?, #ruby_version, #run_deferred, #set_parent_layout, #target, #tv?, #v

Methods included from BaseLayoutClassMethods

#layout_for, #memoize, #target_klasses, #targets

Constructor Details

This class inherits a constructor from MotionKit::TreeLayout

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class MotionKit::BaseLayout

Instance Method Details

#add_column(column_or_identifier, &block) ⇒ Object Also known as: add_table_column



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/motion-kit-osx/helpers/nstableview_helpers.rb', line 7

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

#column(column_or_identifier, &block) ⇒ Object Also known as: table_column



21
22
23
24
25
26
27
28
29
# File 'lib/motion-kit-osx/helpers/nstableview_helpers.rb', line 21

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