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.

This commit is contained in:
Pietro Gagliardi 2014-03-02 19:01:34 -05:00
parent 4bc35e2db5
commit e2476a567d
1 changed files with 21 additions and 1 deletions

View File

@ -36,6 +36,8 @@ var (
_NSButton = objc_getClass("NSButton") _NSButton = objc_getClass("NSButton")
_NSPopUpButton = objc_getClass("NSPopUpButton") _NSPopUpButton = objc_getClass("NSPopUpButton")
_NSComboBox = objc_getClass("NSComboBox") _NSComboBox = objc_getClass("NSComboBox")
_NSTextField = objc_getClass("NSTextField")
_NSSecureTextField = objc_getClass("NSSecureTextField")
_initWithContentRect = sel_getUid("initWithContentRect:styleMask:backing:defer:") _initWithContentRect = sel_getUid("initWithContentRect:styleMask:backing:defer:")
_initWithFrame = sel_getUid("initWithFrame:") _initWithFrame = sel_getUid("initWithFrame:")
@ -48,7 +50,6 @@ var (
_state = sel_getUid("state") _state = sel_getUid("state")
_title = sel_getUid("title") _title = sel_getUid("title")
_stringValue = sel_getUid("stringValue") _stringValue = sel_getUid("stringValue")
// TODO others
_frame = sel_getUid("frame") _frame = sel_getUid("frame")
_setFrameDisplay = sel_getUid("setFrame:display:") _setFrameDisplay = sel_getUid("setFrame:display:")
_setBezelStyle = sel_getUid("setBezelStyle:") _setBezelStyle = sel_getUid("setBezelStyle:")
@ -189,6 +190,25 @@ var classTypes = [nctypes]*classData{
}, },
}, },
c_lineedit: &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{ c_label: &classData{
}, },