Пример #1
0
// NewSpinbox creates a new Spinbox. TODO limits
func NewSpinbox(min int, max int) *Spinbox {
	s := new(Spinbox)

	s.s = C.uiNewSpinbox(C.intmax_t(min), C.intmax_t(max))
	s.c = (*C.uiControl)(unsafe.Pointer(s.s))

	C.realuiSpinboxOnChanged(s.s)
	spinboxes[s.s] = s

	return s
}
Пример #2
0
// NewSlider creates a new Slider. If min >= max, they are swapped.
func NewSlider(min int, max int) *Slider {
	s := new(Slider)

	s.s = C.uiNewSlider(C.intmax_t(min), C.intmax_t(max))
	s.c = (*C.uiControl)(unsafe.Pointer(s.s))

	C.realuiSliderOnChanged(s.s)
	sliders[s.s] = s

	return s
}
Пример #3
0
// NewScrollingArea creates a new scrolling Area of the given size,
// in points.
func NewScrollingArea(handler AreaHandler, width int, height int) *Area {
	a := new(Area)
	a.scrolling = true
	a.ah = registerAreaHandler(handler)

	a.a = C.uiNewScrollingArea(a.ah, C.intmax_t(width), C.intmax_t(height))
	a.c = (*C.uiControl)(unsafe.Pointer(a.a))

	areas[a.a] = a

	return a
}
Пример #4
0
// SetSize sets the size of a scrolling Area to the given size, in points.
// SetSize panics if called on a non-scrolling Area.
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))
}
Пример #5
0
// 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.cb, C.intmax_t(index))
}
Пример #6
0
// SetText sets the Spinbox's current value to value.
func (s *Spinbox) SetValue(value int) {
	C.uiSpinboxSetValue(s.s, C.intmax_t(value))
}
Пример #7
0
// SetText sets the Slider's current value to value.
func (s *Slider) SetValue(value int) {
	C.uiSliderSetValue(s.s, C.intmax_t(value))
}
Пример #8
0
func (p *progressbar) SetPercent(percent int) {
	if percent < 0 || percent > 100 {
		panic(fmt.Errorf("given ProgressBar percentage %d out of range", percent))
	}
	C.progressbarSetPercent(p.id, C.intmax_t(percent))
}
Пример #9
0
func (s *spinbox) SetValue(value int) {
	C.spinboxSetValue(s.id, C.intmax_t(value))
}
Пример #10
0
func newSpinbox(min int, max int) Spinbox {
	s := new(spinbox)
	s.id = C.newSpinbox(unsafe.Pointer(s), C.intmax_t(min), C.intmax_t(max))
	s.changed = newEvent()
	return s
}