summaryrefslogtreecommitdiff
path: root/windowApply.go
blob: 5c854161e54a6afa5b05e2679188416b92aa061a (plain)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
// Use of this source code is governed by the GPL 3.0

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()
}