Ejemplo n.º 1
0
// NewCanvas creates a new canvas at a given position.
func NewCanvas(parent sparta.Widget, name string, rect image.Rectangle) *Canvas {
	c := &Canvas{
		name:     name,
		parent:   parent,
		geometry: rect,
		back:     backColor,
		fore:     foreColor,
	}
	sparta.NewWindow(c)
	return c
}
Ejemplo n.º 2
0
// NewMainWindow creates a new main window.
func NewMainWindow(name, title string) *MainWindow {
	w := &MainWindow{
		name:     name,
		geometry: image.Rect(0, 0, 80*sparta.WidthUnit, 20*sparta.HeightUnit),
		back:     backColor,
		fore:     foreColor,
		title:    title,
	}
	sparta.NewWindow(w)
	w.win.SetProperty(sparta.Caption, w.title)
	return w
}
Ejemplo n.º 3
0
// NewList creates a new list.
func NewList(parent sparta.Widget, name string, rect image.Rectangle) *List {
	l := &List{
		name:     name,
		parent:   parent,
		geometry: rect,
		back:     backColor,
		fore:     foreColor,
		target:   parent,
	}
	sparta.NewWindow(l)
	l.scroll = NewScroll(l, "list"+name+"Scroll", 0, 0, Vertical, image.Rect(rect.Dx()-10, 0, rect.Dx(), rect.Dy()))
	return l
}
Ejemplo n.º 4
0
// Button creates a new button.
func NewButton(parent sparta.Widget, name, caption string, rect image.Rectangle) *Button {
	b := &Button{
		name:     name,
		parent:   parent,
		geometry: rect,
		back:     backColor,
		fore:     foreColor,
		caption:  caption,
		target:   parent,
	}
	sparta.NewWindow(b)
	return b
}
Ejemplo n.º 5
0
// NewScroll creates a new scroll of the given type.
func NewScroll(parent sparta.Widget, name string, size, page int, typ ScrollType, rect image.Rectangle) *Scroll {
	s := &Scroll{
		name:     name,
		parent:   parent,
		geometry: rect,
		back:     backColor,
		fore:     foreColor,
		size:     size,
		page:     page,
		target:   parent,
		typ:      typ,
	}
	sparta.NewWindow(s)
	return s
}