Browse Source

Change types int32 -> int per upstream render library

menus
Noah Petherbridge 2 years ago
parent
commit
3e73a6effb
  1. 2
      button.go
  2. 22
      frame_pack.go
  3. 6
      label.go
  4. 4
      main_window.go
  5. 4
      supervisor.go
  6. 52
      widget.go

2
button.go

@ -101,7 +101,7 @@ func (w *Button) Present(e render.Engine, P render.Point) {
w.DrawBox(e, P)
// Offset further if we are currently sunken.
var clickOffset int32
var clickOffset int
if w.clicked {
clickOffset++
}

22
frame_pack.go

@ -16,9 +16,9 @@ type Pack struct {
FillX bool
FillY bool
Padding int32 // Equal padding on X and Y.
PadX int32
PadY int32
Padding int // Equal padding on X and Y.
PadX int
PadY int
Expand bool // Widget should grow its allocated space to better fill the parent.
}
@ -66,8 +66,8 @@ func (w *Frame) computePacked(e render.Engine) {
// was configured with an explicit Size, the Frame will be that Size,
// but we still calculate how much space the widgets _actually_ take
// so we can expand them to fill remaining space in fixed size widgets.
maxWidth int32
maxHeight int32
maxWidth int
maxHeight int
visited = []packedWidget{}
expanded = []packedWidget{}
)
@ -80,10 +80,10 @@ func (w *Frame) computePacked(e render.Engine) {
}
var (
x int32
y int32
yDirection int32 = 1
xDirection int32 = 1
x int
y int
yDirection int = 1
xDirection int = 1
)
if anchor.IsSouth() {
@ -150,8 +150,8 @@ func (w *Frame) computePacked(e render.Engine) {
if len(expanded) > 0 && !frameSize.IsZero() && frameSize.Bigger(computedSize) {
// Divy up the size available.
growBy := render.Rect{
W: ((frameSize.W - computedSize.W) / int32(len(expanded))) - w.BoxThickness(4),
H: ((frameSize.H - computedSize.H) / int32(len(expanded))) - w.BoxThickness(4),
W: ((frameSize.W - computedSize.W) / len(expanded)) - w.BoxThickness(4),
H: ((frameSize.H - computedSize.H) / len(expanded)) - w.BoxThickness(4),
}
for _, pw := range expanded {
pw.widget.ResizeBy(growBy)

6
label.go

@ -23,8 +23,8 @@ type Label struct {
IntVariable *int
Font render.Text
width int32
height int32
width int
height int
lineHeight int
}
@ -127,7 +127,7 @@ func (w *Label) Present(e render.Engine, P render.Point) {
text.Text = line
e.DrawText(text, render.Point{
X: P.X + border + padX,
Y: P.Y + border + padY + int32(i*w.lineHeight),
Y: P.Y + border + padY + (i * w.lineHeight),
})
}
}

4
main_window.go

@ -67,8 +67,8 @@ func (mw *MainWindow) Pack(w Widget, pack Pack) {
// resized handles the window being resized.
func (mw *MainWindow) resized() {
mw.frame.Resize(render.Rect{
W: int32(mw.w),
H: int32(mw.h),
W: mw.w,
H: mw.h,
})
}

4
supervisor.go

@ -82,8 +82,8 @@ var (
func (s *Supervisor) Loop(ev *event.State) error {
var (
XY = render.Point{
X: int32(ev.CursorX),
Y: int32(ev.CursorY),
X: ev.CursorX,
Y: ev.CursorY,
}
)

52
widget.go

@ -38,12 +38,12 @@ type Widget interface {
Event(Event, render.Point) // called internally to trigger an event
// Thickness of the padding + border + outline.
BoxThickness(multiplier int32) int32
BoxThickness(multiplier int) int
DrawBox(render.Engine, render.Point)
// Widget configuration getters.
Margin() int32 // Margin away from other widgets
SetMargin(int32) //
Margin() int // Margin away from other widgets
SetMargin(int) //
Background() render.Color // Background color
SetBackground(render.Color) //
Foreground() render.Color // Foreground color
@ -52,12 +52,12 @@ type Widget interface {
SetBorderStyle(BorderStyle) //
BorderColor() render.Color // Border color (default is Background)
SetBorderColor(render.Color) //
BorderSize() int32 // Border size (default 0)
SetBorderSize(int32) //
BorderSize() int // Border size (default 0)
SetBorderSize(int) //
OutlineColor() render.Color // Outline color (default Invisible)
SetOutlineColor(render.Color) //
OutlineSize() int32 // Outline size (default 0)
SetOutlineSize(int32) //
OutlineSize() int // Outline size (default 0)
SetOutlineSize(int) //
// Visibility
Hide()
@ -87,17 +87,17 @@ type Config struct {
// keeping the auto-resize property, pass AutoResize=true too. This is
// mainly used internally when widgets are calculating their automatic sizes.
AutoResize bool
Width int32
Height int32
Margin int32
MarginX int32
MarginY int32
Width int
Height int
Margin int
MarginX int
MarginY int
Background render.Color
Foreground render.Color
BorderSize int32
BorderSize int
BorderStyle BorderStyle
BorderColor render.Color
OutlineSize int32
OutlineSize int
OutlineColor render.Color
}
@ -108,17 +108,17 @@ type BaseWidget struct {
idFunc func() string
fixedSize bool
hidden bool
width int32
height int32
width int
height int
point render.Point
margin int32
margin int
background render.Color
foreground render.Color
borderStyle BorderStyle
borderColor render.Color
borderSize int32
borderSize int
outlineColor render.Color
outlineSize int32
outlineSize int
handlers map[Event][]func(render.Point)
hasParent bool
parent Widget
@ -266,7 +266,7 @@ func (w *BaseWidget) ResizeAuto(v render.Rect) {
// BoxThickness returns the full sum of the padding, border and outline.
// m = multiplier, i.e., 1 or 2
func (w *BaseWidget) BoxThickness(m int32) int32 {
func (w *BaseWidget) BoxThickness(m int) int {
if m == 0 {
m = 1
}
@ -396,12 +396,12 @@ func (w *BaseWidget) DrawBox(e render.Engine, P render.Point) {
}
// Margin returns the margin width.
func (w *BaseWidget) Margin() int32 {
func (w *BaseWidget) Margin() int {
return w.margin
}
// SetMargin sets the margin width.
func (w *BaseWidget) SetMargin(v int32) {
func (w *BaseWidget) SetMargin(v int) {
w.margin = v
}
@ -449,12 +449,12 @@ func (w *BaseWidget) SetBorderColor(c render.Color) {
}
// BorderSize returns the border thickness.
func (w *BaseWidget) BorderSize() int32 {
func (w *BaseWidget) BorderSize() int {
return w.borderSize
}
// SetBorderSize sets the border thickness.
func (w *BaseWidget) SetBorderSize(v int32) {
func (w *BaseWidget) SetBorderSize(v int) {
w.borderSize = v
}
@ -469,12 +469,12 @@ func (w *BaseWidget) SetOutlineColor(c render.Color) {
}
// OutlineSize returns the outline thickness.
func (w *BaseWidget) OutlineSize() int32 {
func (w *BaseWidget) OutlineSize() int {
return w.outlineSize
}
// SetOutlineSize sets the outline thickness.
func (w *BaseWidget) SetOutlineSize(v int32) {
func (w *BaseWidget) SetOutlineSize(v int) {
w.outlineSize = v
}

Loading…
Cancel
Save