Skip to content

Commit

Permalink
Update v0.0.16
Browse files Browse the repository at this point in the history
  • Loading branch information
george012 committed Jun 14, 2024
1 parent ca771b6 commit 90a1f5d
Show file tree
Hide file tree
Showing 53 changed files with 89 additions and 137 deletions.
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,37 +105,37 @@ const HEIGHT = 400

func main() {
curr := 0
fltk.InitStyles()
win := fltk.NewWindow(WIDTH, HEIGHT)
fltk_go.InitStyles()
win := fltk_go.NewWindow(WIDTH, HEIGHT)
win.SetLabel("Flutter-like")
win.SetColor(fltk.WHITE)
bar := fltk.NewBox(fltk.FLAT_BOX, 0, 0, WIDTH, 60, " FLTK App!")
win.SetColor(fltk_go.WHITE)
bar := fltk_go.NewBox(fltk_go.FLAT_BOX, 0, 0, WIDTH, 60, " FLTK App!")
bar.SetDrawHandler(func() { // Shadow under the bar
fltk.DrawBox(fltk.FLAT_BOX, 0, 0, WIDTH, 63, LIGHT_GRAY)
fltk_go.DrawBox(fltk_go.FLAT_BOX, 0, 0, WIDTH, 63, LIGHT_GRAY)
})
bar.SetAlign(fltk.ALIGN_INSIDE | fltk.ALIGN_LEFT)
bar.SetAlign(fltk_go.ALIGN_INSIDE | fltk_go.ALIGN_LEFT)
bar.SetLabelColor(255) // this uses the index into the color map, here it's white
bar.SetColor(BLUE)
bar.SetLabelSize(22)
text := fltk.NewBox(fltk.NO_BOX, 250, 180, 100, 40, "You have pushed the button this many times:")
text := fltk_go.NewBox(fltk_go.NO_BOX, 250, 180, 100, 40, "You have pushed the button this many times:")
text.SetLabelSize(18)
text.SetLabelFont(fltk.TIMES)
count := fltk.NewBox(fltk.NO_BOX, 250, 180+40, 100, 40, "0")
text.SetLabelFont(fltk_go.TIMES)
count := fltk_go.NewBox(fltk_go.NO_BOX, 250, 180+40, 100, 40, "0")
count.SetLabelSize(36)
count.SetLabelColor(GRAY)
btn := fltk.NewButton(WIDTH-100, HEIGHT-100, 60, 60, "@+6plus") // This translates to a plus sign
btn := fltk_go.NewButton(WIDTH-100, HEIGHT-100, 60, 60, "@+6plus") // This translates to a plus sign
btn.SetColor(BLUE)
btn.SetSelectionColor(SEL_BLUE)
btn.SetLabelColor(255)
btn.SetBox(fltk.OFLAT_BOX)
btn.SetBox(fltk_go.OFLAT_BOX)
btn.ClearVisibleFocus()
btn.SetCallback(func() {
curr += 1
count.SetLabel(strconv.Itoa(curr))
})
win.End()
win.Show()
fltk.Run()
fltk_go.Run()
}
```

Expand All @@ -162,17 +162,17 @@ import (
"github.com/george012/fltk_go"

func main() {
win := fltk.NewWindow(400, 300)
box := fltk.NewBox(fltk.FLAT_BOX, 0, 0, 400, 300, "")
image, err := fltk.NewJpegImageLoad("image.jpg")
win := fltk_go.NewWindow(400, 300)
box := fltk_go.NewBox(fltk_go.FLAT_BOX, 0, 0, 400, 300, "")
image, err := fltk_go.NewJpegImageLoad("image.jpg")
if err != nil {
fmt.Printf("An error occurred: %s\n", err)
} else {
box.SetImage(image)
}
win.End()
win.Show()
fltk.Run()
fltk_go.Run()
}
```

Expand Down
32 changes: 16 additions & 16 deletions README_zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,37 +105,37 @@ const HEIGHT = 400

func main() {
curr := 0
fltk.InitStyles()
win := fltk.NewWindow(WIDTH, HEIGHT)
fltk_go.InitStyles()
win := fltk_go.NewWindow(WIDTH, HEIGHT)
win.SetLabel("Flutter-like")
win.SetColor(fltk.WHITE)
bar := fltk.NewBox(fltk.FLAT_BOX, 0, 0, WIDTH, 60, " FLTK App!")
win.SetColor(fltk_go.WHITE)
bar := fltk_go.NewBox(fltk_go.FLAT_BOX, 0, 0, WIDTH, 60, " FLTK App!")
bar.SetDrawHandler(func() { // Shadow under the bar
fltk.DrawBox(fltk.FLAT_BOX, 0, 0, WIDTH, 63, LIGHT_GRAY)
fltk_go.DrawBox(fltk_go.FLAT_BOX, 0, 0, WIDTH, 63, LIGHT_GRAY)
})
bar.SetAlign(fltk.ALIGN_INSIDE | fltk.ALIGN_LEFT)
bar.SetAlign(fltk_go.ALIGN_INSIDE | fltk_go.ALIGN_LEFT)
bar.SetLabelColor(255) // this uses the index into the color map, here it's white
bar.SetColor(BLUE)
bar.SetLabelSize(22)
text := fltk.NewBox(fltk.NO_BOX, 250, 180, 100, 40, "You have pushed the button this many times:")
text := fltk_go.NewBox(fltk_go.NO_BOX, 250, 180, 100, 40, "You have pushed the button this many times:")
text.SetLabelSize(18)
text.SetLabelFont(fltk.TIMES)
count := fltk.NewBox(fltk.NO_BOX, 250, 180+40, 100, 40, "0")
text.SetLabelFont(fltk_go.TIMES)
count := fltk_go.NewBox(fltk_go.NO_BOX, 250, 180+40, 100, 40, "0")
count.SetLabelSize(36)
count.SetLabelColor(GRAY)
btn := fltk.NewButton(WIDTH-100, HEIGHT-100, 60, 60, "@+6plus") // 这翻译成一个加号
btn := fltk_go.NewButton(WIDTH-100, HEIGHT-100, 60, 60, "@+6plus") // 这翻译成一个加号
btn.SetColor(BLUE)
btn.SetSelectionColor(SEL_BLUE)
btn.SetLabelColor(255)
btn.SetBox(fltk.OFLAT_BOX)
btn.SetBox(fltk_go.OFLAT_BOX)
btn.ClearVisibleFocus()
btn.SetCallback(func() {
curr += 1
count.SetLabel(strconv.Itoa(curr))
})
win.End()
win.Show()
fltk.Run()
fltk_go.Run()
}
```

Expand Down Expand Up @@ -163,17 +163,17 @@ import (
)

func main() {
win := fltk.NewWindow(400, 300)
box := fltk.NewBox(fltk.FLAT_BOX, 0, 0, 400, 300, "")
image, err := fltk.NewJpegImageLoad("image.jpg")
win := fltk_go.NewWindow(400, 300)
box := fltk_go.NewBox(fltk_go.FLAT_BOX, 0, 0, 400, 300, "")
image, err := fltk_go.NewJpegImageLoad("image.jpg")
if err != nil {
fmt.Printf("An error occured: %s\n", err)
} else {
box.SetImage(image)
}
win.End()
win.Show()
fltk.Run()
fltk_go.Run()
}
```

Expand Down
3 changes: 1 addition & 2 deletions cgo_darwin_arm64.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
//go:build darwin && arm64
// +build darwin,arm64

package fltk_go

// #cgo darwin,arm64 CXXFLAGS: -std=c++11
// #cgo darwin,arm64 CPPFLAGS: -I${SRCDIR}/lib/darwin/arm64 -I${SRCDIR}/include -I${SRCDIR}/include/FL/images -I${SRCDIR}/include/png -I${SRCDIR}/include/zlib -I${SRCDIR}/include/jpeg -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_THREAD_SAFE -D_REENTRANT
// #cgo darwin,arm64 CPPFLAGS: -I${SRCDIR}/lib/darwin/arm64 -I${SRCDIR}/include -I${SRCDIR}/include/FL/images -I${SRCDIR}/include/png -I${SRCDIR}/include/zlib -I${SRCDIR}/include/jpeg -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_THREAD_SAFE -D_REENTRANT
// #cgo darwin,arm64 LDFLAGS: ${SRCDIR}/lib/darwin/arm64/libfltk_images.a ${SRCDIR}/lib/darwin/arm64/libfltk_jpeg.a ${SRCDIR}/lib/darwin/arm64/libfltk_png.a ${SRCDIR}/lib/darwin/arm64/libfltk_z.a ${SRCDIR}/lib/darwin/arm64/libfltk_gl.a -framework OpenGL ${SRCDIR}/lib/darwin/arm64/libfltk_forms.a ${SRCDIR}/lib/darwin/arm64/libfltk.a -lm -lpthread -framework Cocoa
import "C"
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ package config

const (
ProjectName = "fltk_go"
ProjectVersion = "v0.0.15"
ProjectVersion = "v0.0.16"
)
4 changes: 1 addition & 3 deletions examples/7GUIs/cells/main.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package main

import (
"github.com/george012/fltk_go"
)
import "github.com/george012/fltk_go"

const (
WIDGET_HEIGHT = 200
Expand Down
5 changes: 2 additions & 3 deletions examples/7GUIs/cells/panel.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package main

import (
"log"

"github.com/george012/fltk_go"
"log"
)

type Panel struct {
Expand Down Expand Up @@ -76,7 +75,7 @@ func (p *Panel) Bind(ctx *Context) {
}
})

// p.tb.SetCallbackCondition(fltk_go.WhenNotChanged)
// p.tb.SetCallbackCondition(fltk.WhenNotChanged)
p.tb.SetCallback(func() {
tc := p.tb.CallbackContext()
if tc != fltk_go.ContextCell {
Expand Down
4 changes: 1 addition & 3 deletions examples/7GUIs/circle/main.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package main

import (
"github.com/george012/fltk_go"
)
import "github.com/george012/fltk_go"

const (
WIDGET_HEIGHT = 25
Expand Down
3 changes: 1 addition & 2 deletions examples/7GUIs/circle/panel.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ package main

import (
"fmt"
"runtime"

"github.com/george012/fltk_go"
"runtime"
)

type Panel struct {
Expand Down
3 changes: 1 addition & 2 deletions examples/7GUIs/counter/main.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package main

import (
"strconv"

"github.com/george012/fltk_go"
"strconv"
)

const (
Expand Down
3 changes: 1 addition & 2 deletions examples/7GUIs/crud/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ package main

import (
"fmt"
"github.com/george012/fltk_go"
"log"
"strings"

"github.com/george012/fltk_go"
)

const (
Expand Down
3 changes: 1 addition & 2 deletions examples/7GUIs/flightbooker/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ package main

import (
"fmt"
"time"

"github.com/george012/fltk_go"
"time"
)

const (
Expand Down
3 changes: 1 addition & 2 deletions examples/7GUIs/temperature/main.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package main

import (
"github.com/george012/fltk_go"
"log"
"strconv"

"github.com/george012/fltk_go"
)

const (
Expand Down
3 changes: 1 addition & 2 deletions examples/7GUIs/timer/main.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package main

import (
"time"

"github.com/george012/fltk_go"
"time"
)

const (
Expand Down
3 changes: 1 addition & 2 deletions examples/chart/main.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package main

import (
"github.com/george012/fltk_go"
"math/rand"
"strconv"

"github.com/george012/fltk_go"
)

func main() {
Expand Down
1 change: 0 additions & 1 deletion examples/choice/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package main

import (
"fmt"

"github.com/george012/fltk_go"
)

Expand Down
3 changes: 1 addition & 2 deletions examples/custom-dial/main.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package main

import (
"strconv"

"github.com/george012/fltk_go"
"strconv"
)

type MyDial struct {
Expand Down
1 change: 0 additions & 1 deletion examples/dnd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package main

import (
"fmt"

"github.com/george012/fltk_go"
)

Expand Down
3 changes: 1 addition & 2 deletions examples/flex/main.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package main

import (
"strconv"

"github.com/george012/fltk_go"
"strconv"
)

var i = 0
Expand Down
3 changes: 1 addition & 2 deletions examples/flutter-like/main.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package main

import (
"strconv"

"github.com/george012/fltk_go"
"strconv"
)

// FLTK uses an RGBI color representation, the I is an index into FLTK's color map
Expand Down
4 changes: 3 additions & 1 deletion examples/grid/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package main

import "github.com/george012/fltk_go"
import (
"github.com/george012/fltk_go"
)

func main() {
win := fltk_go.NewWindow(320, 180)
Expand Down
3 changes: 1 addition & 2 deletions examples/group/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ package main

import (
"fmt"
"runtime"

"github.com/george012/fltk_go"
"runtime"
)

func main() {
Expand Down
1 change: 0 additions & 1 deletion examples/helpview/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package main

import (
"fmt"

"github.com/george012/fltk_go"
)

Expand Down
3 changes: 1 addition & 2 deletions examples/icons/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ package main
import (
"bytes"
_ "embed"
"github.com/george012/fltk_go"
"image"
_ "image/png"
"runtime"

"github.com/george012/fltk_go"
)

//go:embed 8x8.png
Expand Down
1 change: 0 additions & 1 deletion examples/image/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package main

import (
"fmt"

"github.com/george012/fltk_go"
)

Expand Down
9 changes: 5 additions & 4 deletions examples/mdviewer/go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
module github.com/george012/fltk_go/examples/mdviewer

go 1.17
go 1.18

replace github.com/george012/fltk_go => ../../

require github.com/george012/fltk_go v0.0.0

require github.com/yuin/goldmark v1.4.14
require (
github.com/george012/fltk_go v0.0.1
github.com/yuin/goldmark v1.4.14
)
Loading

0 comments on commit 90a1f5d

Please sign in to comment.