Example #1
0
func NewWindow(top int, left int, width int, height int, border bool) *Window {
	win := C.newwin(C.int(height), C.int(width), C.int(top), C.int(left))
	if border {
		attr := _color(ColBorder, 0)
		C.wattron(win, attr)
		C.box(win, 0, 0)
		C.wattroff(win, attr)
	}
	return &Window{
		win:    win,
		Top:    top,
		Left:   left,
		Width:  width,
		Height: height,
	}
}
Example #2
0
func (r *FullscreenRenderer) NewWindow(top int, left int, width int, height int, border bool) Window {
	win := C.newwin(C.int(height), C.int(width), C.int(top), C.int(left))
	if r.theme != nil {
		C.wbkgd(win, C.chtype(C.COLOR_PAIR(C.int(ColNormal.index()))))
	}
	if border {
		pair, attr := _colorFn(ColBorder, 0)
		C.wcolor_set(win, pair, nil)
		C.wattron(win, attr)
		C.box(win, 0, 0)
		C.wattroff(win, attr)
		C.wcolor_set(win, 0, nil)
	}

	return &CursesWindow{
		impl:   win,
		top:    top,
		left:   left,
		width:  width,
		height: height,
	}
}
Example #3
0
func NewWindow(top int, left int, width int, height int, border bool) *Window {
	win := C.newwin(C.int(height), C.int(width), C.int(top), C.int(left))
	if _color {
		C.wbkgd(win, C.chtype(C.COLOR_PAIR(C.int(ColNormal))))
	}
	if border {
		pair, attr := _colorFn(ColBorder, 0)
		C.wcolor_set(win, pair, nil)
		C.wattron(win, attr)
		C.box(win, 0, 0)
		C.wattroff(win, attr)
		C.wcolor_set(win, 0, nil)
	}

	return &Window{
		impl:   (*WindowImpl)(win),
		Top:    top,
		Left:   left,
		Width:  width,
		Height: height,
	}
}
Example #4
0
func (win *Window) Box(verch, horch int) {
	C.box((*C.WINDOW)(win), C.chtype(verch), C.chtype(horch))
}
Example #5
0
// Box draws a border around the given window. For complete control over the
// characters used to draw the border use Border()
func (w *Window) Box(vch, hch Char) error {
	if C.box(w.win, C.chtype(vch), C.chtype(hch)) == C.ERR {
		return errors.New("Failed to draw box around window")
	}
	return nil
}
Example #6
0
func (w *Window) Box(verch, horch int) {
	C.box(w.win, C.chtype(verch), C.chtype(horch))
}
Example #7
0
// Set box lines.
func (window *Window) Box(v, h int) {
	C.box(window.cwin, C.chtype(v), C.chtype(h))
}
Example #8
0
/* Surrounds the window by a box, using character v for the vertical parts and character h for the horizontal parts */
func (w *Window) Box(v, h int) {
	C.box((*C.WINDOW)(w), C.chtype(v), C.chtype(h))
}
Example #9
0
func (win *Window) Box(verch, horch int) {
	in()
	defer out()
	C.box((*C.WINDOW)(win), C.chtype(verch), C.chtype(horch))
}
Example #10
0
func (win *Window) Box(verch, horch chtype) error {
	if C.box((*C.WINDOW)(win), C.chtype(verch), C.chtype(horch)) == C.ERR {
		return CursesError{"box failed"}
	}
	return nil
}