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


Golang Window.MovePrint方法代码示例

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


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

示例1: makeContactsMenu

// makes the menu inside the contacts window
func makeContactsMenu(contacts []ts.Contact, contactsWin *gc.Window) ([]*gc.MenuItem, *gc.Menu, *gc.Window) {
	menu_items := make([]*gc.MenuItem, len(contacts))
	var err error
	for i, val := range contacts {
		menu_items[i], err = gc.NewItem((val.Name), "")
		if err != nil {
			log.Fatal("Error making item for contact menu... ", err)
		}
	}
	contactMenu, err := gc.NewMenu(menu_items)
	if err != nil {
		log.Fatal("Error creating contact menu from menu_items... ", err)
	}
	contactsWinSizeY, contactsWinSizeX := contactsWin.MaxYX()
	contactsWin.Keypad(true)
	contactsMenuWin := contactsWin.Derived((contactsWinSizeY - 5), (contactsWinSizeX - 2), 3, 1)
	contactMenu.SetWindow(contactsMenuWin)
	contactMenu.Format(len(contacts), 1)
	contactMenu.Mark(" * ")

	title := "Contacts"
	contactsWin.MovePrint(1, (contactsWinSizeX/2)-(len(title)/2), title)
	contactsWin.HLine(2, 1, '-', contactsWinSizeX-2)
	contactsMenuWin.Keypad(true)
	contactsMenuWin.ScrollOk(true)
	return menu_items, contactMenu, contactsMenuWin
}
开发者ID:AyaTech,项目名称:textsecure-client,代码行数:28,代码来源:setup.go

示例2: PrintHiglighted

func PrintHiglighted(window *gc.Window, y int, x int, index int, selected int, text string, isActive bool) {
	if index == selected && isActive {
		window.AttrOn(gc.A_STANDOUT)
	}
	window.MovePrint(y, x, text)
	if index == selected && isActive {
		window.AttrOff(gc.A_STANDOUT)
	}
}
开发者ID:kuzzmi,项目名称:monk,代码行数:9,代码来源:filepanel.go

示例3: printmenu

func printmenu(w *gc.Window, menu []string, active int) {
	y, x := 2, 2
	w.Box(0, 0)
	for i, s := range menu {
		if i == active {
			w.AttrOn(gc.A_REVERSE)
			w.MovePrint(y+i, x, s)
			w.AttrOff(gc.A_REVERSE)
		} else {
			w.MovePrint(y+i, x, s)
		}
	}
	w.Refresh()
}
开发者ID:trotha01,项目名称:goncurses,代码行数:14,代码来源:mouse.go

示例4: printToMsgWindow

// Prints messages to the message window
func printToMsgWindow(msg string, msgWin *gc.Window, amSending bool) {
	lines := int(len(msg)/(msgWinSize_x-1)) + 1
	if amSending == true {
		msgWin.Scroll(lines)
		msgWin.ColorOn(2)
		msgWin.MovePrint((msgWinSize_y - lines), 0, msg)
	} else {
		if strings.ContainsAny(msg, "\n") {
			printByLineBreakdown := strings.Split(msg, "\n")
			for i, val := range printByLineBreakdown {
				if i != 0 {
					msgWin.Scroll(1)
				}
				lines2 := int(len(val)/(msgWinSize_x-1)) + 1
				if lines2 > 1 {
					msgWin.Scroll(lines2)
					msgWin.ColorOn(1)
					msgWin.MovePrint((msgWinSize_y - lines2), int(msgWinSize_x*3/4), val)
				} else {
					msgWin.Scroll(lines2)
					msgWin.ColorOn(1)
					space_buf := (msgWinSize_x) - len(val)
					msgWin.MovePrint((msgWinSize_y - lines), space_buf, val)
					msgWin.Scroll(-1)
				}
			}
		} else {
			if lines > 1 {
				msgWin.Scroll(lines)
				msgWin.ColorOn(1)
				msgWin.MovePrint((msgWinSize_y - lines), int(msgWinSize_x*3/4), msg)
			} else {
				msgWin.Scroll(lines)
				msgWin.ColorOn(1)
				space_buf := (msgWinSize_x) - len(msg)
				msgWin.MovePrint((msgWinSize_y - lines), space_buf, msg)
				msgWin.Scroll(-1)
			}
		}
	}
	msgWin.Refresh()
	globalInputWin.Refresh()
}
开发者ID:AyaTech,项目名称:textsecure-client,代码行数:44,代码来源:messageWindow.go

示例5: displayInfo

// Function to call to update the information in the information Window.
func displayInfo(win *gc.Window, active, activeA int, userItems []*gc.MenuItem, userArticles map[string][]articleType) {
	win.Clear()
	win.MovePrint(1, 0, "Auteur : ", userItems[active].Name())
	win.MovePrint(2, 0, "Date : ", userArticles[userItems[active].Name()][activeA].date)
	win.MovePrint(4, 0, userArticles[userItems[active].Name()][activeA].url)
	win.Refresh()
}
开发者ID:Depado,项目名称:mdblog-curses-reader,代码行数:8,代码来源:menu.go


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