frame.go
func (f *Frame) Draw() {
	if f.hidden {
		return
	}

	PushAttributes()
	defer PopAttributes()

	x, y, w, h := f.Clipper()
	fx, fy := f.Pos()
	fw, fh := f.Size()

	if f.scrollable {
		_, fpy := f.Paddings()

		var dist float64
		prop := 0
		ctrl := ActiveControl(f)

		if ctrl != nil {
			var frameProp float64

			_, ty := ctrl.Pos()

			dist = (float64(fy) + float64(fpy)) - float64(ty)
			dist = math.Sqrt(dist * dist)

			if dist > 0 {
				frameProp = (dist * 100) / float64(fh)
			}

			if frameProp > 0 {
				prop = int(math.Round((float64(h-2) / (100 / frameProp))))
			}

			f.lastScrollProp = prop
		}

		DrawScrollBar(x+w, y, 1, h, f.lastScrollProp)
	}

	fg, bg := RealColor(f.fg, f.Style(), ColorViewText), RealColor(f.bg, f.Style(), ColorViewBack)

	if f.border == BorderNone {
		if bg != ColorDefault {
			SetBackColor(bg)
			FillRect(x, y, w, h, ' ')
		}

		f.DrawChildren()
		return
	}

	SetTextColor(fg)
	SetBackColor(bg)
	DrawFrame(fx, fy, fw, fh, f.border)

	if f.title != "" {
		str := f.title
		raw := UnColorizeText(str)
		if xs.Len(raw) > fw-2 {
			str = SliceColorized(str, 0, fw-2-3) + "..."
		}
		DrawText(fx+1, fy, str)
	}

	f.DrawChildren()
}
func (f *Frame) Draw() {
	if f.hidden {
		return
	}

	PushAttributes()
	defer PopAttributes()

	x, y, w, h := f.Clipper()
	fx, fy := f.Pos()
	fw, fh := f.Size()

	if f.scrollable {
		_, fpy := f.Paddings()

		var dist float64
		prop := 0
		ctrl := ActiveControl(f)

		if ctrl != nil {
			var frameProp float64

			_, ty := ctrl.Pos()

			dist = (float64(fy) + float64(fpy)) - float64(ty)
			dist = math.Sqrt(dist * dist)

			if dist > 0 {
				frameProp = (dist * 100) / float64(fh)
			}

			if frameProp > 0 {
				prop = int(math.Round((float64(h-2) / (100 / frameProp))))
			}

			f.lastScrollProp = prop
		}

		DrawScrollBar(x+w, y, 1, h, f.lastScrollProp)
	}

	fg, bg := RealColor(f.fg, f.Style(), ColorViewText), RealColor(f.bg, f.Style(), ColorViewBack)

	if f.border == BorderNone {
		if bg != ColorDefault {
			SetBackColor(bg)
			FillRect(x, y, w, h, ' ')
		}

		f.DrawChildren()
		return
	}

	SetTextColor(fg)
	SetBackColor(bg)
	DrawFrame(fx, fy, fw, fh, f.border)

	if f.title != "" {
		str := f.title
		raw := UnColorizeText(str)
		if xs.Len(raw) > fw-2 {
			str = SliceColorized(str, 0, fw-2-3) + "..."
		}
		DrawText(fx+1, fy, str)
	}

	f.DrawChildren()
}
// Repaint draws the control on its View surface