summaryrefslogtreecommitdiff
path: root/redo/label_unix.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-08-03 16:28:21 -0400
committerPietro Gagliardi <[email protected]>2014-08-03 16:28:21 -0400
commitb6d07237b423b690570e105e5f0810d35693b0d0 (patch)
treefdf2f0ec2a66f217080dfeb0b60de9e763a9bd95 /redo/label_unix.go
parentfd48be68ee957e936c272348d3f0b0bddaba5c92 (diff)
Migrated the GTK+ backend to the new Control system. Added controlParent to deal with interface issues; need to apply this to the Windows backend too.
Diffstat (limited to 'redo/label_unix.go')
-rw-r--r--redo/label_unix.go45
1 files changed, 35 insertions, 10 deletions
diff --git a/redo/label_unix.go b/redo/label_unix.go
index 1776b73..7ff6c1d 100644
--- a/redo/label_unix.go
+++ b/redo/label_unix.go
@@ -17,11 +17,10 @@ import "C"
// - standalone label on its own: should it be centered or not?
type label struct {
- *controlbase
- misc *C.GtkMisc
- label *C.GtkLabel
- standalone bool
- supercommitResize func(c *allocation, d *sizing)
+ _widget *C.GtkWidget
+ misc *C.GtkMisc
+ label *C.GtkLabel
+ standalone bool
}
func finishNewLabel(text string, standalone bool) *label {
@@ -29,13 +28,11 @@ func finishNewLabel(text string, standalone bool) *label {
defer freegstr(ctext)
widget := C.gtk_label_new(ctext)
l := &label{
- controlbase: newControl(widget),
+ _widget: widget,
misc: (*C.GtkMisc)(unsafe.Pointer(widget)),
label: (*C.GtkLabel)(unsafe.Pointer(widget)),
standalone: standalone,
}
- l.supercommitResize = l.fcommitResize
- l.fcommitResize = l.labelcommitResize
return l
}
@@ -57,7 +54,31 @@ func (l *label) SetText(text string) {
C.gtk_label_set_text(l.label, ctext)
}
-func (l *label) labelcommitResize(c *allocation, d *sizing) {
+func (l *label) widget() *C.GtkWidget {
+ return l._widget
+}
+
+func (l *label) setParent(p *controlParent) {
+ basesetParent(l, p)
+}
+
+func (l *label) containerShow() {
+ basecontainerShow(l)
+}
+
+func (l *label) containerHide() {
+ basecontainerHide(l)
+}
+
+func (l *label) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
+ return baseallocate(l, x, y, width, height, d)
+}
+
+func (l *label) preferredSize(d *sizing) (width, height int) {
+ return basepreferredSize(l, d)
+}
+
+func (l *label) commitResize(c *allocation, d *sizing) {
if !l.standalone && c.neighbor != nil {
c.neighbor.getAuxResizeInfo(d)
if d.shouldVAlignTop {
@@ -67,5 +88,9 @@ func (l *label) labelcommitResize(c *allocation, d *sizing) {
C.gtk_misc_set_alignment(l.misc, 0, 0.5)
}
}
- l.supercommitResize(c, d)
+ basecommitResize(l, c, d)
+}
+
+func (l *label) getAuxResizeInfo(d *sizing) {
+ basegetAuxResizeInfo(d)
}