summaryrefslogtreecommitdiff
path: root/sysdata_darwin.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-03-02 19:01:34 -0500
committerPietro Gagliardi <[email protected]>2014-03-02 19:01:34 -0500
commite2476a567d9b6191c91fb507bd1da6cf76d98b77 (patch)
tree83e72906bbb3b59ce037b47bd559c79ba6dcd2b8 /sysdata_darwin.go
parent4bc35e2db57476c5faf40e971e5f91e497ac3f0a (diff)
Added the Mac OS X implementation of LineEdit. It seems to work... mostly. The password entry field is outside the window for some reason; need to figure out how to place things in their proper place.
Diffstat (limited to 'sysdata_darwin.go')
-rw-r--r--sysdata_darwin.go22
1 files changed, 21 insertions, 1 deletions
diff --git a/sysdata_darwin.go b/sysdata_darwin.go
index 137bd42..bb5bbb6 100644
--- a/sysdata_darwin.go
+++ b/sysdata_darwin.go
@@ -36,6 +36,8 @@ var (
_NSButton = objc_getClass("NSButton")
_NSPopUpButton = objc_getClass("NSPopUpButton")
_NSComboBox = objc_getClass("NSComboBox")
+ _NSTextField = objc_getClass("NSTextField")
+ _NSSecureTextField = objc_getClass("NSSecureTextField")
_initWithContentRect = sel_getUid("initWithContentRect:styleMask:backing:defer:")
_initWithFrame = sel_getUid("initWithFrame:")
@@ -48,7 +50,6 @@ var (
_state = sel_getUid("state")
_title = sel_getUid("title")
_stringValue = sel_getUid("stringValue")
- // TODO others
_frame = sel_getUid("frame")
_setFrameDisplay = sel_getUid("setFrame:display:")
_setBezelStyle = sel_getUid("setBezelStyle:")
@@ -189,6 +190,25 @@ var classTypes = [nctypes]*classData{
},
},
c_lineedit: &classData{
+ make: func(parentWindow C.id, alternate bool) C.id {
+ var lineedit C.id
+
+ if alternate {
+ lineedit = objc_alloc(_NSSecureTextField)
+ } else {
+ lineedit = objc_alloc(_NSTextField)
+ }
+ lineedit = objc_msgSend_rect(lineedit, _initWithFrame,
+ 0, 0, 100, 100)
+ windowView := C.objc_msgSend_noargs(parentWindow, _contentView)
+ C.objc_msgSend_id(windowView, _addSubview, lineedit)
+ return lineedit
+ },
+ show: controlShow,
+ hide: controlHide,
+ settextsel: _setStringValue,
+ textsel: _stringValue,
+ alttextsel: _stringValue,
},
c_label: &classData{
},