summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-03-02 19:56:54 -0500
committerPietro Gagliardi <[email protected]>2014-03-02 19:56:54 -0500
commit77c0198751b3c72804918070942123d1b4a5c4f1 (patch)
treeeb303f521f98bc8e596839ada8e5a85be64879d0
parent75c34a07890834aba8ec6b0cba98a36c2c663ede (diff)
Added Mac OS X Labels and a bunch of TODOs. Now for Listboxes... oh boy...
-rw-r--r--sysdata_darwin.go19
-rw-r--r--todo.md3
2 files changed, 22 insertions, 0 deletions
diff --git a/sysdata_darwin.go b/sysdata_darwin.go
index bb5bbb6..95c972d 100644
--- a/sysdata_darwin.go
+++ b/sysdata_darwin.go
@@ -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{
},
diff --git a/todo.md b/todo.md
index 5448f08..2672548 100644
--- a/todo.md
+++ b/todo.md
@@ -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