summaryrefslogtreecommitdiff
path: root/olddocs/cocoalists
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-05-16 19:57:25 -0400
committerPietro Gagliardi <[email protected]>2014-05-16 19:57:25 -0400
commit332f9ffd5b77c73bb077933b4b5f592c9d9cde6c (patch)
tree8c344eecd660c35da0990a6826d0d425f98e6646 /olddocs/cocoalists
parentdc179b3a44581d0e2da5748c69792de7b98d96a6 (diff)
Moved some old documents out of the top-level directory and into a folder olddocs/ to make things neater.
Diffstat (limited to 'olddocs/cocoalists')
-rw-r--r--olddocs/cocoalists78
1 files changed, 78 insertions, 0 deletions
diff --git a/olddocs/cocoalists b/olddocs/cocoalists
new file mode 100644
index 0000000..ee7283c
--- /dev/null
+++ b/olddocs/cocoalists
@@ -0,0 +1,78 @@
+NSPopUpButton (non-editable combo box)
+ make:
+ b = [[NSPopUpButton alloc]
+ initWithFrame:(0, 0, 100, 100)
+ pullsDown:NO]
+ add:
+ [b addItemWithTitle:toNSString(s)]
+ insertBefore:
+ [b insertItemWithTitle:toNSString(s)
+ atIndex:index] (NSInteger)
+ remove:
+ [b removeItemAtIndex:index] (NSInteger)
+ selection:
+ fromNSString([b titleOfSelectedItem])
+ (returns nil if nothing is selected; need to edit to return "" if so)
+ selectedIndex:
+ [b indexOfSelectedItem] (NSInteger)
+ (returns -1 if nothing is selected)
+NSComboBox (editable combo box)
+ make:
+ b = [[NSComboBox alloc]
+ initWithFrame:(0, 0, 100, 100)]
+ [b setUsesDataSource:NO] // internal data soruce
+ add:
+ [b addItemWithObjectValue:toNSString(s)]
+ insertBefore:
+ [b insertItemWithObjectValue:toNSString(s)
+ atIndex:index] (NSInteger)
+ remove:
+ [b removeItemAtIndex:index] (NSInteger)
+ selection:
+ this depends on if the /user/ selecting an item changes the edit box
+ this appears to be the case, so
+ fromNSString([b stringValue])
+ note that if we ever add Combobox.SetText(), we are responsible for managing both the edit field AND the list, as they are programmatically separate
+ selectedIndex:
+ [b indexOfSelectedItem] (NSInteger)
+ (returns -1 if nothing is selected)
+ (TODO custom text?)
+NSTableView (listbox)
+ make:
+ b = [[NSTableView alloc]
+ initWithFrame:(0, 0, 100, 100)]
+ col = [[NSTableColumn alloc]
+ initWithIdentifier:@"listboxcolumn"]
+ listDict = [NSMutableDictionary xxxx]
+ listItems = [[xxx]]
+ [listItems addObject:listDict]
+ [col bind:@"value"
+ toObject:listItems
+ withKeyPath:@"xxxxx.listboxcolumn"
+ options:nilid]
+ [b addTableColumn:col]
+ // TODO autoresizing
+ add:
+ insertBefore:
+ remove:
+ selection:
+ idx = [b selectedRow] (NSInteger)
+ if idx == -1 {
+ return ""
+ }
+ dataSource = [b dataSource]
+ selectedIndex:
+ [b selectedRow] (NSInteger)
+ (returns -1 if none selected)
+ selectedIndices:
+ nsidx = [b selectedRowIndexes]
+ c = [nsidx count] (NSUInteger)
+ nsidxbuf = C.makeNSUIntegerArray(c)
+ [nsidx getIndexes:nsidxbuf
+ maxCont:c
+ inIndexRange:nilid]
+ // and just copy out of nsidxbuf somehow
+ // I think this is going to have to make 2 temporary arrays; a better option will be needed! TODO
+ selectedTexts:
+ indices := selectedIndices()
+ dataSource = [b dataSource]