~pierrec/giox

e20d066b1e0824cda2acfb133e658d017460bb36 — pierre 9 months ago 51b8fb4
widgetx: make Icons.Hide and Icons.Show methods variadic

Signed-off-by: pierre <pierre.curto@gmail.com>
1 files changed, 10 insertions(+), 6 deletions(-)

M widgetx/icons.go
M widgetx/icons.go => widgetx/icons.go +10 -6
@@ 55,10 55,12 @@ func (s *Icons) Status(idx int) bool {
	return s.status[idx].Value
}

// Hide temporarily removes the icon at idx from the menu.
func (s *Icons) Hide(idx int) {
// Hide temporarily removes the icon at indexes from the menu.
func (s *Icons) Hide(indexes ...int) {
	s.init()
	s.Icons[idx].Color.A = 0
	for _, idx := range indexes {
		s.Icons[idx].Color.A = 0
	}
}

func (s *Icons) Hidden(idx int) bool {


@@ 66,10 68,12 @@ func (s *Icons) Hidden(idx int) bool {
	return s.Icons[idx].Color.A == 0
}

// Show restores the icon at idx in the menu.
func (s *Icons) Show(idx int) {
// Show restores the icon at indexes in the menu.
func (s *Icons) Show(indexes ...int) {
	s.init()
	s.Icons[idx].Color.A = 255
	for _, idx := range indexes {
		s.Icons[idx].Color.A = 255
	}
}

// LoadIcons returns a slice of icons from their data, setting their color to c.