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


C# TreeStore.SetValue方法代码示例

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


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

示例1: CreateLeagueList

 public static TreeModel CreateLeagueList(Country country)
 {
     #if DEBUG
     Console.WriteLine("TreeViewHelper.CreateLeagueList");
     #endif
     TreeStore ls = new TreeStore (typeof(string));
     TreeIter iter = ls.AppendNode ();
     ls.SetValue (iter, 0, Catalog.GetString ("Current league"));
     foreach (League league in country.Leagues) {
         iter = ls.AppendNode ();
         ls.SetValue (iter, 0, league.name);
     }
     return ls;
 }
开发者ID:kashifsoofi,项目名称:bygfoot,代码行数:14,代码来源:TreeViewHelper.cs

示例2: OriginView

        public OriginView(Battle.Core.BattleSession session, Battle.Core.OriginDefinition orig)
            : base(5, 2, false)
        {
            this.SizeRequested += HandleSizeRequested;
            this.SizeAllocated += HandleSizeAllocated;
            //this.session = session;
            //this.orig = orig;

            Label label1 = new Label("Name: ");
            Label label2 = new Label("Description: ");
            Entry entry1 = new Entry();
            Entry entry2 = new Entry();

            entry1.IsEditable = false;
            entry1.Text = orig.Name;

            entry2.IsEditable = false;
            entry2.Text = orig.Description;

            Gtk.TreeStore store1 = new Gtk.TreeStore(typeof(string));
            foreach (string prov in orig.Provides())
            {
                //string[] vs = new string[1];
                //vs[0] = prov;
                //store1.AppendValues(vs);
                TreeIter i =  store1.AppendNode();
                store1.SetValue(i, 0, prov);
            }
            TreeView treeview1 = new TreeView(store1);
            treeview1.AppendColumn("Provides", new CellRendererText(), "text", 0);

            Gtk.TreeStore store2 = new Gtk.TreeStore(typeof(string));
            foreach (string req in orig.Requires())
            {
                string[] vs = new string[1];
                vs[0] = req;
                store1.AppendValues(vs);
            }
            TreeView treeview2 = new TreeView(store2);
            treeview2.AppendColumn("Requires", new CellRendererText(), "text", 0);

            this.Attach(new Label("Origin"), 0, 2, 0, 1, AttachOptions.Expand, AttachOptions.Fill, 0, 0);

            this.Attach(label1, 0, 1, 1, 2, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);
            this.Attach(entry1, 1, 2, 1, 2, AttachOptions.Fill, AttachOptions.Fill, 0, 0);

            this.Attach(label2, 0, 1, 2, 3, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);
            this.Attach(entry2, 1, 2, 2, 3, AttachOptions.Fill, AttachOptions.Fill, 0, 0);

            this.Attach(treeview1, 0, 2, 3, 4, AttachOptions.Fill, AttachOptions.Fill, 1, 1);

            this.Attach(treeview2, 0, 2, 4, 5, AttachOptions.Fill, AttachOptions.Fill, 1, 1);
        }
开发者ID:sgtnasty,项目名称:battle,代码行数:53,代码来源:OriginView.cs

示例3: FillTree

        protected override void FillTree()
        {
            TreeStore store = new TreeStore (typeof(Player), typeof(bool));
            localIter = store.AppendValues (localTeam);
            visitorIter = store.AppendValues (visitorTeam);
            store.SetValue (localIter, 1, false);
            store.SetValue (visitorIter, 1, false);

            filter.IgnoreUpdates = true;
            foreach (Player player in local.PlayingPlayersList) {
                filter.FilterPlayer (player, true);
                store.AppendValues (localIter, player, true);
            }

            foreach (Player player in visitor.PlayingPlayersList) {
                filter.FilterPlayer (player, true);
                store.AppendValues (visitorIter, player, true);
            }
            filter.IgnoreUpdates = false;
            filter.Update ();
            Model = store;
        }
开发者ID:GNOME,项目名称:longomatch,代码行数:22,代码来源:PlayersFilterTreeView.cs

示例4: CreateCountryList

        /** Create the model for the startup country files combo.
         * @param countryList The List of country files found */
        public static TreeModel CreateCountryList(string[] countryList)
        {
            #if DEBUG
            Console.WriteLine("TreeViewHelper.CreateCountryList");
            #endif
            TreeStore ls = new TreeStore(typeof(Pixbuf), typeof(string));
            TreeIter iterContinent = new TreeIter ();
            string currentContinent = string.Empty;
            foreach (string country in countryList) {
                string[] elements = country.Split(new char[] { Path.DirectorySeparatorChar }, StringSplitOptions.RemoveEmptyEntries);
                string continent = elements [0];
                if (continent != currentContinent) {
                    iterContinent = ls.AppendNode ();
                    ls.SetValue(iterContinent, 1, continent);
                    currentContinent = continent;
                }

                Pixbuf flag = PixbufFromFilename (string.Format ("flag_{0}.png", elements [1]));
                TreeIter iterCountry = ls.AppendNode (iterContinent);
                ls.SetValues(iterCountry, flag, elements[1]);
            }
            return ls;
        }
开发者ID:kashifsoofi,项目名称:bygfoot,代码行数:25,代码来源:TreeViewHelper.cs

示例5: FontChooserPanelWidget

		public FontChooserPanelWidget ()
		{
			this.Build ();
			fontStore = new TreeStore (typeof (string), typeof (string), typeof (string));
			treeviewFonts.Model = fontStore;
			
			treeviewFonts.AppendColumn (GettextCatalog.GetString ("Name"), textRenderer, "text", colDisplayName);
			
			comboRenderer.Edited += delegate(object o, Gtk.EditedArgs args) {
				TreeIter iter;
				if (!fontStore.GetIterFromString (out iter, args.Path))
					return;
				string fontName = (string)fontStore.GetValue (iter, colName);
				
				if (args.NewText == GettextCatalog.GetString ("Default")) { 
					SetFont (fontName, FontService.GetFont (fontName).FontDescription);
					fontStore.SetValue (iter, colValue, GettextCatalog.GetString ("Default"));
					return;
				}
				var selectionDialog = new FontSelectionDialog (GettextCatalog.GetString ("Select Font"));
				string fontValue = FontService.FilterFontName (GetFont (fontName));
				selectionDialog.SetFontName (fontValue);
				selectionDialog.OkButton.Clicked += delegate {
					fontValue = selectionDialog.FontName;
					if (fontValue ==  FontService.FilterFontName (FontService.GetFont (fontName).FontDescription))
						fontValue = FontService.GetFont (fontName).FontDescription;
					SetFont (fontName, fontValue);
					fontStore.SetValue (iter, colValue, selectionDialog.FontName);
				};
				MessageService.ShowCustomDialog (selectionDialog);
				selectionDialog.Destroy ();
			};
			
			comboRenderer.EditingStarted += delegate(object o, EditingStartedArgs args) {
				TreeIter iter;
				if (!fontStore.GetIterFromString (out iter, args.Path))
					return;
				string fontName = (string)fontStore.GetValue (iter, colName);
				string fontValue = GetFont (fontName);
				comboBoxStore.Clear ();
				if (fontValue != FontService.GetFont (fontName).FontDescription) 
					comboBoxStore.AppendValues (fontValue);
				
				comboBoxStore.AppendValues (GettextCatalog.GetString ("Default"));
				comboBoxStore.AppendValues (GettextCatalog.GetString ("Edit..."));
			};
			
			var fontCol = new TreeViewColumn ();
			fontCol.Title = GettextCatalog.GetString ("Font");
			
			comboRenderer.HasEntry = false;
			comboRenderer.Mode = CellRendererMode.Activatable;
			comboRenderer.TextColumn = 0;
			comboRenderer.Editable = true;
			fontCol.PackStart (comboRenderer, true);
			fontCol.SetCellDataFunc (comboRenderer, delegate (Gtk.TreeViewColumn tree_column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter) {
				string fontValue = (string)fontStore.GetValue (iter, colValue);
				string fontName = (string)fontStore.GetValue (iter, colName);
				var d = FontService.GetFont (fontName);
				if (d == null || d.FontDescription != fontValue) {
					comboRenderer.Text = fontValue;
				} else {
					comboRenderer.Text = GettextCatalog.GetString ("Default");
				}
			});
			
			treeviewFonts.AppendColumn (fontCol);
			
			comboBoxStore = new ListStore (typeof (string));
			
			comboRenderer.Model = comboBoxStore;
			
			LoadFonts ();
		}
开发者ID:Tak,项目名称:monodevelop-novell,代码行数:74,代码来源:FontChooserPanelWidget.cs

示例6: CreateUsers

        /** Fill a tree model with the users. */
        public static TreeModel CreateUsers()
        {
            #if DEBUG
            Console.WriteLine("TreeViewHelper.CreateUsers");
            #endif
            TreeStore ls = new TreeStore(typeof(int), typeof(string), typeof(string), typeof(string));
            for (int i = 0; i < Variables.Users.Count; i++) {
                TreeIter iter = ls.AppendNode ();
                ls.SetValues (iter, i + 1, Variables.Users [i].Name, Variables.Users [i].Team.name);

                if (Variables.status [0] == StatusValue.STATUS_TEAM_SELECTION) {
                    if (Variables.Users [i].Scout == Quality.QUALITY_NONE) {
                        ls.SetValue (iter, 3, Variables.LeagueCupGetName(Variables.Users[i].Team.clid));
                    } else {
                        int index = (int)Variables.Users [i].Scout;
                        ls.SetValue (iter, 3, Variables.Country.Leagues[index].name);
                    }
                } else {
                    ls.SetValue (iter, 3, Variables.LeagueCupGetName(Variables.Users[i].Team.clid));
                }
            }
            return ls;
        }
开发者ID:kashifsoofi,项目名称:bygfoot,代码行数:24,代码来源:TreeView.cs

示例7: AddinView

        public AddinView()
        {
            var hbox = new HBox () { Spacing = 6 };

            var filter_label = new Label (Catalog.GetString ("Show:"));
            var filter_combo = new ComboBoxText ();
            filter_combo.AppendText (Catalog.GetString ("All"));
            filter_combo.AppendText (Catalog.GetString ("Enabled"));
            filter_combo.AppendText (Catalog.GetString ("Not Enabled"));
            filter_combo.Active = 0;

            var search_label = new Label (Catalog.GetString ("Search:"));
            var search_entry = new Banshee.Widgets.SearchEntry () {
                WidthRequest = 160,
                Visible = true,
                Ready = true
            };

            hbox.PackStart (filter_label, false, false, 0);
            hbox.PackStart (filter_combo, false, false, 0);
            hbox.PackEnd   (search_entry, false, false, 0);
            hbox.PackEnd   (search_label, false, false, 0);

            var model = new TreeStore (typeof(bool), typeof(bool), typeof (string), typeof (Addin));

            var addins = AddinManager.Registry.GetAddins ().Where (a => { return
                a.Name != a.Id && a.Description != null &&
                !String.IsNullOrEmpty (a.Description.Category) && !a.Description.Category.StartsWith ("required:") &&
                (!a.Description.Category.Contains ("Debug") || ApplicationContext.Debugging);
            });

            var categorized_addins = addins.GroupBy<Addin, string> (a => a.Description.Category)
                                           .Select (c => new {
                                                Addins = c.OrderBy (a => Catalog.GetString (a.Name)).ToList (),
                                                Name = c.Key,
                                                NameLocalized = Catalog.GetString (c.Key) })
                                           .OrderBy (c => c.NameLocalized)
                                           .ToList ();

            tree_view = new TreeView () {
                FixedHeightMode = false,
                HeadersVisible = false,
                SearchColumn = 1,
                RulesHint = true,
                Model = model
            };

            var update_model = new System.Action (() => {
                string search = search_entry.Query;
                bool? enabled = filter_combo.Active > 0 ? (bool?) (filter_combo.Active == 1 ? true : false) : null;
                model.Clear ();
                foreach (var cat in categorized_addins) {
                    var cat_iter = model.AppendValues (false, false, String.Format ("<b>{0}</b>", GLib.Markup.EscapeText (cat.NameLocalized)), null);
                    bool any = false;
                    foreach (var a in cat.Addins.Matching (search)) {
                        if (enabled == null || (a.Enabled == enabled.Value)) {
                            model.AppendValues (cat_iter, true,
                                a.Enabled,
                                String.Format (
                                    "<b>{0}</b>\n<small>{1}</small>",
                                    GLib.Markup.EscapeText (Catalog.GetString (a.Name)),
                                    GLib.Markup.EscapeText (Catalog.GetString (a.Description.Description))),
                                a
                            );
                            any = true;
                        }
                    }

                    if (!any) {
                        model.Remove (ref cat_iter);
                    }
                }
                tree_view.ExpandAll ();
            });

            var txt_cell = new CellRendererText () { WrapMode = Pango.WrapMode.Word };
            tree_view.AppendColumn ("Name", txt_cell , "markup", Columns.Name);

            var check_cell = new CellRendererToggle () { Activatable = true };
            tree_view.AppendColumn ("Enable", check_cell, "visible", Columns.IsAddin, "active", Columns.IsEnabled);
            check_cell.Toggled += (o, a) => {
                TreeIter iter;
                if (model.GetIter (out iter, new TreePath (a.Path))) {
                    var addin = model.GetValue (iter, 3) as Addin;
                    bool enabled = (bool) model.GetValue (iter, 1);
                    addin.Enabled = !enabled;
                    model.SetValue (iter, 1, addin.Enabled);
                    model.Foreach (delegate (ITreeModel current_model, TreePath path, TreeIter current_iter) {
                        var an = current_model.GetValue (current_iter, 3) as Addin;
                        if (an != null) {
                            current_model.SetValue (current_iter, 1, an.Enabled);
                        }
                        return false;
                    });
                }
            };

            update_model ();
            search_entry.Changed += (o, a) => update_model ();
            filter_combo.Changed += (o, a) => update_model ();
//.........这里部分代码省略.........
开发者ID:kelsieflynn,项目名称:banshee,代码行数:101,代码来源:AddinView.cs

示例8: DemoMain

		public DemoMain ()
		{
			window = new Gtk.Window ("TestForm1");
			Gtk.HBox hbox = new Gtk.HBox (false, 0);
			hbox1 = new Gtk.HBox (false, 0);
			Gtk.HBox hbox2 = new Gtk.HBox (false, 0);
			Gtk.HBox hbox3 = new Gtk.HBox (false, 0);
			hbox.Add (hbox1);
			window.SetDefaultSize (600, 400);
			window.DeleteEvent += new DeleteEventHandler (WindowDelete);

			button1 = new Gtk.Button ("button1");
			button1.Clicked += Button1Clicked;
			button2 = new Gtk.Button ("button2");
			button3 = new Gtk.Button ("button3");
			Gtk.Button button4 = new Gtk.Button ("button4");
			button4.Clicked += Button4Clicked;
			Gtk.Button button5 = new Gtk.Button ("button5");
			Gtk.Button button6 = new Gtk.Button ("button6");
			Gtk.Button button7 = new Gtk.Button ("button7");
			button7.Sensitive = false;

			scaleButton1 = new Gtk.ScaleButton (0, 0, 100, 10, new string [0]);

			hbox1.Add (hbox3);
			hbox1.Add (hbox2);
			hbox1.Add (button3);
			hbox1.Add (button2);

			button3.Accessible.Description = "help text 3";
			button3.Sensitive = false;

			label1 = new Gtk.Label ("label1");

			textBox1 = new Gtk.Entry ();
			Gtk.Entry textBox2 = new Gtk.Entry ();
			textBox2.Visibility = false;
			textBox2.Sensitive = false;
			textBox2.IsEditable = false;
			textBox3 = new Gtk.TextView ();
			// TODO: scrollbars
			Gtk.CheckButton checkbox1 = new Gtk.CheckButton ("checkbox1");
			Gtk.CheckButton checkbox2 = new Gtk.CheckButton ("checkbox2");
			checkbox2.Sensitive = false;

			Gtk.TreeStore store = new Gtk.TreeStore (typeof (string), typeof (string));
			Gtk.TreeIter [] iters = new Gtk.TreeIter [2];
			iters [0] = store.AppendNode ();
			store.SetValues (iters [0], "item 1", "item 1 (2)");
			iters [1] = store.AppendNode (iters [0]);
			store.SetValues (iters [1], "item 1a", "item 1a (2)");
			iters [0] = store.AppendNode ();
			store.SetValues (iters [0], "item 2", "item 2 (2)");
			iters [1] = store.AppendNode (iters [0]);
			store.SetValues (iters [1], "item 2a", "item 2a (2)");
			iters [1] = store.AppendNode (iters [0]);
			store.SetValues (iters [1], "item 2b", "item 2b (2)");
			treeView1 = new Gtk.TreeView (store);
			AddTreeViewColumn (treeView1, 0, "column 1");
			treeView1.CollapseAll ();

			treeView2 = new Gtk.TreeView (store);
			AddTreeViewColumn (treeView2, 0, "column 1");
			AddTreeViewColumn (treeView2, 1, "column 2");
			treeView2.CollapseAll ();
			treeView2.Accessible.Name = "treeView2";

			tableStore = new Gtk.TreeStore (typeof (string), typeof (string), typeof (string), typeof (string));
			iters [0] = tableStore.AppendNode ();
			tableStore.SetValues (iters [0], "False", "Alice", "24", "");
			iters [0] = tableStore.AppendNode ();
			tableStore.SetValues (iters [0], "True", "Bob", "28", "");
			dataGridView1 = new Gtk.TreeView (tableStore);
			dataGridView1 = new Gtk.TreeView (tableStore);
			dataGridView1 = new Gtk.TreeView (tableStore);
			AddTreeViewColumn (dataGridView1, 0, "Gender");
			AddTreeViewColumn (dataGridView1, 1, "Name");
			AddTreeViewColumn (dataGridView1, 2, "Age");
			dataGridView1.Accessible.Name = "dataGridView1";

			hboxPanel = new Gtk.HBox ();
			Gtk.Button btnRemoveTextBox = new Gtk.Button ("Remove");
			btnRemoveTextBox.Clicked += RemoveTextBoxClicked;
			Gtk.Button btnAddTextBox = new Gtk.Button ("Add");
			btnAddTextBox.Clicked += AddTextBoxClicked;
			txtCommand = new Gtk.Entry ();
			txtCommand.Accessible.Name = "txtCommand";
			Gtk.Button btnRun = new Gtk.Button ("Run");
			btnRun.Clicked += btnRunClicked;
			hboxPanel.Add (btnRemoveTextBox);
			hboxPanel.Add (btnAddTextBox);

			Gtk.TreeStore treeStore = new Gtk.TreeStore (typeof (string));
			Gtk.TreeIter iter = treeStore.AppendNode ();
			treeStore.SetValue (iter, 0, "Item 0");
			iter = treeStore.AppendNode ();
			treeStore.SetValue (iter, 0, "Item 1");
			listView1 = new Gtk.TreeView (treeStore);
			AddTreeViewColumn (listView1, 0, "items");
			listView1.Accessible.Name = "listView1";
//.........这里部分代码省略.........
开发者ID:mono,项目名称:uia2atk,代码行数:101,代码来源:GtkForm.cs

示例9: Program

        public Program()
        {
            Application.Init();
            this.session = new Battle.Core.BattleSession();
            Console.WriteLine(Environment.CurrentDirectory);
            Glade.XML gxml = new Glade.XML (null, "Battle.battle.glade", "window1", null);
            gxml.Autoconnect (this);

            window1.DeleteEvent += HandleWindow1DeleteEvent;
            statusbar1.Push(0, "Ready");

            this.aboutbutton.Clicked += HandleAboutbuttonClicked;

            this.treeview1.AppendColumn("Source", new CellRendererText (), "text", 0);
            this.treeview1.AppendColumn("Description", new CellRendererText (), "text", 1);

            store = new TreeStore (typeof (string), typeof (string));
            TreeIter i = store.AppendValues("Origins", "0 loaded");
            foreach (Battle.Core.OriginDefinition o in this.session.Origins)
            {
                store.AppendValues(i, o.Name, o.Description);
            }
            store.SetValue(i, 1, string.Format("{0} loaded", this.session.Origins.Length));
            i = store.AppendValues("Species", "0 loaded");
            foreach (Battle.Core.SpeciesDefinition s in this.session.Species)
            {
                store.AppendValues(i, s.Name, s.Description);
            }
            store.SetValue(i, 1, string.Format("{0} loaded", this.session.Species.Length));
            i = store.AppendValues("Skills", "0 loaded");
            foreach (Battle.Core.SkillDefinition d in this.session.Skills)
            {
                store.AppendValues(i, d.Name, d.Description);
            }
            store.SetValue(i, 1, string.Format("{0} loaded", this.session.Skills.Length));
            i = store.AppendValues("Power Sources", "0 loaded");
            foreach (Battle.Core.PowerSource p in this.session.PowerSources)
            {
                store.AppendValues(i, p.Name, p.Description);
            }
            store.SetValue(i, 1, string.Format("{0} loaded", this.session.PowerSources.Length));
            i = store.AppendValues("Powers", "0 loaded");
            foreach (Battle.Core.PowerDefinition p in this.session.Powers)
            {
                store.AppendValues(i, p.Name, p.Description);
            }
            store.SetValue(i, 1, string.Format("{0} loaded", this.session.Powers.Length));

            i = store.AppendValues("Characters", "0 loaded");
            i = store.AppendValues("Adventures", "0 loaded");

            this.treeview1.Model = store;

            this.hpaned1.Position = 256;

            this.viewport1.Add(new Label("Battle"));

            this.treeview1.CursorChanged += HandleTreeview1CursorChanged;

            session.PrepCoreRules();

            window1.ShowAll();

            Application.Run();
        }
开发者ID:sgtnasty,项目名称:battle,代码行数:65,代码来源:Program.cs

示例10: CreateTreeView

    void CreateTreeView()
    {
         //CreateColumns
        TreeViewColumn col = new TreeViewColumn ();
        CellRendererText cell = new CellRendererText ();
        cell.Editable = true;
        col.Title = "Nodes";
        col.PackStart (cell, true);
        col.AddAttribute (cell, "text", 0);
        treeview1.AppendColumn (col);

        TreeViewColumn col2 = new TreeViewColumn ();
        CellRendererText cell2 = new CellRendererText ();
        cell2.Editable = true;
        col2.Title = "Url";
        col2.PackStart (cell2, true);
        col2.AddAttribute (cell2, "text", 1);
        col2.Visible = false;
        treeview1.AppendColumn (col2);
        treeview1.HeadersVisible = false;

        //Add Store
        treestore = new TreeStore (typeof(string), typeof(string));
        treeview1.Model = treestore;        

        cell.Edited +=  (o, args) => {
            Gtk.TreeIter iter;
            treestore.GetIter (out iter, new Gtk.TreePath (args.Path));

            String newvalue = (String)treestore.GetValue (iter, 0);
            Console.WriteLine (newvalue); 

            treestore.SetValue (iter, 0, args.NewText);
            };

            cell2.Edited += (o, args) => {
                Gtk.TreeIter iter;
                treestore.GetIter (out iter, new Gtk.TreePath (args.Path));

                String newvalue = (String)treestore.GetValue (iter, 1);
                Console.WriteLine (newvalue); 

                treestore.SetValue (iter, 1, args.NewText);
            };

            TargetEntry[] ten = new TargetEntry[]{ new TargetEntry ("tree", TargetFlags.App, 1) };

        treeview1.EnableModelDragDest (ten, Gdk.DragAction.Move);
        treeview1.EnableModelDragSource (Gdk.ModifierType.Button1Mask, ten, Gdk.DragAction.Move);
        ShowAll ();

        treeview1.DragDataGet += (o, args) => {
            TreeModel model;
            ((TreeSelection)treeview1.Selection).GetSelected (out model, out SourceIter);
                args.SelectionData.Set (args.SelectionData.Target, 8,   Encoding.UTF8.GetBytes (model.GetValue (SourceIter, 0).ToString ()));
            };

        treeview1.DragDataReceived += Tree_DragDataReceived;

        treeview1.ButtonPressEvent += Tree_ButtonPressEvent;
    }
开发者ID:yaoshuyin,项目名称:TreeNote,代码行数:61,代码来源:MainWindow.cs

示例11: NoteRenameDialog

		public NoteRenameDialog (IList<Note> notes, string oldTitle, Note renamedNote) :
			base (Catalog.GetString ("Rename Note Links?"), renamedNote.Window, 0)
		{
			this.DefaultResponse = ResponseType.Cancel;
			this.BorderWidth = 10;

			var renameButton = (Button)
				AddButton (Catalog.GetString ("_Rename Links"),
				           ResponseType.Yes);
			var dontRenameButton = (Button)
				AddButton (Catalog.GetString ("_Don't Rename Links"),
				           ResponseType.No);

			this.notes = notes;
			notesModel = new Gtk.TreeStore (typeof (bool), typeof (string), typeof (Note));
			foreach (var note in notes)
				notesModel.AppendValues (true, note.Title, note);

			var labelText = Catalog.GetString ("Rename links in other notes from \"<span underline=\"single\">{0}</span>\" " +
			                                   "to \"<span underline=\"single\">{1}</span>\"?\n\n" +
			                                   "If you do not rename the links, " +
			                                   "they will no longer link to anything.");
			var label = new Label ();
			label.UseMarkup = true;
			label.Markup = String.Format (labelText,
			                              GLib.Markup.EscapeText (oldTitle),
			                              GLib.Markup.EscapeText (renamedNote.Title));
			label.LineWrap = true;
			ContentArea.PackStart (label, false, true, 5);

			var notesView = new TreeView (notesModel);
			notesView.SetSizeRequest (-1, 200);
			var toggleCell = new CellRendererToggle ();
			toggleCell.Activatable = true;
			var column = new TreeViewColumn (Catalog.GetString ("Rename Links"),
			                                 toggleCell, "active", 0);
			column.SortColumnId = 0;
			column.Resizable = true;
			notesView.AppendColumn (column);
			toggleCell.Toggled += (o, args) => {
				TreeIter iter;
				if (!notesModel.GetIterFromString (out iter, args.Path))
					return;
				bool val = (bool) notesModel.GetValue (iter, 0);
				notesModel.SetValue (iter, 0, !val);
			};
			column = new TreeViewColumn (Catalog.GetString ("Note Title"),
			                             new CellRendererText (), "text", 1);
			column.SortColumnId = 1;
			column.Resizable = true;
			notesView.AppendColumn (column);

			notesView.RowActivated += (o, args) => {
				TreeIter iter;
				if (!notesModel.GetIter (out iter, args.Path))
					return;
				Note note = (Note) notesModel.GetValue (iter, 2);
				if (note != null) {
					note.Window.Present ();
					NoteFindBar find = note.Window.Find;
					find.ShowAll ();
					find.Visible = true;
					find.SearchText = "\"" + oldTitle + "\"";
				}
			};

			var notesBox = new VBox (false, 5);
			var selectAllButton = new Button ();
			// Translators: This button causes all notes in the list to be selected
			selectAllButton.Label = Catalog.GetString ("Select All");
			selectAllButton.Clicked += (o, e) => {
				notesModel.Foreach ((model, path, iter) => {
					notesModel.SetValue (iter, 0, true);
					return false;
				});
			};
			var selectNoneButton = new Button ();
			// Translators: This button causes all notes in the list to be unselected
			selectNoneButton.Label = Catalog.GetString ("Select None");
			selectNoneButton.Clicked += (o, e) => {
				notesModel.Foreach ((model, path, iter) => {
					notesModel.SetValue (iter, 0, false);
					return false;
				});
			};
			var notesButtonBox = new HButtonBox ();
			notesButtonBox.Add (selectNoneButton);
			notesButtonBox.Add (selectAllButton);
			notesButtonBox.Spacing = 5;
			notesButtonBox.LayoutStyle = ButtonBoxStyle.End;
			var notesScroll = new ScrolledWindow ();
			notesScroll.Add (notesView);
			notesBox.PackStart (notesScroll, true, true, 0);
			notesBox.PackStart (notesButtonBox, false, true, 0);

			var advancedExpander = new Expander (Catalog.GetString ("Ad_vanced"));
			var expandBox = new VBox ();
			expandBox.PackStart (notesBox, true, true, 0);
			alwaysShowDlgRadio = new RadioButton (Catalog.GetString ("Always show this _window"));
			alwaysShowDlgRadio.Clicked += (o, e) => {
//.........这里部分代码省略.........
开发者ID:MatteoNardi,项目名称:Tomboy,代码行数:101,代码来源:NoteRenameDialog.cs


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