當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Canvas.DrawRoundedRect方法代碼示例

本文整理匯總了Golang中github.com/nelsam/gxui.Canvas.DrawRoundedRect方法的典型用法代碼示例。如果您正苦於以下問題:Golang Canvas.DrawRoundedRect方法的具體用法?Golang Canvas.DrawRoundedRect怎麽用?Golang Canvas.DrawRoundedRect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/nelsam/gxui.Canvas的用法示例。


在下文中一共展示了Canvas.DrawRoundedRect方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: Paint

func (t *PanelTab) Paint(c gxui.Canvas) {
	s := t.Size()
	var style Style
	switch {
	case t.IsMouseDown(gxui.MouseButtonLeft) && t.IsMouseOver():
		style = t.theme.TabPressedStyle
	case t.IsMouseOver():
		style = t.theme.TabOverStyle
	default:
		style = t.theme.TabDefaultStyle
	}
	if l := t.Label(); l != nil {
		l.SetColor(style.FontColor)
	}

	c.DrawRoundedRect(s.Rect(), 5.0, 5.0, 0.0, 0.0, style.Pen, style.Brush)

	if t.HasFocus() {
		style = t.theme.FocusedStyle
		r := math.CreateRect(1, 1, s.W-1, s.H-1)
		c.DrawRoundedRect(r, 4.0, 4.0, 0.0, 0.0, style.Pen, style.Brush)
	}

	if t.active {
		style = t.theme.TabActiveHighlightStyle
		r := math.CreateRect(1, s.H-1, s.W-1, s.H)
		c.DrawRect(r, style.Brush)
	}

	t.Button.Paint(c)
}
開發者ID:nelsam,項目名稱:gxui,代碼行數:31,代碼來源:panel_tab.go

示例2: Paint

// mixin.List overrides
func (l *DropDownList) Paint(c gxui.Canvas) {
	l.DropDownList.Paint(c)
	if l.HasFocus() || l.ListShowing() {
		r := l.Size().Rect().ContractI(1)
		c.DrawRoundedRect(r, 3.0, 3.0, 3.0, 3.0, l.theme.FocusedStyle.Pen, l.theme.FocusedStyle.Brush)
	}
}
開發者ID:nelsam,項目名稱:gxui,代碼行數:8,代碼來源:drop_down_list.go

示例3: Paint

// mixins.CodeEditor overrides
func (e *editor) Paint(c gxui.Canvas) {
	e.CodeEditor.Paint(c)

	if e.HasFocus() {
		r := e.Size().Rect()
		c.DrawRoundedRect(r, 3, 3, 3, 3, e.theme.FocusedStyle.Pen, e.theme.FocusedStyle.Brush)
	}
}
開發者ID:gitter-badger,項目名稱:vidar,代碼行數:9,代碼來源:editor.go

示例4: Paint

// mixins.CodeEditor overrides
func (t *CodeEditor) Paint(c gxui.Canvas) {
	t.CodeEditor.Paint(c)

	if t.HasFocus() {
		r := t.Size().Rect()
		c.DrawRoundedRect(r, 3, 3, 3, 3, t.theme.FocusedStyle.Pen, t.theme.FocusedStyle.Brush)
	}
}
開發者ID:nelsam,項目名稱:gxui,代碼行數:9,代碼來源:code_editor.go

示例5: Paint

func (p *PanelHolder) Paint(c gxui.Canvas) {
	panel := p.SelectedPanel()
	if panel != nil {
		bounds := p.Children().Find(panel).Bounds()
		c.DrawRoundedRect(bounds, 0.0, 0.0, 3.0, 3.0, p.theme.PanelBackgroundStyle.Pen, p.theme.PanelBackgroundStyle.Brush)
	}
	p.PanelHolder.Paint(c)
}
開發者ID:nelsam,項目名稱:gxui,代碼行數:8,代碼來源:panel_holder.go

示例6: Paint

func (f *FSLocator) Paint(c gxui.Canvas) {
	f.LinearLayout.Paint(c)

	if f.HasFocus() {
		r := f.Size().Rect()
		s := f.theme.FocusedStyle
		c.DrawRoundedRect(r, 3, 3, 3, 3, s.Pen, s.Brush)
	}
}
開發者ID:nelsam,項目名稱:vidar,代碼行數:9,代碼來源:fslocator.go

示例7: Paint

// mixins.TextBox overrides
func (t *TextBox) Paint(c gxui.Canvas) {
	t.TextBox.Paint(c)

	if t.HasFocus() {
		r := t.Size().Rect()
		s := t.theme.FocusedStyle
		c.DrawRoundedRect(r, 3, 3, 3, 3, s.Pen, s.Brush)
	}
}
開發者ID:nelsam,項目名稱:gxui,代碼行數:10,代碼來源:textbox.go

示例8: PaintBorders

func (l *CodeEditorLine) PaintBorders(c gxui.Canvas, info CodeEditorLinePaintInfo) {
	start, _ := info.LineSpan.Span()
	offsets := info.GlyphOffsets
	for _, layer := range l.ce.layers {
		if layer != nil && layer.BorderColor() != nil {
			color := *layer.BorderColor()
			interval.Visit(layer.Spans(), info.LineSpan, func(vs, ve uint64, _ int) {
				s, e := vs-start, ve-start
				r := math.CreateRect(offsets[s].X, 0, offsets[e-1].X+info.GlyphWidth, info.LineHeight)
				c.DrawRoundedRect(r, 3, 3, 3, 3, gxui.CreatePen(0.5, color), gxui.TransparentBrush)
			})
		}
	}
}
開發者ID:nelsam,項目名稱:gxui,代碼行數:14,代碼來源:code_editor_line.go

示例9: PaintBackgroundSpans

func (l *CodeEditorLine) PaintBackgroundSpans(c gxui.Canvas, info CodeEditorLinePaintInfo) {
	start, _ := info.LineSpan.Span()
	offsets := info.GlyphOffsets
	remaining := interval.IntDataList{info.LineSpan}
	for _, layer := range l.ce.layers {
		if layer != nil && layer.BackgroundColor() != nil {
			color := *layer.BackgroundColor()
			for _, span := range layer.Spans().Overlaps(info.LineSpan) {
				interval.Visit(&remaining, span, func(vs, ve uint64, _ int) {
					s, e := vs-start, ve-start
					r := math.CreateRect(offsets[s].X, 0, offsets[e-1].X+info.GlyphWidth, info.LineHeight)
					c.DrawRoundedRect(r, 3, 3, 3, 3, gxui.TransparentPen, gxui.Brush{Color: color})
				})
				interval.Remove(&remaining, span)
			}
		}
	}
}
開發者ID:nelsam,項目名稱:gxui,代碼行數:18,代碼來源:code_editor_line.go

示例10: PaintMouseOverBackground

func (t *Tree) PaintMouseOverBackground(c gxui.Canvas, r math.Rect) {
	c.DrawRoundedRect(r, 2.0, 2.0, 2.0, 2.0, gxui.TransparentPen, gxui.CreateBrush(gxui.Gray15))
}
開發者ID:nelsam,項目名稱:gxui,代碼行數:3,代碼來源:tree.go

示例11: PaintUnexpandedSelection

func (t *Tree) PaintUnexpandedSelection(c gxui.Canvas, r math.Rect) {
	c.DrawRoundedRect(r, 2.0, 2.0, 2.0, 2.0, gxui.CreatePen(1, gxui.Gray50), gxui.TransparentBrush)
}
開發者ID:nelsam,項目名稱:gxui,代碼行數:3,代碼來源:tree.go

示例12: DrawSelection

func (l *DropDownList) DrawSelection(c gxui.Canvas, r math.Rect) {
	c.DrawRoundedRect(r, 2.0, 2.0, 2.0, 2.0, l.theme.HighlightStyle.Pen, l.theme.HighlightStyle.Brush)
}
開發者ID:nelsam,項目名稱:gxui,代碼行數:3,代碼來源:drop_down_list.go

示例13: PaintSelection

func (t *DefaultTextBoxLine) PaintSelection(c gxui.Canvas, top, bottom math.Point) {
	r := math.Rect{Min: top, Max: bottom}.ExpandI(t.caretWidth / 2)
	c.DrawRoundedRect(r, 1, 1, 1, 1, gxui.TransparentPen, gxui.Brush{Color: gxui.Gray40})
}
開發者ID:nelsam,項目名稱:gxui,代碼行數:4,代碼來源:default_textbox_line.go

示例14: PaintCaret

func (t *DefaultTextBoxLine) PaintCaret(c gxui.Canvas, top, bottom math.Point) {
	r := math.Rect{Min: top, Max: bottom}.ExpandI(t.caretWidth / 2)
	c.DrawRoundedRect(r, 1, 1, 1, 1, gxui.CreatePen(0.5, gxui.Gray70), gxui.WhiteBrush)
}
開發者ID:nelsam,項目名稱:gxui,代碼行數:4,代碼來源:default_textbox_line.go

示例15: PaintBorder

func (b *BackgroundBorderPainter) PaintBorder(c gxui.Canvas, r math.Rect) {
	if b.pen.Color.A != 0 && b.pen.Width != 0 {
		w := b.pen.Width
		c.DrawRoundedRect(r, w, w, w, w, b.pen, gxui.TransparentBrush)
	}
}
開發者ID:nelsam,項目名稱:gxui,代碼行數:6,代碼來源:background_border_painter.go


注:本文中的github.com/nelsam/gxui.Canvas.DrawRoundedRect方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。