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


C# Gtk.SetValue方法代码示例

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


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

示例1: Update

		/// <summary>
		/// Use a list of modifications to update Gtk.TreeStore
		/// </summary>
		public static void Update(RemoteTreeStore remoteStore, Gtk.TreeStore gtkStore)
		{
			RemoteTreeModification[] modifications = remoteStore.GetModifications();
			if (modifications.Length > 0) {
				Console.WriteLine(String.Format("Received {0} modifications from {1}", modifications.Length, remoteStore));
			}
			foreach(RemoteTreeModification mod in modifications) {
				Console.WriteLine(mod);
				if (mod is RemoteTreeModification.InsertNode) {
					RemoteTreeModification.InsertNode insertMod = (RemoteTreeModification.InsertNode)mod;
					if (insertMod.ParentNodePath.Indices.Length == 0) {
						// Insert to the top level
						gtkStore.InsertNode(insertMod.NodeIndex);
					} else {
						TreeIter it;
						gtkStore.GetIter(out it, new TreePath(insertMod.ParentNodePath.Indices));
						gtkStore.InsertNode(it, insertMod.NodeIndex);
					}
				}
				if (mod is RemoteTreeModification.RemoveNode) {
					RemoteTreeModification.RemoveNode removeMod = (RemoteTreeModification.RemoveNode)mod;
					TreeIter it;
					gtkStore.GetIter(out it, new TreePath(removeMod.NodePath.Indices));
					gtkStore.Remove(ref it);
				}
				if (mod is RemoteTreeModification.UpdateNode) {
					RemoteTreeModification.UpdateNode updateMod = (RemoteTreeModification.UpdateNode)mod;
					// Igonre the root node
					if (updateMod.NodePath.IsRoot) {
						continue;
					}
					TreeIter it;
					gtkStore.GetIter(out it, new TreePath(updateMod.NodePath.Indices));
					object value = updateMod.Value;
					// If it is image, dereference it
					if (value is PixmapRef) {
						value = ((PixmapRef)value).GetPixbuf();
					}
					gtkStore.SetValue(it, updateMod.ColumnIndex, value);
				}
			}
		}
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:45,代码来源:GtkTreeStoreUpdater.cs

示例2: SetRowValue

        protected Gtk.TreeIter SetRowValue(Gtk.TreeStore store, Gtk.TreeIter parent, 
																			 int childIndx, params object[] values)
        {
            Gtk.TreeIter child;
            if (store.IterNthChild(out child, parent, childIndx))
                {
                    for (int i=0; i < values.Length; i++)
                        {
                            if (null == values[i]) continue;
                            store.SetValue(child, i, values[i]);
                        }
                }
            else
                child = store.AppendValues (parent, values);

            return child;
        }
开发者ID:Jeff-Lewis,项目名称:opentf,代码行数:17,代码来源:TreeViewBase.cs

示例3: UserListRendererTool

 /// <summary>
 /// This function handles the icons and colors in list
 /// </summary>
 /// <param name="column"></param>
 /// <param name="cell"></param>
 /// <param name="model"></param>
 /// <param name="iter"></param>
 private void UserListRendererTool(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
 {
     try
     {
         ItemType type = (ItemType)model.GetValue(iter, 2);
         Window window = null;
         switch (type)
         {
             case ItemType.Server:
                 Network nw = (Network)model.GetValue(iter, 1);
                 if (nw == null)
                 {
                     Core.DebugLog("UserListRendererTool(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter): NULL network");
                     return;
                 }
                 if (nw.IsDestroyed)
                 {
                     Values.Remove(ref iter);
                     return;
                 }
                 string info = null;
                 if (nw.IrcdVersion != null)
                 {
                     info = "IRCD version " + nw.IrcdVersion;
                 }
                 string nwinfo = (string)model.GetValue(iter, 4);
                 if (nwinfo != info && info != null)
                 {
                     model.SetValue(iter, 4, info);
                 }
                 if (nw != null && !nw.IsDestroyed && nw.SystemWindow != null)
                 {
                     (cell as Gtk.CellRendererText).ForegroundGdk = Core.FromColor(nw.SystemWindow.MenuColor);
                     if (nw.SystemWindow.needIcon)
                     {
                         nw.SystemWindow.needIcon = false;
                         if (nw.IsConnected)
                         {
                             model.SetValue(iter, 5, Configuration.CurrentSkin.Icon_ExclamationMark);
                         }
                         else
                         {
                             model.SetValue(iter, 5, Configuration.CurrentSkin.Icon_ShadowMark);
                         }
                     }
                 }
                 break;
             case ItemType.User:
                 User user = (User)model.GetValue(iter, 1);
                 if (user == null)
                 {
                     Core.DebugLog("UserListRendererTool(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter): NULL user");
                     return;
                 }
                 if (user.IsDestroyed)
                 {
                     Values.Remove(ref iter);
                 }
                 lock (user._Network.PrivateWins)
                 {
                     if (user._Network.PrivateWins.ContainsKey(user))
                     {
                         window = user._Network.PrivateWins[user];
                     }
                 }
                 if (window != null && !window.IsDestroyed)
                 {
                     (cell as Gtk.CellRendererText).ForegroundGdk = Core.FromColor(window.MenuColor);
                     if (window.needIcon)
                     {
                         window.needIcon = false;
                         if (user._Network == null || !user._Network.IsConnected)
                         {
                             model.SetValue(iter, 5, Configuration.CurrentSkin.Icon_ShadowAt);
                         }
                         else
                         {
                             model.SetValue(iter, 5, Configuration.CurrentSkin.Icon_At);
                         }
                     }
                 }
                 break;
             case ItemType.DCC:
                 ProtocolDCC dc = (ProtocolDCC)model.GetValue(iter, 1);
                 if (dc == null)
                 {
                     Core.DebugLog("UserListRendererTool(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter): NULL dc");
                     return;
                 }
                 if (dc.IsDestroyed)
                 {
                     Values.Remove(ref iter);
                 }
//.........这里部分代码省略.........
开发者ID:JGunning,项目名称:OpenAIM,代码行数:101,代码来源:PidgeonList.cs

示例4: SetModelValue

 public static void SetModelValue(Gtk.TreeModel store, Gtk.TreeIter it, int column, Type type, object value)
 {
     if (type == typeof(ObjectWrapper) && value != null)
         store.SetValue (it, column, new ObjectWrapper (value));
     else if (value is string)
         store.SetValue (it, column, (string)value);
     else
         store.SetValue (it, column, value ?? DBNull.Value);
 }
开发者ID:jfreax,项目名称:xwt,代码行数:9,代码来源:CellUtil.cs

示例5: CreateCellRenderer

 public static Gtk.CellRenderer CreateCellRenderer(ApplicationContext actx, ICellRendererTarget col, object target, CellView view, Gtk.TreeModel model)
 {
     if (view is TextCellView) {
         Gtk.CellRendererText cr = new Gtk.CellRendererText ();
         if (((TextCellView)view).Editable) {
             cr.Editable = true;
             cr.Edited += (o, args) => {
                 Gtk.TreeIter iter;
                 if (model.GetIterFromString (out iter, args.Path))
                     model.SetValue (iter, ((TextCellView)view).TextField.Index, args.NewText);
             };
         }
         col.PackStart (target, cr, false);
         col.AddAttribute (target, cr, "text", ((TextCellView)view).TextField.Index);
         return cr;
     }
     else if (view is CheckBoxCellView) {
         Gtk.CellRendererToggle cr = new Gtk.CellRendererToggle ();
         col.PackStart (target, cr, false);
         col.AddAttribute (target, cr, "active", ((CheckBoxCellView)view).ActiveField.Index);
         return cr;
     }
     else if (view is ImageCellView) {
         CellRendererImage cr = new CellRendererImage (actx);
         col.PackStart (target, cr, false);
         col.AddAttribute (target, cr, "image", ((ImageCellView)view).ImageField.Index);
         return cr;
     }
     else if (view is CanvasCellView) {
         var canvas = (CanvasCellView) view;
         var cr = new CustomCellRenderer (canvas);
         col.PackStart (target, cr, false);
         col.SetCellDataFunc (target, cr, delegate (CellLayout cell_layout, CellRenderer cell, TreeModel tree_model, TreeIter iter) {
             cr.LoadData (cell_layout, cell, tree_model, iter);
             ((CanvasCellView) view).Initialize (cr);
         });
         return cr;
     }
     throw new NotSupportedException ("Unknown cell view type: " + view.GetType ());
 }
开发者ID:jbeaurain,项目名称:xwt,代码行数:40,代码来源:CellUtil.cs

示例6: AddTagToStore

 private void AddTagToStore(Tag tag, Gtk.ListStore tagStore)
 {
     if(tag.TreeIter.Equals (Gtk.TreeIter.Zero)) {
         tag.TreeIter = tagStore.AppendValues(tag.Name, tag.Count);
         Debug.Assert(!tag.TreeIter.Equals(Gtk.TreeIter.Zero));
     } else {
         tagStore.SetValue(tag.TreeIter, (int)TagCols.Count, tag.Count);
     }
 }
开发者ID:owq,项目名称:NOTE,代码行数:9,代码来源:NotesModel.cs

示例7: AddNoteToStore

 private void AddNoteToStore(Note note, Gtk.ListStore notesStore)
 {
     if (note.TreeIter.Equals (Gtk.TreeIter.Zero)) {
         note.TreeIter = notesStore.AppendValues (note.Title, note);
         Debug.Assert(!note.TreeIter.Equals(Gtk.TreeIter.Zero));
     } else {
         notesStore.SetValue(note.TreeIter, (int)NoteCols.Title, note.Title);
     }
 }
开发者ID:owq,项目名称:NOTE,代码行数:9,代码来源:NotesModel.cs


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