示例#1
0
文件: window.go 项目: zyxar/gocurse
func (win *Window) Derwin(rows int, cols int, starty int, startx int) (*Window, error) {
	dw := (*Window)(C.derwin((*C.WINDOW)(win), C.int(rows), C.int(cols), C.int(starty), C.int(startx)))
	if dw == nil {
		return nil, CursesError{"derwin failed"}
	}
	return dw, nil
}
示例#2
0
func (win *Window) DerivedWindow(rows int, columns int, startY int, startX int) (*Window, error) {
	window := (*Window)(C.derwin((*C.WINDOW)(win), 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
文件: curses.go 项目: zozor/gocurse
//Flakey function according to ncurses DOC
func (w *Window) Derwin(rows, cols, starty, startx int) (*Window, error) {
	dw := C.derwin(w.win, C.int(rows), C.int(cols), C.int(starty), C.int(startx))

	if dw == nil {
		return nil, ErrorWindowCreation
	}

	return &Window{dw}, nil
}
示例#4
0
func (win *Window) Derwin(cols int, rows int, startx int, starty int) (*Window, os.Error) {
	in()
	defer out()
	dw := (*Window)(C.derwin((*C.WINDOW)(win), C.int(rows), C.int(cols), C.int(starty), C.int(startx)))

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

	return dw, nil
}
示例#5
0
// Derived creates a new window of height and width at the coordinates
// y, x.  These coordinates are relative to the original window thereby
// confining the derived window to the area of original window. See the
// SubWindow function for additional notes.
func (w *Window) Derived(height, width, y, x int) *Window {
	return &Window{C.derwin(w.win, C.int(height), C.int(width), C.int(y),
		C.int(x))}
}
示例#6
0
/* Creates a new window, based on the origin Window (nc.Init returns stdscr, so this should be used for other window). The startx and starty variables begin in the upper-left corner and increase going down and to the right of the screen. These are also relative to the origin window. */
func NewWindow(origin *Window, height, width, startx, starty int) *Window {
	origin.Touch()
	return (*Window)(C.derwin((*C.WINDOW)(origin), C.int(height), C.int(width), C.int(starty), C.int(startx)))
}