summaryrefslogtreecommitdiff
path: root/checkbox_darwin.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-10-18 17:03:07 -0400
committerPietro Gagliardi <[email protected]>2014-10-18 17:03:07 -0400
commit62048303a34f6cac733798651adb53b640e2114a (patch)
treeb03994dfe1d5cfbc94be65075f3345a45166bbef /checkbox_darwin.go
parent8c8b642adbed274133b6e9d975c7ca8786300d2c (diff)
Merged new container/sizing stuff.
Diffstat (limited to 'checkbox_darwin.go')
-rw-r--r--checkbox_darwin.go40
1 files changed, 8 insertions, 32 deletions
diff --git a/checkbox_darwin.go b/checkbox_darwin.go
index 126662c..1578add 100644
--- a/checkbox_darwin.go
+++ b/checkbox_darwin.go
@@ -10,7 +10,7 @@ import (
import "C"
type checkbox struct {
- _id C.id
+ *controlSingleObject
toggled *event
}
@@ -18,11 +18,11 @@ func newCheckbox(text string) *checkbox {
ctext := C.CString(text)
defer C.free(unsafe.Pointer(ctext))
c := &checkbox{
- _id: C.newCheckbox(),
+ controlSingleObject: newControlSingleObject(C.newCheckbox()),
toggled: newEvent(),
}
- C.buttonSetText(c._id, ctext)
- C.checkboxSetDelegate(c._id, unsafe.Pointer(c))
+ C.buttonSetText(c.id, ctext)
+ C.checkboxSetDelegate(c.id, unsafe.Pointer(c))
return c
}
@@ -31,21 +31,21 @@ func (c *checkbox) OnToggled(e func()) {
}
func (c *checkbox) Text() string {
- return C.GoString(C.buttonText(c._id))
+ return C.GoString(C.buttonText(c.id))
}
func (c *checkbox) SetText(text string) {
ctext := C.CString(text)
defer C.free(unsafe.Pointer(ctext))
- C.buttonSetText(c._id, ctext)
+ C.buttonSetText(c.id, ctext)
}
func (c *checkbox) Checked() bool {
- return fromBOOL(C.checkboxChecked(c._id))
+ return fromBOOL(C.checkboxChecked(c.id))
}
func (c *checkbox) SetChecked(checked bool) {
- C.checkboxSetChecked(c._id, toBOOL(checked))
+ C.checkboxSetChecked(c.id, toBOOL(checked))
}
//export checkboxToggled
@@ -53,27 +53,3 @@ func checkboxToggled(xc unsafe.Pointer) {
c := (*checkbox)(unsafe.Pointer(xc))
c.toggled.fire()
}
-
-func (c *checkbox) id() C.id {
- return c._id
-}
-
-func (c *checkbox) setParent(p *controlParent) {
- basesetParent(c, p)
-}
-
-func (c *checkbox) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
- return baseallocate(c, x, y, width, height, d)
-}
-
-func (c *checkbox) preferredSize(d *sizing) (width, height int) {
- return basepreferredSize(c, d)
-}
-
-func (c *checkbox) commitResize(a *allocation, d *sizing) {
- basecommitResize(c, a, d)
-}
-
-func (c *checkbox) getAuxResizeInfo(d *sizing) {
- basegetAuxResizeInfo(c, d)
-}