radio.go
func (c *Radio) Draw() {
	if c.hidden {
		return
	}

	PushAttributes()
	defer PopAttributes()

	x, y := c.Pos()
	w, h := c.Size()

	fg, bg := RealColor(c.fg, c.Style(), ColorControlText), RealColor(c.bg, c.Style(), ColorControlBack)
	if !c.Enabled() {
		fg, bg = RealColor(c.fg, c.Style(), ColorControlDisabledText), RealColor(c.bg, c.Style(), ColorControlDisabledBack)
	} else if c.Active() {
		fg, bg = RealColor(c.fg, c.Style(), ColorControlActiveText), RealColor(c.bg, c.Style(), ColorControlActiveBack)
	}

	parts := []rune(SysObject(ObjRadio))
	cOpen, cClose, cEmpty, cCheck := parts[0], parts[1], parts[2], parts[3]
	cState := cEmpty
	if c.selected {
		cState = cCheck
	}

	SetTextColor(fg)
	SetBackColor(bg)
	FillRect(x, y, w, h, ' ')
	if w < 3 {
		return
	}

	PutChar(x, y, cOpen)
	PutChar(x+2, y, cClose)
	PutChar(x+1, y, cState)

	if w < 5 {
		return
	}

	shift, text := AlignColorizedText(c.title, w-4, c.align)
	DrawText(x+4+shift, y, text)
}
func (c *Radio) Draw() {
	if c.hidden {
		return
	}

	PushAttributes()
	defer PopAttributes()

	x, y := c.Pos()
	w, h := c.Size()

	fg, bg := RealColor(c.fg, c.Style(), ColorControlText), RealColor(c.bg, c.Style(), ColorControlBack)
	if !c.Enabled() {
		fg, bg = RealColor(c.fg, c.Style(), ColorControlDisabledText), RealColor(c.bg, c.Style(), ColorControlDisabledBack)
	} else if c.Active() {
		fg, bg = RealColor(c.fg, c.Style(), ColorControlActiveText), RealColor(c.bg, c.Style(), ColorControlActiveBack)
	}

	parts := []rune(SysObject(ObjRadio))
	cOpen, cClose, cEmpty, cCheck := parts[0], parts[1], parts[2], parts[3]
	cState := cEmpty
	if c.selected {
		cState = cCheck
	}

	SetTextColor(fg)
	SetBackColor(bg)
	FillRect(x, y, w, h, ' ')
	if w < 3 {
		return
	}

	PutChar(x, y, cOpen)
	PutChar(x+2, y, cClose)
	PutChar(x+1, y, cState)

	if w < 5 {
		return
	}

	shift, text := AlignColorizedText(c.title, w-4, c.align)
	DrawText(x+4+shift, y, text)
}
func ( c * Radio ) Draw ( ) { if c . hidden { return } PushAttributes ( ) defer PopAttributes ( ) x , y := c . Pos ( ) w , h := c . Size ( ) fg , bg := RealColor ( c . fg , c . Style ( ) , ColorControlText ) , RealColor ( c . bg , c . Style ( ) , ColorControlBack ) if ! c . Enabled ( ) { fg , bg = RealColor ( c . fg , c . Style ( ) , ColorControlDisabledText ) , RealColor ( c . bg , c . Style ( ) , ColorControlDisabledBack ) } else if c . Active ( ) { fg , bg = RealColor ( c . fg , c . Style ( ) , ColorControlActiveText ) , RealColor ( c . bg , c . Style ( ) , ColorControlActiveBack ) } parts := [ ] rune ( SysObject ( ObjRadio ) ) cOpen , cClose , cEmpty , cCheck := parts [ 0 ] , parts [ 1 ] , parts [ 2 ] , parts [ 3 ] cState := cEmpty if c . selected { cState = cCheck } SetTextColor ( fg ) SetBackColor ( bg ) FillRect ( x , y , w , h , ' ' ) if w < 3 { return } PutChar ( x , y , cOpen ) PutChar ( x + 2 , y , cClose ) PutChar ( x + 1 , y , cState ) if w < 5 { return } shift , text := AlignColorizedText ( c . title , w - 4 , c . align ) DrawText ( x + 4 + shift , y , text ) }
// Repaint draws the control on its View surface
Repaint draws the control on its View surface