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


C# Gtk.ListStore.GetIterFromString方法代码示例

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


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

示例1: Init

        void Init()
        {
            f_ProtocolListStore = new Gtk.ListStore(typeof(string));

            f_ListStore = new Gtk.ListStore(
                typeof(FilterModel),
                typeof(int), // filter key
                typeof(string) // tool tip
            );
            f_TreeView.Model = f_ListStore;
            int i = 1;
            Gtk.TreeViewColumn column;
            Gtk.CellRendererText textCellr;
            Gtk.CellRendererCombo comboCellr;
            Gtk.CellRendererToggle toggleCellr;

            comboCellr = new Gtk.CellRendererCombo();
            comboCellr.Model = f_ProtocolListStore;
            comboCellr.TextColumn = 0;
            comboCellr.HasEntry = false;
            comboCellr.Editable = true;
            comboCellr.Edited += OnProtocolEdited;
            column = f_TreeView.AppendColumn(_("Protocol"), comboCellr);
            column.SetCellDataFunc(comboCellr, RenderProtocol);

            f_ChatTypeListStore = new Gtk.ListStore(typeof(string),
                                                    typeof(ChatType?));
            f_ChatTypeListStore.AppendValues(String.Empty, null);
            f_ChatTypeListStore.AppendValues(_("Person / Private"),  ChatType.Person);
            f_ChatTypeListStore.AppendValues(_("Group / Public"),    ChatType.Group);
            f_ChatTypeListStore.AppendValues(_("Protocol / Server"), ChatType.Protocol);
            comboCellr = new Gtk.CellRendererCombo();
            comboCellr.Model = f_ChatTypeListStore;
            comboCellr.TextColumn = 0;
            comboCellr.HasEntry = false;
            comboCellr.Editable = true;
            comboCellr.Edited += OnChatTypeEdited;
            column = f_TreeView.AppendColumn(_("Chat Type"), comboCellr);
            column.Resizable = true;
            column.Sizing = Gtk.TreeViewColumnSizing.GrowOnly;
            column.SetCellDataFunc(comboCellr, RenderChatType);

            textCellr = new Gtk.CellRendererText();
            textCellr.Editable = true;
            textCellr.Edited += delegate(object sender, Gtk.EditedArgs e) {
                Gtk.TreeIter iter;
                if (!f_ListStore.GetIterFromString(out iter, e.Path)) {
                    return;
                }
                FilterModel filter = (FilterModel) f_ListStore.GetValue(iter, 0);
                int key = (int) f_ListStore.GetValue(iter, 1);
                filter.ChatID = e.NewText;
                f_ListStore.EmitRowChanged(new Gtk.TreePath(e.Path), iter);
                OnChanged(EventArgs.Empty);
            };
            column = f_TreeView.AppendColumn(_("Name"), textCellr);
            column.MinWidth = 80;
            column.Resizable = true;
            column.Sizing = Gtk.TreeViewColumnSizing.GrowOnly;
            column.SetCellDataFunc(textCellr,
                delegate(Gtk.TreeViewColumn col,
                         Gtk.CellRenderer cellr,
                         Gtk.TreeModel model, Gtk.TreeIter iter ) {
                    FilterModel filter = (FilterModel) model.GetValue(iter, 0);
                    (cellr as Gtk.CellRendererText).Text = filter.ChatID;
                }
            );

            f_MessageTypeListStore = new Gtk.ListStore(typeof(string),
                                                       typeof(MessageType?));
            f_MessageTypeListStore.AppendValues(String.Empty, null);
            f_MessageTypeListStore.AppendValues(_("Normal"), MessageType.Normal);
            f_MessageTypeListStore.AppendValues(_("Event"),  MessageType.Event);
            comboCellr = new Gtk.CellRendererCombo();
            comboCellr.Model = f_MessageTypeListStore;
            comboCellr.TextColumn = 0;
            comboCellr.HasEntry = false;
            comboCellr.Editable = true;
            comboCellr.Edited += OnMessageTypeEdited;
            column = f_TreeView.AppendColumn(_("Type"), comboCellr);
            column.Resizable = true;
            column.Sizing = Gtk.TreeViewColumnSizing.GrowOnly;
            column.SetCellDataFunc(comboCellr, RenderMessageType);
            /*
            f_TreeView.HasTooltip = true;
            f_TreeView.QueryTooltip += delegate(object sender, Gtk.QueryTooltipArgs e) {
                e.Tooltip.Text = "Message Type";
                f_TreeView.SetTooltipCell(e.Tooltip, null, column, null);
                e.RetVal = true;
            };
            */

            textCellr = new Gtk.CellRendererText();
            textCellr.Editable = true;
            textCellr.Edited += delegate(object sender, Gtk.EditedArgs e) {
                Gtk.TreeIter iter;
                if (!f_ListStore.GetIterFromString(out iter, e.Path)) {
                    return;
                }
                FilterModel filter = (FilterModel) f_ListStore.GetValue(iter, 0);
//.........这里部分代码省略.........
开发者ID:tuukka,项目名称:smuxi,代码行数:101,代码来源:FilterListWidget.cs


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