• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Golang glib.GValue类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/mattn/go-gtk/glib.GValue的典型用法代码示例。如果您正苦于以下问题:Golang GValue类的具体用法?Golang GValue怎么用?Golang GValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: tree_view_set_cur_iter

// Sets cur_iter pointing to tree_store node corresponding to current file.
// Requires properly set cur_file.
func tree_view_set_cur_iter(mark bool) {
	if "" == cur_file {
		return
	}
	var parent gtk.GtkTreeIter
	name := cur_file
	tree_model.GetIterFirst(&cur_iter)
	for {
		var val glib.GValue
		tree_model.GetValue(&cur_iter, 0, &val)
		whole_string := val.GetString()
		cur_str := whole_string[1:]
		pos := slashed_prefix(name, cur_str)
		if pos > 0 {
			if mark {
				tree_store.Set(&cur_iter, strings.ToUpper(whole_string[:1])+cur_str)
			} else {
				tree_store.Set(&cur_iter, strings.ToLower(whole_string[:1])+cur_str)
			}
			if pos == len(name) {
				break
			}
			parent.Assign(&cur_iter)
			tree_model.IterChildren(&cur_iter, &parent)
			name = name[pos:]
		} else {
			tree_model.IterNext(&cur_iter)
		}
	}
}
开发者ID:mattn,项目名称:tabby,代码行数:32,代码来源:tree_view.go


示例2: tree_view_set_cur_iter

// Sets cur_iter pointing to tree_store node corresponding to current file.
// Requires properly set cur_file. As a side effect it also assigns correct
// capitalization for first letters of strings kept in nodes according to @mark
// which denotes if current file is active or not.
func tree_view_set_cur_iter(mark bool) {
	if "" == cur_file {
		return
	}
	var parent gtk.TreeIter
	cur_file_suffix := cur_file
	tree_model.GetIterFirst(&cur_iter)
	for {
		var gval glib.GValue
		tree_model.GetValue(&cur_iter, 0, &gval)
		gval_string := gval.GetString()
		icon := gval_string[0]
		node_path := gval_string[1:]
		if pos := slashed_prefix(cur_file_suffix, node_path); pos > 0 {
			if mark {
				tree_store.Set(&cur_iter, strings.ToUpper(string(icon))+node_path)
			} else {
				tree_store.Set(&cur_iter, strings.ToLower(string(icon))+node_path)
			}
			if pos == len(cur_file_suffix) {
				break
			}
			parent.Assign(&cur_iter)
			tree_model.IterChildren(&cur_iter, &parent)
			cur_file_suffix = cur_file_suffix[pos:]
		} else {
			tree_model.IterNext(&cur_iter)
		}
	}
}
开发者ID:udhos,项目名称:tabby,代码行数:34,代码来源:tree_view.go


示例3: tree_view_get_selected_path

func tree_view_get_selected_path(tree_view *gtk.GtkTreeView, tree_model *gtk.GtkTreeModel, col int, shift bool) string {
	var path *gtk.GtkTreePath
	var column *gtk.GtkTreeViewColumn
	tree_view.GetCursor(&path, &column)
	if nil == path.TreePath {
		return ""
	}
	var iter gtk.GtkTreeIter
	tree_model.GetIterFromString(&iter, path.String())
	var ans string
	ans = ""
	for {
		var val glib.GValue
		var next gtk.GtkTreeIter
		tree_model.GetValue(&iter, col, &val)
		if shift {
			ans = val.GetString()[1:] + ans
		} else {
			ans = val.GetString() + ans
		}
		if false == tree_model.IterParent(&next, &iter) {
			break
		}
		iter.Assign(&next)
	}
	return ans
}
开发者ID:mattn,项目名称:tabby,代码行数:27,代码来源:tree_view.go


示例4: refresh_title

func refresh_title() {
	if "" == cur_file {
		main_window.SetTitle("*")
		return
	}
	var icon byte
	if source_buf.GetModified() {
		main_window.SetTitle("* " + cur_file)
		icon = 'C'
	} else {
		main_window.SetTitle(cur_file)
		icon = 'B'
	}
	var val glib.GValue
	tree_model.GetValue(&cur_iter, 0, &val)
	tree_store.Set(&cur_iter, string(icon)+val.GetString()[1:])
}
开发者ID:JessonChan,项目名称:tabby,代码行数:17,代码来源:main.go


示例5: buildList

func (g *Gui) buildList(vbox *gtk.VBox) {
	frame := gtk.NewFrame("Device List")
	framebox := gtk.NewVBox(false, 1)
	frame.Add(framebox)
	vbox.Add(frame)
	g.Status = gtk.NewStatusbar()
	vbox.PackStart(g.Status, false, false, 0)
	g.Store = gtk.NewListStore(glib.G_TYPE_STRING, glib.G_TYPE_STRING)
	treeview := gtk.NewTreeView()
	framebox.Add(treeview)
	treeview.SetModel(g.Store)
	treeview.AppendColumn(gtk.NewTreeViewColumnWithAttributes("Device", gtk.NewCellRendererText(), "text", 0))
	treeview.AppendColumn(gtk.NewTreeViewColumnWithAttributes("Name", gtk.NewCellRendererText(), "text", 1))
	treeview.GetSelection().SetMode(gtk.SELECTION_SINGLE)
	controls := gtk.NewHBox(true, 0)
	g.Start = gtk.NewButtonWithLabel("Start Sync")
	g.Start.Clicked(func() {
		var iter gtk.TreeIter
		var device glib.GValue
		selection := treeview.GetSelection()
		if selection.CountSelectedRows() > 0 {
			selection.GetSelected(&iter)
			g.Store.GetValue(&iter, 0, &device)
			MainGui.notify("Start Writing On: " + device.GetString())
			doWrite(device.GetString())
		} else {
			MainGui.notify("No Active Selection")
		}
	})
	controls.Add(g.Start)
	g.Recheck = gtk.NewButtonWithLabel("Rescan")
	g.Recheck.Clicked(func() {
		devices := SearchValid()
		MainGui.Store.Clear()
		for _, x := range devices {
			MainGui.appendItem("/dev/hidraw"+strconv.FormatUint(x.SeqNum(), 10), x.SysAttrValue("product"))
		}
		MainGui.notify("Scanning Done")
	})
	controls.Add(g.Recheck)
	framebox.PackStart(controls, false, false, 0)
}
开发者ID:spaghetty,项目名称:gunnify,代码行数:42,代码来源:gunnify.go



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang gtk.Init函数代码示例发布时间:2022-05-23
下一篇:
Golang glib.ObjectFromNative函数代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap