summaryrefslogtreecommitdiff
path: root/textbox_darwin.go
blob: 0ad47f60ed4f3bc739c4ee72c42ea7cd3a0d7037 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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)
}