Adds compatibility for latest libui, adds New{Password,Search}Entry
This commit is contained in:
parent
02104c77a4
commit
37dba6a1ef
4
area.go
4
area.go
|
@ -74,7 +74,7 @@ func NewScrollingArea(handler AreaHandler, width int, height int) *Area {
|
|||
a.scrolling = true
|
||||
a.ah = registerAreaHandler(handler)
|
||||
|
||||
a.a = C.uiNewScrollingArea(a.ah, C.intmax_t(width), C.intmax_t(height))
|
||||
a.a = C.uiNewScrollingArea(a.ah, C.int(width), C.int(height))
|
||||
a.c = (*C.uiControl)(unsafe.Pointer(a.a))
|
||||
|
||||
areas[a.a] = a
|
||||
|
@ -133,7 +133,7 @@ func (a *Area) SetSize(width int, height int) {
|
|||
if !a.scrolling {
|
||||
panic("attempt to call SetSize on non-scrolling Area")
|
||||
}
|
||||
C.uiAreaSetSize(a.a, C.intmax_t(width), C.intmax_t(height))
|
||||
C.uiAreaSetSize(a.a, C.int(width), C.int(height))
|
||||
}
|
||||
|
||||
// QueueRedrawAll queues the entire Area for redraw.
|
||||
|
|
3
box.go
3
box.go
|
@ -103,8 +103,7 @@ func (b *Box) Append(child Control, stretchy bool) {
|
|||
// Delete deletes the nth control of the Box.
|
||||
func (b *Box) Delete(n int) {
|
||||
b.children = append(b.children[:n], b.children[n + 1:]...)
|
||||
// TODO why is this uintmax_t instead of intmax_t
|
||||
C.uiBoxDelete(b.b, C.uintmax_t(n))
|
||||
C.uiBoxDelete(b.b, C.int(n))
|
||||
}
|
||||
|
||||
// Padded returns whether there is space between each control
|
||||
|
|
|
@ -114,7 +114,7 @@ func (c *Combobox) Selected() int {
|
|||
// SetChecked sets the currently select item in the Combobox
|
||||
// to index. If index is -1 no item will be selected.
|
||||
func (c *Combobox) SetSelected(index int) {
|
||||
C.uiComboboxSetSelected(c.c, C.intmax_t(index))
|
||||
C.uiComboboxSetSelected(c.c, C.int(index))
|
||||
}
|
||||
|
||||
// OnSelected registers f to be run when the user selects an item in
|
||||
|
|
2
draw.go
2
draw.go
|
@ -593,7 +593,7 @@ func (f *FontFamilies) NumFamilies() int {
|
|||
|
||||
// Family returns the name of the nth family in the list.
|
||||
func (f *FontFamilies) Family(n int) string {
|
||||
cname := C.uiDrawFontFamiliesFamily(f.ff, C.uintmax_t(n))
|
||||
cname := C.uiDrawFontFamiliesFamily(f.ff, C.int(n))
|
||||
name := C.GoString(cname)
|
||||
C.uiFreeText(cname)
|
||||
return name
|
||||
|
|
26
entry.go
26
entry.go
|
@ -43,6 +43,32 @@ func NewEntry() *Entry {
|
|||
return e
|
||||
}
|
||||
|
||||
// NewPasswordEntry creates a new Entry suitable for entering passwords.
|
||||
func NewPasswordEntry() *Entry {
|
||||
e := new(Entry)
|
||||
|
||||
e.e = C.uiNewPasswordEntry()
|
||||
e.c = (*C.uiControl)(unsafe.Pointer(e.e))
|
||||
|
||||
C.realuiEntryOnChanged(e.e)
|
||||
entries[e.e] = e
|
||||
|
||||
return e
|
||||
}
|
||||
|
||||
// NewSearchEntry creates a new Entry suitable for searching.
|
||||
func NewSearchEntry() *Entry {
|
||||
e := new(Entry)
|
||||
|
||||
e.e = C.uiNewSearchEntry()
|
||||
e.c = (*C.uiControl)(unsafe.Pointer(e.e))
|
||||
|
||||
C.realuiEntryOnChanged(e.e)
|
||||
entries[e.e] = e
|
||||
|
||||
return e
|
||||
}
|
||||
|
||||
// Destroy destroys the Entry.
|
||||
func (e *Entry) Destroy() {
|
||||
delete(entries, e.e)
|
||||
|
|
|
@ -31,7 +31,7 @@ type Slider struct {
|
|||
func NewSlider(min int, max int) *Slider {
|
||||
s := new(Slider)
|
||||
|
||||
s.s = C.uiNewSlider(C.intmax_t(min), C.intmax_t(max))
|
||||
s.s = C.uiNewSlider(C.int(min), C.int(max))
|
||||
s.c = (*C.uiControl)(unsafe.Pointer(s.s))
|
||||
|
||||
C.realuiSliderOnChanged(s.s)
|
||||
|
@ -90,7 +90,7 @@ func (s *Slider) Value() int {
|
|||
|
||||
// SetText sets the Slider's current value to value.
|
||||
func (s *Slider) SetValue(value int) {
|
||||
C.uiSliderSetValue(s.s, C.intmax_t(value))
|
||||
C.uiSliderSetValue(s.s, C.int(value))
|
||||
}
|
||||
|
||||
// OnChanged registers f to be run when the user changes the value
|
||||
|
|
|
@ -31,7 +31,7 @@ type Spinbox struct {
|
|||
func NewSpinbox(min int, max int) *Spinbox {
|
||||
s := new(Spinbox)
|
||||
|
||||
s.s = C.uiNewSpinbox(C.intmax_t(min), C.intmax_t(max))
|
||||
s.s = C.uiNewSpinbox(C.int(min), C.int(max))
|
||||
s.c = (*C.uiControl)(unsafe.Pointer(s.s))
|
||||
|
||||
C.realuiSpinboxOnChanged(s.s)
|
||||
|
@ -93,7 +93,7 @@ func (s *Spinbox) Value() int {
|
|||
|
||||
// SetText sets the Spinbox's current value to value.
|
||||
func (s *Spinbox) SetValue(value int) {
|
||||
C.uiSpinboxSetValue(s.s, C.intmax_t(value))
|
||||
C.uiSpinboxSetValue(s.s, C.int(value))
|
||||
}
|
||||
|
||||
// OnChanged registers f to be run when the user changes the value
|
||||
|
|
10
tab.go
10
tab.go
|
@ -91,8 +91,8 @@ func (t *Tab) InsertAt(name string, n int, child Control) {
|
|||
c = touiControl(child.LibuiControl())
|
||||
}
|
||||
cname := C.CString(name)
|
||||
// TODO why is this uintmax_t and not intmax_t
|
||||
C.uiTabInsertAt(t.t, cname, C.uintmax_t(n), c)
|
||||
|
||||
C.uiTabInsertAt(t.t, cname, C.int(n), c)
|
||||
freestr(cname)
|
||||
ch := make([]Control, len(t.children) + 1)
|
||||
// and insert into t.children at the right place
|
||||
|
@ -105,7 +105,7 @@ func (t *Tab) InsertAt(name string, n int, child Control) {
|
|||
// Delete deletes the nth page of the Tab.
|
||||
func (t *Tab) Delete(n int) {
|
||||
t.children = append(t.children[:n], t.children[n + 1:]...)
|
||||
C.uiTabDelete(t.t, C.uintmax_t(n))
|
||||
C.uiTabDelete(t.t, C.int(n))
|
||||
}
|
||||
|
||||
// NumPages returns the number of pages in the Tab.
|
||||
|
@ -116,12 +116,12 @@ func (t *Tab) NumPages() int {
|
|||
// Margined returns whether page n (starting at 0) of the Tab
|
||||
// has margins around its child.
|
||||
func (t *Tab) Margined(n int) bool {
|
||||
return tobool(C.uiTabMargined(t.t, C.uintmax_t(n)))
|
||||
return tobool(C.uiTabMargined(t.t, C.int(n)))
|
||||
}
|
||||
|
||||
// SetMargined controls whether page n (starting at 0) of the Tab
|
||||
// has margins around its child. The size of the margins are
|
||||
// determined by the OS and its best practices.
|
||||
func (t *Tab) SetMargined(n int, margined bool) {
|
||||
C.uiTabSetMargined(t.t, C.uintmax_t(n), frombool(margined))
|
||||
C.uiTabSetMargined(t.t, C.int(n), frombool(margined))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue