示例#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
}
示例#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
}
示例#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
}
示例#4
0
文件: curses.go 项目: zozor/gocurse
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
}
示例#5
0
文件: curses.go 项目: infokiller/fzf
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,
	}
}
示例#6
0
文件: ncurses.go 项目: junegunn/fzf
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,
	}
}
示例#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,
	}
}
示例#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
}
示例#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)))
}