Subversion Repositories Kolibri OS

Rev

Rev 9053 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 9053 Rev 9063
Line 7... Line 7...
7
    Btn1=2;
7
    Btn1=2;
8
    Btn2=3;
8
    Btn2=3;
9
    BtnExit=1;
9
    BtnExit=1;
10
)
10
)
Line -... Line 11...
-
 
11
 
-
 
12
type Button struct { // structure gui button
-
 
13
    label string
-
 
14
    x int
-
 
15
    y int
-
 
16
    id int
-
 
17
}
-
 
18
 
-
 
19
func NewButton() Button {
-
 
20
    object := Button{"Text",0,0,Btn1} // default data
-
 
21
    return object
-
 
22
}
-
 
23
 
-
 
24
func (button *Button) make() {
-
 
25
    os.CreateButton(button.x, button.y, len(button.label)*15, 30, button.id, colors.Blue);
-
 
26
    os.WriteText(button.x,button.y, 0x11000000 | colors.White, button.label)
-
 
27
}
11
 
28
 
12
func RedrawAll(bar_pos int){
29
func RedrawAll(bar_pos int){
13
    os.Redraw(1)
30
    os.Redraw(1)
14
    os.Window(500,250,420,200, "Test Golang")
31
    os.Window(500,250,420,200, "Example GoLang")
15
    os.DrawLine(32, 80, 150, 80, colors.Green)
-
 
16
    os.CreateButton(32, 128, 80, 30, Btn1, colors.Blue);
-
 
17
    os.CreateButton(300, 128, 80, 30, Btn2, colors.Blue);
-
 
18
    os.WriteText(32,128, 0x11000000 | colors.White," <- ")
-
 
19
    os.WriteText(320,128, 0x11000000 | colors.White," -> ")
32
    os.DrawLine(32, 80, 150, 80, colors.Green)
-
 
33
    os.DrawBar(bar_pos, 90, 100, 30, colors.Red);
-
 
34
 
-
 
35
    b1 := NewButton()
-
 
36
    b1.label = " <- "
-
 
37
    b1.x = 32
-
 
38
    b1.y = 128
-
 
39
    b1.id = Btn1
-
 
40
    b1.make()
-
 
41
 
-
 
42
    b2 := NewButton()
-
 
43
    b2.label = " -> "
-
 
44
    b2.x = 310
-
 
45
    b2.y = 128
-
 
46
    b2.id = Btn2
20
    os.DrawBar(bar_pos, 90, 100, 30, colors.Red);
47
    b2.make()
Line 21... Line 48...
21
}
48
}
-
 
49
 
22
 
50
func Main() {
23
func Load() {
51
    var pos = 160;
24
    //time := os.GetTime()
52
    //time := os.GetTime()
25
    //os.DebugOutStr("Time: ")
-
 
26
    //os.DebugOutHex(time)
53
    //os.DebugOutStr("Time: ")
27
    var pos=32;
54
    //os.DebugOutHex(time)
28
    for true {
55
    for true {
29
        switch os.Event() {
56
        switch os.Event() {
30
			case os.EVENT_REDRAW: 
57
			case os.EVENT_REDRAW: