Added Mac OS X Labels and a bunch of TODOs. Now for Listboxes... oh boy...

This commit is contained in:
Pietro Gagliardi 2014-03-02 19:56:54 -05:00
parent 75c34a0789
commit 77c0198751
2 changed files with 22 additions and 0 deletions

View File

@ -67,6 +67,9 @@ var (
_indexOfSelectedItem = sel_getUid("indexOfSelectedItem")
_addItemWithObjectValue = sel_getUid("addItemWithObjectValue:")
_insertItemWithObjectValueAtIndex = sel_getUid("insertItemWithObjectValue:atIndex:")
_setEditable = sel_getUid("setEditable:")
_setBordered = sel_getUid("setBordered:")
_setDrawsBackground = sel_getUid("setDrawsBackground:")
)
func controlShow(what C.id) {
@ -211,6 +214,22 @@ var classTypes = [nctypes]*classData{
alttextsel: _stringValue,
},
c_label: &classData{
make: func(parentWindow C.id, alternate bool) C.id {
label := objc_alloc(_NSTextField)
label = objc_msgSend_rect(label, _initWithFrame,
0, 0, 100, 100)
C.objc_msgSend_bool(label, _setEditable, C.BOOL(C.NO))
C.objc_msgSend_bool(label, _setBordered, C.BOOL(C.NO))
C.objc_msgSend_bool(label, _setDrawsBackground, C.BOOL(C.NO))
// TODO others?
windowView := C.objc_msgSend_noargs(parentWindow, _contentView)
C.objc_msgSend_id(windowView, _addSubview, label)
return label
},
show: controlShow,
hide: controlHide,
settextsel: _setStringValue,
textsel: _stringValue,
},
c_listbox: &classData{
},

View File

@ -21,6 +21,8 @@ so I don't forget:
- have Combobox.InsertBefore, Listbox.InsertBefore, Combobox.Delete, and Listbox.Delete return an error on invalid index before creation
- make the Windows implementation of message boxes run on uitask
- ensure MsgBoxError can run if initialization failed if things change ever
- should Labels be selectable?
- should message box text be selectable on all platforms or only on those that make it the default?
important things:
- ui.Go() should exit when the main() you pass in exits
@ -29,6 +31,7 @@ important things:
- I think Cocoa NSButton text is not vertically aligned properly...?
- NSComboBox scans the entered text to see if it matches one of the items and returns the index of that item if it does; find out how to suppress this so that it returns -1 unless the item was chosen from the list (like the other platforms)
- figure out what to do about deleting a nonexistent item; each backend responds differently by default
- some Cocoa controls don't seem to resize correctly: Buttons have space around the edges and don't satisfy stretchiness; Labels in the grid test window get cropped
- there's no GTK+ error handling whatsoever; we need to figure out how it works
- make sure GTK+ documentation point differences don't matter
- button sizes and LineEdit sizes on Windows seem too big; Comboboxes have margins