当前位置: 首页>>代码示例>>Golang>>正文


Golang Window.Border方法代码示例

本文整理汇总了Golang中github.com/rthornton128/goncurses.Window.Border方法的典型用法代码示例。如果您正苦于以下问题:Golang Window.Border方法的具体用法?Golang Window.Border怎么用?Golang Window.Border使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/rthornton128/goncurses.Window的用法示例。


在下文中一共展示了Window.Border方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: createMainWindows

//creates the three Main big windows that make up the GUI
func createMainWindows(stdscr *gc.Window) (*gc.Window, *gc.Window, *gc.Window, *gc.Window, *gc.Window) {
	rows, cols := stdscr.MaxYX()
	height, width := rows, int(float64(cols)*.2)

	var contactsWin, messageWinBorder, inputBorderWin, inputWin *gc.Window
	var err error
	contactsWin, err = gc.NewWindow(height, width, 0, 0)
	if err != nil {
		log.Fatal("Failed to create Contact Window:", err)
	}
	err = contactsWin.Border('|', '|', '-', '-', '+', '+', '+', '+')
	if err != nil {
		log.Fatal("Failed to create Border of Contact Window:", err)
	}

	// messageWinBorder is just the border. msgWin is the actual input window
	// doing this simplifies handling text a fair amount.
	// also the derived function never errors. Which seems dangerous
	begin_x := width + 1
	height = int(float64(rows) * .8)
	width = int(float64(cols) * .8)
	messageWinBorder, err = gc.NewWindow(height, width, 0, begin_x)
	if err != nil {
		log.Fatal("Failed to create Message Border Window:", err)
	}
	err = messageWinBorder.Border('|', '|', '-', '-', '+', '+', '+', '+')
	if err != nil {
		log.Fatal("Failed to create Border of Message Window:", err)
	}
	msgWin, err := gc.NewWindow((height - 2), (width - 2), 1, (begin_x + 1))
	if err != nil {
		log.Fatal("Failed to create the message Window:", err)
	}

	begin_y := int(float64(rows)*.8) + 1
	height = int(float64(rows) * .2)
	inputBorderWin, err = gc.NewWindow(height, width, begin_y, begin_x)
	if err != nil {
		log.Fatal("Failed to create InputBorder Window:", err)
	}
	err = inputBorderWin.Border('|', '|', '-', '-', '+', '+', '+', '+')
	if err != nil {
		log.Fatal("Failed to create Border of the InputBorder Window:", err)
	}
	// inputBorderWin is just the border. InputWin is the actual input window
	// doing this simplifies handling text a fair amount.
	// also the derived function never errors. Which seems dangerous
	inputWin, err = gc.NewWindow((height - 2), (width - 2), (begin_y + 1), (begin_x + 1))
	if err != nil {
		log.Fatal("Failed to create the inputWin Window:", err)
	}

	inputWin.ScrollOk(true)
	inputWin.Keypad(true)
	msgWin.ScrollOk(true)

	return contactsWin, messageWinBorder, msgWin, inputBorderWin, inputWin
}
开发者ID:AyaTech,项目名称:textsecure-client,代码行数:59,代码来源:setup.go


注:本文中的github.com/rthornton128/goncurses.Window.Border方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。