Fixed compiler errors. Now to fix runtime errors! Woo!

This commit is contained in:
Pietro Gagliardi 2014-10-17 23:14:00 -04:00
parent f363a790cc
commit aabbe36b44
6 changed files with 18 additions and 20 deletions

View File

@ -102,7 +102,7 @@ func newArea(ab *areabase) Area {
func (a *area) SetSize(width, height int) { func (a *area) SetSize(width, height int) {
a.width = width a.width = width
a.height = height a.height = height
C.gtk_widget_set_size_request(a._widget, C.gint(a.width), C.gint(a.height)) C.gtk_widget_set_size_request(a.widget, C.gint(a.width), C.gint(a.height))
} }
func (a *area) Repaint(r image.Rectangle) { func (a *area) Repaint(r image.Rectangle) {
@ -110,11 +110,11 @@ func (a *area) Repaint(r image.Rectangle) {
if r.Empty() { if r.Empty() {
return return
} }
C.gtk_widget_queue_draw_area(a._widget, C.gint(r.Min.X), C.gint(r.Min.Y), C.gint(r.Dx()), C.gint(r.Dy())) C.gtk_widget_queue_draw_area(a.widget, C.gint(r.Min.X), C.gint(r.Min.Y), C.gint(r.Dx()), C.gint(r.Dy()))
} }
func (a *area) RepaintAll() { func (a *area) RepaintAll() {
C.gtk_widget_queue_draw(a._widget) C.gtk_widget_queue_draw(a.widget)
} }
func (a *area) OpenTextFieldAt(x, y int) { func (a *area) OpenTextFieldAt(x, y int) {

View File

@ -42,10 +42,10 @@ func (c *container) allocation(margined bool) C.GtkAllocation {
C.gtk_widget_get_allocation(c.widget, &a) C.gtk_widget_get_allocation(c.widget, &a)
if margined { if margined {
a.x += C.gint(gtkXMargin) a.x += C.int(gtkXMargin)
a.y += C.gint(gtkYMargin) a.y += C.int(gtkYMargin)
a.width -= C.gint(gtkXMargin) * 2 a.width -= C.int(gtkXMargin) * 2
a.height -= C.gint(gtkYMargin) * 2 a.height -= C.int(gtkYMargin) * 2
} }
return a return a
} }
@ -59,9 +59,7 @@ const (
func (w *window) beginResize() (d *sizing) { func (w *window) beginResize() (d *sizing) {
d = new(sizing) d = new(sizing)
if spaced { d.xpadding = gtkXPadding
d.xpadding = gtkXPadding d.ypadding = gtkYPadding
d.ypadding = gtkYPadding
}
return d return d
} }

View File

@ -114,7 +114,7 @@ func newScroller(widget *C.GtkWidget, native bool, bordered bool, overlay bool)
s.overlay = newControlSingleWidget(s.overlaywidget) s.overlay = newControlSingleWidget(s.overlaywidget)
s.fsetParent = s.overlay.fsetParent s.fsetParent = s.overlay.fsetParent
s.fresize = s.overlay.fresize s.fresize = s.overlay.fresize
C.gtk_container_add(s.overlaycontainer, s.scrollcontainer) C.gtk_container_add(s.overlaycontainer, s.scrollwidget)
} }
return s return s

View File

@ -50,7 +50,7 @@ func newGroup(text string, control Control) Group {
C.gtk_label_set_attributes(label, boldlist) C.gtk_label_set_attributes(label, boldlist)
C.pango_attr_list_unref(boldlist) // thanks baedert in irc.gimp.net/#gtk+ C.pango_attr_list_unref(boldlist) // thanks baedert in irc.gimp.net/#gtk+
g.container = newContainer(control) g.container = newContainer()
g.child.setParent(g.container.parent()) g.child.setParent(g.container.parent())
g.container.setParent(&controlParent{g.gcontainer}) g.container.setParent(&controlParent{g.gcontainer})
@ -80,7 +80,7 @@ func (g *group) SetMargined(margined bool) {
func (g *group) resize(x int, y int, width int, height int, d *sizing) { func (g *group) resize(x int, y int, width int, height int, d *sizing) {
// first, chain up to change the GtkFrame and its child container // first, chain up to change the GtkFrame and its child container
// TODO use a variable for this // TODO use a variable for this
g.containerSingleWidget.resize(x, y, width, height, d) g.controlSingleWidget.resize(x, y, width, height, d)
// now that the container has the correct size, we can resize the child // now that the container has the correct size, we can resize the child
a := g.container.allocation(g.margined) a := g.container.allocation(g.margined)

View File

@ -34,7 +34,7 @@ func newTab() Tab {
} }
func (t *tab) Append(name string, control Control) { func (t *tab) Append(name string, control Control) {
c := newContainer(control) c := newContainer()
t.tabs = append(t.tabs, c) t.tabs = append(t.tabs, c)
// this calls gtk_container_add(), which, according to gregier in irc.gimp.net/#gtk+, acts just like gtk_notebook_append_page() // this calls gtk_container_add(), which, according to gregier in irc.gimp.net/#gtk+, acts just like gtk_notebook_append_page()
c.setParent(&controlParent{t.container}) c.setParent(&controlParent{t.container})
@ -51,11 +51,11 @@ func (t *tab) Append(name string, control Control) {
func (t *tab) resize(x int, y int, width int, height int, d *sizing) { func (t *tab) resize(x int, y int, width int, height int, d *sizing) {
// first, chain up to change the GtkFrame and its child container // first, chain up to change the GtkFrame and its child container
// TODO use a variable for this // TODO use a variable for this
t.containerSingleWidget.resize(x, y, width, height, d) t.controlSingleWidget.resize(x, y, width, height, d)
// now that the containers have the correct size, we can resize the children // now that the containers have the correct size, we can resize the children
for i, _ := range t.tabs { for i, _ := range t.tabs {
a := g.tabs[i].allocation(g.margined) a := t.tabs[i].allocation(false/*TODO*/)
g.children[i].resize(int(a.x), int(a.y), int(a.width), int(a.height), d) t.children[i].resize(int(a.x), int(a.y), int(a.width), int(a.height), d)
} }
} }

View File

@ -31,7 +31,7 @@ func startNewTextField() *textfield {
changed: newEvent(), changed: newEvent(),
} }
g_signal_connect( g_signal_connect(
C.gpointer(unsafe.Pointer(t._widget)), C.gpointer(unsafe.Pointer(t.widget)),
"changed", "changed",
C.GCallback(C.textfieldChanged), C.GCallback(C.textfieldChanged),
C.gpointer(unsafe.Pointer(t))) C.gpointer(unsafe.Pointer(t)))
@ -71,7 +71,7 @@ func (t *textfield) Invalid(reason string) {
creason := togstr(reason) creason := togstr(reason)
defer freegstr(creason) defer freegstr(creason)
C.gtk_entry_set_icon_tooltip_text(t.entry, C.GTK_ENTRY_ICON_SECONDARY, creason) C.gtk_entry_set_icon_tooltip_text(t.entry, C.GTK_ENTRY_ICON_SECONDARY, creason)
C.gtk_widget_error_bell(t._widget) C.gtk_widget_error_bell(t.widget)
} }
//export textfieldChanged //export textfieldChanged