test code
This commit is contained in:
parent
fb372aad6f
commit
0b5c7de337
|
@ -0,0 +1,61 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"sync"
|
||||||
|
|
||||||
|
"go.wit.com/lib/gadgets"
|
||||||
|
"go.wit.com/log"
|
||||||
|
|
||||||
|
"go.wit.com/gui"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Shout out to "Go Generics 101" by Tapir Liu. Buy this book!
|
||||||
|
|
||||||
|
type Lockable[T any] struct {
|
||||||
|
mu sync.Mutex
|
||||||
|
data T
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *Lockable[T]) Do(f func(*T)) {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *Lockable[T]) Hide() {
|
||||||
|
log.Info("testing:", l)
|
||||||
|
}
|
||||||
|
|
||||||
|
type applyWindow struct {
|
||||||
|
win *gadgets.BasicWindow
|
||||||
|
box *gui.Node
|
||||||
|
|
||||||
|
// the top box of the repolist window
|
||||||
|
topbox *gui.Node
|
||||||
|
}
|
||||||
|
|
||||||
|
type C3 = interface {
|
||||||
|
Show()
|
||||||
|
Hide()
|
||||||
|
Hidden() bool
|
||||||
|
Enable()
|
||||||
|
Disable()
|
||||||
|
~*gadgets.BasicWindow | ~*gui.Node
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r applyWindow) Hidden() bool {
|
||||||
|
return r.win.Hidden()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r applyWindow) Show() {
|
||||||
|
r.win.Show()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r applyWindow) Hide() {
|
||||||
|
r.win.Hide()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r applyWindow) Disable() {
|
||||||
|
r.box.Disable()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r applyWindow) Enable() {
|
||||||
|
r.box.Enable()
|
||||||
|
}
|
Loading…
Reference in New Issue