diff options
| author | Pietro Gagliardi <[email protected]> | 2014-10-24 16:38:23 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-10-24 16:38:23 -0400 |
| commit | 08f6e6beeb618f9b55329e5a861c595db7334f65 (patch) | |
| tree | f28c1f68c112ff6d7df05f14373994778c1a457b /textbox_darwin.go | |
| parent | d82a6bc36d029c89cd677276fcab65db28992414 (diff) | |
Added Mac OS X Textbox Go-side implementation. Doesn't quite work yet.
Diffstat (limited to 'textbox_darwin.go')
| -rw-r--r-- | textbox_darwin.go | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/textbox_darwin.go b/textbox_darwin.go new file mode 100644 index 0000000..0ad47f6 --- /dev/null +++ b/textbox_darwin.go @@ -0,0 +1,33 @@ +// 24 october 2014 + +package ui + +import ( + "unsafe" +) + +// #include "objc_darwin.h" +import "C" + +type textbox struct { + *scroller +} + +func newTextbox() Textbox { + id := C.newTextbox() + t := &textbox{ + scroller: newScroller(id, true), // border on Textbox (TODO confirm type) + } + // TODO preferred size + return t +} + +func (t *textbox) Text() string { + return C.GoString(C.textboxText(t.id)) +} + +func (t *textbox) SetText(text string) { + ctext := C.CString(text) + defer C.free(unsafe.Pointer(ctext)) + C.textboxSetText(t.id, ctext) +} |
