Ejemplo n.º 1
0
func (f *Full) borderImages(
	width, height int) (*xgraphics.Image, *xgraphics.Image) {

	imgA := render.NewBorder(f.X, 0, render.NoColor, f.theme.ABorderColor,
		width, height, 0, 0)
	imgI := render.NewBorder(f.X, 0, render.NoColor, f.theme.IBorderColor,
		width, height, 0, 0)
	return imgA.Image, imgI.Image
}
Ejemplo n.º 2
0
func (f *Borders) pieceImages(borderTypes, gradientType, gradientDir,
	width, height int) (*xgraphics.Image, *xgraphics.Image) {

	imgA := render.NewBorder(f.X, borderTypes,
		f.theme.AThinColor, f.theme.ABorderColor,
		width, height, gradientType, gradientDir)
	imgI := render.NewBorder(f.X, borderTypes,
		f.theme.IThinColor, f.theme.IBorderColor,
		width, height, gradientType, gradientDir)
	return imgA.Image, imgI.Image
}
Ejemplo n.º 3
0
func (f *Full) newTitleBar() *piece {
	imgA := render.NewBorder(f.X, 0, render.NoColor, f.theme.ATitleColor,
		1, f.theme.TitleSize,
		render.GradientVert, render.GradientRegular)
	imgI := render.NewBorder(f.X, 0, render.NoColor, f.theme.ITitleColor,
		1, f.theme.TitleSize,
		render.GradientVert, render.GradientRegular)

	win := f.newPieceWindow("titlebar", 0)
	win.MROpt(fX|fY|fH,
		f.theme.BorderSize, f.theme.BorderSize,
		0, f.theme.TitleSize)
	return newPiece(win, imgA.Image, imgI.Image)
}
Ejemplo n.º 4
0
func (f *Full) newButtonMinimize() *piece {
	imgA := render.NewBorder(f.X, 0, render.NoColor, f.theme.ATitleColor,
		f.theme.TitleSize, f.theme.TitleSize,
		render.GradientVert, render.GradientRegular)
	imgI := render.NewBorder(f.X, 0, render.NoColor, f.theme.ITitleColor,
		f.theme.TitleSize, f.theme.TitleSize,
		render.GradientVert, render.GradientRegular)

	xgraphics.Blend(imgA.Image, f.theme.AMinimizeButton, image.ZP)
	xgraphics.Blend(imgI.Image, f.theme.IMinimizeButton, image.ZP)

	win := f.newPieceWindow("minimize", 0)
	win.MROpt(fY|fW|fH,
		0, f.theme.BorderSize,
		f.theme.TitleSize, f.theme.TitleSize)
	return newPiece(win, imgA.Image, imgI.Image)
}
Ejemplo n.º 5
0
func (f *Full) UpdateTitle() {
	if f == nil {
		return
	}

	title := f.client.Name()
	font := f.theme.Font
	fontSize := f.theme.FontSize
	aFontColor := f.theme.AFontColor.ImageColor()
	iFontColor := f.theme.IFontColor.ImageColor()

	ew, eh := xgraphics.TextMaxExtents(font, fontSize, title)
	eh += misc.TextBreathe

	imgA := render.NewBorder(f.X, 0, render.NoColor, f.theme.ATitleColor,
		ew, f.theme.TitleSize,
		render.GradientVert, render.GradientRegular)
	imgI := render.NewBorder(f.X, 0, render.NoColor, f.theme.ITitleColor,
		ew, f.theme.TitleSize,
		render.GradientVert, render.GradientRegular)

	y := (f.theme.TitleSize-eh)/2 - 1

	x2, _, err := imgA.Text(0, y, aFontColor, fontSize, font, title)
	if err != nil {
		logger.Warning.Printf("Could not draw window title for window %s "+
			"because: %v", f.client, err)
	}

	_, _, err = imgI.Text(0, y, iFontColor, fontSize, font, title)
	if err != nil {
		logger.Warning.Printf("Could not draw window title for window %s "+
			"because: %v", f.client, err)
	}

	f.titleText.Create(
		imgA.SubImage(image.Rect(0, 0, x2, imgA.Bounds().Max.Y)),
		imgI.SubImage(image.Rect(0, 0, x2, imgI.Bounds().Max.Y)))

	f.titleText.MROpt(fW, 0, 0, x2, 0)
	if f.client.State() == Active {
		f.titleText.Active()
	} else {
		f.titleText.Inactive()
	}
}
Ejemplo n.º 6
0
func (f *Full) UpdateIcon() {
	size := f.theme.TitleSize
	imgA := render.NewBorder(f.X, 0, render.NoColor, f.theme.ATitleColor,
		size, size, render.GradientVert, render.GradientRegular)
	imgI := render.NewBorder(f.X, 0, render.NoColor, f.theme.ITitleColor,
		size, size, render.GradientVert, render.GradientRegular)

	img := f.client.Icon(size-4, size-4)

	sub := image.Rect(2, 2, size-2, size-2)
	xgraphics.Blend(imgA.SubImage(sub), img, image.ZP)
	xgraphics.Blend(imgI.SubImage(sub), img, image.ZP)

	f.icon.Create(imgA.Image, imgI.Image)

	if f.client.State() == Active {
		f.icon.Active()
	} else {
		f.icon.Inactive()
	}
}