From 5f6a4ee69024ac727a990f52b93f642d5178dae5 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Sun, 2 Mar 2014 09:17:42 -0500 Subject: [PATCH] Added Mac OS X Checkboxes. --- sysdata_darwin.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sysdata_darwin.go b/sysdata_darwin.go index 1b99dce..407927c 100644 --- a/sysdata_darwin.go +++ b/sysdata_darwin.go @@ -48,6 +48,7 @@ var ( _setAction = sel_getUid("setAction:") _contentView = sel_getUid("contentView") _addSubview = sel_getUid("addSubview:") + _setButtonType = sel_getUid("setButtonType:") ) func controlShow(what C.id) { @@ -109,6 +110,19 @@ var classTypes = [nctypes]*classData{ textsel: _title, }, c_checkbox: &classData{ + make: func(parentWindow C.id) C.id { + checkbox := objc_alloc(_NSButton) + checkbox = objc_msgSend_rect(checkbox, _initWithFrame, + 0, 0, 100, 100) + objc_msgSend_uint(checkbox, _setButtonType, 3) // NSSwitchButton + windowView := C.objc_msgSend_noargs(parentWindow, _contentView) + C.objc_msgSend_id(windowView, _addSubview, checkbox) + return checkbox + }, + show: controlShow, + hide: controlHide, + settextsel: _setTitle, + textsel: _title, }, c_combobox: &classData{ },