Esempio n. 1
0
// NewWindow creates a window of size h(eight) and w(idth) at y, x
func NewWindow(h, w, y, x int) (window *Window, err error) {
	window = &Window{C.newwin(C.int(h), C.int(w), C.int(y), C.int(x))}
	if window.win == nil {
		err = errors.New("Failed to create a new window")
	}
	return
}
Esempio n. 2
0
func NewWindow(rows int, columns int, startY int, startX int) (*Window, error) {
	window := (*Window)(C.newwin(C.int(rows), C.int(columns), C.int(startY), C.int(startX)))

	if window == nil {
		return nil, CursesError{"Failed to create window"}
	}

	return window, nil
}
Esempio n. 3
0
func Newwin(rows int, cols int, starty int, startx int) (*Window, os.Error) {
	nw := (*Window)(C.newwin(C.int(rows), C.int(cols), C.int(starty), C.int(startx)))

	if nw == nil {
		return nil, CursesError{"Failed to create window"}
	}

	return nw, nil
}
Esempio n. 4
0
func NewWindow(rows, cols, starty, startx int) (*Window, error) {
	nw := C.newwin(C.int(rows), C.int(cols), C.int(starty), C.int(startx))

	if nw == nil {
		return nil, ErrorWindowCreation
	}

	return &Window{nw}, nil
}
Esempio n. 5
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,
	}
}
Esempio n. 6
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,
	}
}
Esempio n. 7
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,
	}
}
Esempio n. 8
0
// Create new window.
func NewWindow(height, width, starty, startx int) *Window {
	w := new(Window)
	w.cwin = C.newwin(C.int(height), C.int(width),
		C.int(starty), C.int(startx))
	return w
}
Esempio n. 9
0
// Create new window.
func NewWindow(height, width, starty, startx int) *Window {
	return (*Window)(C.newwin(C.int(height), C.int(width),
		C.int(starty), C.int(startx)))
}