Class: HotCocoa::PopUpItemList
- Includes:
- Enumerable
- Defined in:
- lib/hotcocoa/mappings/appkit/popup.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#control ⇒ Object
readonly
Returns the value of attribute control.
Instance Method Summary collapse
- #<<(title) ⇒ Object
- #[](index) ⇒ Object
- #delete(title) ⇒ Object
- #each(&block) ⇒ Object
-
#initialize(control) ⇒ PopUpItemList
constructor
A new instance of PopUpItemList.
- #insert(title, at: index) ⇒ Object
- #selected ⇒ Object
- #selected=(title) ⇒ Object
- #selected_index ⇒ Object
- #size ⇒ Object
Constructor Details
#initialize(control) ⇒ PopUpItemList
Returns a new instance of PopUpItemList.
7 8 9 |
# File 'lib/hotcocoa/mappings/appkit/popup.rb', line 7 def initialize control @control = control end |
Instance Attribute Details
#control ⇒ Object (readonly)
Returns the value of attribute control.
5 6 7 |
# File 'lib/hotcocoa/mappings/appkit/popup.rb', line 5 def control @control end |
Instance Method Details
#<<(title) ⇒ Object
11 12 13 |
# File 'lib/hotcocoa/mappings/appkit/popup.rb', line 11 def << title control.addItemWithTitle title end |
#[](index) ⇒ Object
15 16 17 |
# File 'lib/hotcocoa/mappings/appkit/popup.rb', line 15 def [] index control.itemTitleAtIndex index end |
#delete(title) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/hotcocoa/mappings/appkit/popup.rb', line 19 def delete title if title.kind_of? Fixnum control.removeItemAtIndex title else control.removeItemWithTitle title end end |
#each(&block) ⇒ Object
51 52 53 |
# File 'lib/hotcocoa/mappings/appkit/popup.rb', line 51 def each &block control.itemTitles.each &block end |
#insert(title, at: index) ⇒ Object
27 28 29 |
# File 'lib/hotcocoa/mappings/appkit/popup.rb', line 27 def insert title, at: index control.insertItemWithTitle title, atIndex: index end |
#selected ⇒ Object
31 32 33 |
# File 'lib/hotcocoa/mappings/appkit/popup.rb', line 31 def selected control.titleOfSelectedItem end |
#selected=(title) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/hotcocoa/mappings/appkit/popup.rb', line 35 def selected= title if title.kind_of? Fixnum control.selectItemAtIndex title else control.selectItemWithTitle title end end |
#selected_index ⇒ Object
43 44 45 |
# File 'lib/hotcocoa/mappings/appkit/popup.rb', line 43 def selected_index control.indexOfSelectedItem end |
#size ⇒ Object
47 48 49 |
# File 'lib/hotcocoa/mappings/appkit/popup.rb', line 47 def size control.numberOfItems end |