gofmt files

This commit is contained in:
polypmer 2016-09-07 07:52:52 -04:00
parent 2dde2a79e7
commit 1ec8f6b01c
22 changed files with 226 additions and 215 deletions

View File

@ -198,7 +198,7 @@ type AreaMouseEvent struct {
func appendBits(out []uint, held C.uint64_t) []uint { func appendBits(out []uint, held C.uint64_t) []uint {
n := uint(1) n := uint(1)
for i := 0; i < 64; i++ { for i := 0; i < 64; i++ {
if held & 1 != 0 { if held&1 != 0 {
out = append(out, n) out = append(out, n)
} }
held >>= 1 held >>= 1
@ -267,6 +267,7 @@ func doAreaHandlerKeyEvent(uah *C.uiAreaHandler, ua *C.uiArea, uke *C.uiAreaKeyE
// //
// Note: these must be numerically identical to their libui equivalents. // Note: these must be numerically identical to their libui equivalents.
type Modifiers uint type Modifiers uint
const ( const (
Ctrl Modifiers = 1 << iota Ctrl Modifiers = 1 << iota
Alt Alt
@ -278,6 +279,7 @@ const (
// //
// Note: these must be numerically identical to their libui equivalents. // Note: these must be numerically identical to their libui equivalents.
type ExtKey int type ExtKey int
const ( const (
Escape ExtKey = iota + 1 Escape ExtKey = iota + 1
Insert // equivalent to "Help" on Apple keyboards Insert // equivalent to "Help" on Apple keyboards

2
box.go
View File

@ -102,7 +102,7 @@ func (b *Box) Append(child Control, stretchy bool) {
// Delete deletes the nth control of the Box. // Delete deletes the nth control of the Box.
func (b *Box) Delete(n int) { func (b *Box) Delete(n int) {
b.children = append(b.children[:n], b.children[n + 1:]...) b.children = append(b.children[:n], b.children[n+1:]...)
// TODO why is this uintmax_t instead of intmax_t // TODO why is this uintmax_t instead of intmax_t
C.uiBoxDelete(b.b, C.uintmax_t(n)) C.uiBoxDelete(b.b, C.uintmax_t(n))
} }

View File

@ -41,6 +41,7 @@ func NewCombobox() *Combobox {
return c return c
} }
/*TODO /*TODO
// NewEditableCombobox creates a new editable Combobox. // NewEditableCombobox creates a new editable Combobox.
func NewEditableCombobox() *Combobox { func NewEditableCombobox() *Combobox {

View File

@ -166,6 +166,7 @@ type Path struct {
// //
// TODO disclaimer // TODO disclaimer
type FillMode uint type FillMode uint
const ( const (
Winding FillMode = iota Winding FillMode = iota
Alternate Alternate
@ -277,6 +278,7 @@ type DrawContext struct {
// //
// TODO disclaimer // TODO disclaimer
type BrushType int type BrushType int
const ( const (
Solid BrushType = iota Solid BrushType = iota
LinearGradient LinearGradient
@ -289,6 +291,7 @@ const (
// TODO disclaimer // TODO disclaimer
// TODO rename these to put LineCap at the beginning? or just Cap? // TODO rename these to put LineCap at the beginning? or just Cap?
type LineCap int type LineCap int
const ( const (
FlatCap LineCap = iota FlatCap LineCap = iota
RoundCap RoundCap
@ -299,6 +302,7 @@ const (
// //
// TODO disclaimer // TODO disclaimer
type LineJoin int type LineJoin int
const ( const (
MiterJoin LineJoin = iota MiterJoin LineJoin = iota
RoundJoin RoundJoin
@ -609,6 +613,7 @@ func (f *FontFamilies) Family(n int) string {
// //
// TODO disclaimer // TODO disclaimer
type TextWeight int type TextWeight int
const ( const (
TextWeightThin TextWeight = iota TextWeightThin TextWeight = iota
TextWeightUltraLight TextWeightUltraLight
@ -627,6 +632,7 @@ const (
// //
// TODO disclaimer // TODO disclaimer
type TextItalic int type TextItalic int
const ( const (
TextItalicNormal TextItalic = iota TextItalicNormal TextItalic = iota
TextItalicOblique // merely slanted text TextItalicOblique // merely slanted text
@ -644,6 +650,7 @@ const (
// //
// TODO disclaimer // TODO disclaimer
type TextStretch int type TextStretch int
const ( const (
TextStretchUltraCondensed TextStretch = iota TextStretchUltraCondensed TextStretch = iota
TextStretchExtraCondensed TextStretchExtraCondensed

View File

@ -3,8 +3,8 @@
package ui package ui
import ( import (
"runtime"
"errors" "errors"
"runtime"
"sync" "sync"
"unsafe" "unsafe"
) )

6
tab.go
View File

@ -94,17 +94,17 @@ func (t *Tab) InsertAt(name string, n int, child Control) {
// TODO why is this uintmax_t and not intmax_t // 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.uintmax_t(n), c)
freestr(cname) freestr(cname)
ch := make([]Control, len(t.children) + 1) ch := make([]Control, len(t.children)+1)
// and insert into t.children at the right place // and insert into t.children at the right place
copy(ch[:n], t.children[:n]) copy(ch[:n], t.children[:n])
ch[n] = child ch[n] = child
copy(ch[n + 1:], t.children[n:]) copy(ch[n+1:], t.children[n:])
t.children = ch t.children = ch
} }
// Delete deletes the nth page of the Tab. // Delete deletes the nth page of the Tab.
func (t *Tab) Delete(n int) { func (t *Tab) Delete(n int) {
t.children = append(t.children[:n], t.children[n + 1:]...) t.children = append(t.children[:n], t.children[n+1:]...)
C.uiTabDelete(t.t, C.uintmax_t(n)) C.uiTabDelete(t.t, C.uintmax_t(n))
} }

View File

@ -22,6 +22,7 @@ func moveLabel(*Button) {
} }
var moveBack bool var moveBack bool
const ( const (
moveOutText = "Move Page 1 Out" moveOutText = "Move Page 1 Out"
moveBackText = "Move Page 1 Back" moveBackText = "Move Page 1 Back"
@ -92,7 +93,7 @@ func makePage2() *Box {
button = NewButton("Open Menuless Window") button = NewButton("Open Menuless Window")
button.OnClicked(func(*Button) { button.OnClicked(func(*Button) {
w := NewWindow("Another Window", 100, 100, true) w := NewWindow("Another Window", 100, 100, true)
//TODO w.SetChild(makePage6()) //TODO w.SetChild(makePage6())
w.SetMargined(true) w.SetMargined(true)
w.Show() w.Show()
}) })
@ -154,8 +155,8 @@ func makePage2() *Box {
page2.Append(hbox, false) page2.Append(hbox, false)
disabledTab := newTab() disabledTab := newTab()
disabledTab.Append("Disabled", NewButton("Button")); disabledTab.Append("Disabled", NewButton("Button"))
disabledTab.Append("Tab", NewLabel("Label")); disabledTab.Append("Tab", NewLabel("Label"))
disabledTab.Disable() disabledTab.Disable()
page2.Append(disabledTab, true) page2.Append(disabledTab, true)