diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2024-05-10 13:17:02 -0400 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2024-05-10 13:17:02 -0400 |
| commit | 15c9618700dc681e6b94e83a1aaeea6cbcd0c2c2 (patch) | |
| tree | bd92f064527f8897c41e294df10efaaaef5f50fd /gui/widget/widget.go | |
| parent | 97a7a7cd2afa18b73f5982ecb3ec08c0392b6d1e (diff) | |
| download | volute-15c9618700dc681e6b94e83a1aaeea6cbcd0c2c2.zip | |
separate label widget and style constants
Diffstat (limited to 'gui/widget/widget.go')
| -rw-r--r-- | gui/widget/widget.go | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/gui/widget/widget.go b/gui/widget/widget.go deleted file mode 100644 index 84e7175..0000000 --- a/gui/widget/widget.go +++ /dev/null @@ -1,43 +0,0 @@ -package widget - -import ( - "sync" - - xdraw "golang.org/x/image/draw" - "image" - "image/color" - "image/draw" - - "volute/gui" - "volute/gui/text" - "volute/gui/win" -) - -var ( - FOCUS_COLOR = color.RGBA{179, 217, 255, 255} - GREEN = color.RGBA{51, 102, 0, 255} - BLACK = color.Gray{0} - WHITE = color.Gray{255} - - interpolator = xdraw.ApproxBiLinear -) - -func Label(str string, r image.Rectangle, env gui.Env, wg *sync.WaitGroup) { - defer wg.Done() - defer close(env.Draw()) - - redraw := func(drw draw.Image) image.Rectangle { - text.Draw([]byte(str), drw, r, BLACK, WHITE) - return r - } - - env.Draw() <- redraw - for event := range env.Events() { - switch event := event.(type) { - case win.WiFocus: - if event.Focused { - env.Draw() <- redraw - } - } - } -} |