forked from pwiecz/go-fltk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
scroll.go
43 lines (35 loc) · 1.11 KB
/
scroll.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package fltk
/*
#include "scroll.h"
*/
import "C"
import "unsafe"
type Scroll struct {
Group
}
func NewScroll(x, y, w, h int, text ...string) *Scroll {
s := &Scroll{}
initWidget(s, unsafe.Pointer(C.go_fltk_new_Scroll(C.int(x), C.int(y), C.int(w), C.int(h), cStringOpt(text))))
return s
}
func (s *Scroll) ScrollTo(x, y int) {
C.go_fltk_Scroll_scroll_to((*C.Fl_Scroll)(s.ptr()), C.int(x), C.int(y))
}
func (s *Scroll) XPosition() int {
return int(C.go_fltk_Scroll_x_position((*C.Fl_Scroll)(s.ptr())))
}
func (s *Scroll) YPosition() int {
return int(C.go_fltk_Scroll_y_position((*C.Fl_Scroll)(s.ptr())))
}
type ScrollType uint8
var (
SCROLL_HORIZONTAL = ScrollType(C.go_FL_SCROLL_HORIZONTAL)
SCROLL_VERTICAL = ScrollType(C.go_FL_SCROLL_VERTICAL)
SCROLL_BOTH = ScrollType(C.go_FL_SCROLL_BOTH)
SCROLL_HORIZONTAL_ALWAYS = ScrollType(C.go_FL_SCROLL_HORIZONTAL_ALWAYS)
SCROLL_VERTICAL_ALWAYS = ScrollType(C.go_FL_SCROLL_VERTICAL_ALWAYS)
SCROLL_BOTH_ALWAYS = ScrollType(C.go_FL_SCROLL_BOTH_ALWAYS)
)
func (s *Scroll) SetType(scrollType ScrollType) {
s.widget.SetType(uint8(scrollType))
}