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


C# ListStore.SetSortFunc方法代码示例

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


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

示例1: SortFuncListViewDialog

		public SortFuncListViewDialog ()
		{
			Title = "Gtk Sort Func List View Box Dialog";
			WidthRequest = 500;
			HeightRequest = 400;

			var vbox = new HBox ();
			VBox.PackStart (vbox);

			listView = new TreeView ();
			listView.HeadersVisible = false;
			vbox.PackStart (listView);

			listStore = new ListStore (typeof(SortedListViewItem));
			listView.Model = listStore;

//			listStore.SetSortFunc (0,
//				(model, a, b) => string.Compare (GetItem (a).Id, GetItem (b).Id, StringComparison.Ordinal));
			listStore.SetSortFunc (0, SortListItems);

			listStore.SetSortColumnId (0, SortType.Ascending);

//			var textRenderer = new CellRendererText ();
//			listView.AppendColumn ("id", textRenderer,
//				(TreeViewColumn col, CellRenderer cell, TreeModel model, TreeIter iter) => {
//					((CellRendererText)cell).Text = GetItem (iter).Id;
//				}
//			);

			AddItems ();

			ShowAll ();
		}
开发者ID:mrward,项目名称:test-xwt-memory-leak,代码行数:33,代码来源:SortFuncListViewDialog.cs

示例2: RestoreBackupDialog

        public RestoreBackupDialog(Gtk.Window parent)
            : base("Saves", parent)
        {
            this.IconName = "document-revert";

            XML gxml = new XML(null, "MultiMC.GTKGUI.RestoreBackupDialog.glade", "restoreRoot", null);
            gxml.Toplevel = this;
            gxml.Autoconnect(this);

            this.VBox.PackStart(restoreRoot);

            this.WidthRequest = 620;
            this.HeightRequest = 380;

            // set default button states
            btnCancel.Sensitive = true;
            btnOK.Sensitive = false;

            // FIXME: store date/time properly so ordering works.
            backupsStore = new ListStore(typeof(string), typeof(DateTime), typeof(string), typeof(string));
            restoreView.Model = backupsStore;
            restoreView.AppendColumn("Backup name", new CellRendererText(), "text", 0);
            restoreView.AppendColumn("Date", new CellRendererText(), new TreeCellDataFunc(DateTimeCell));
            restoreView.AppendColumn("Hash", new CellRendererText(), "text", 2);
            restoreView.Selection.Mode = SelectionMode.Single;

            // this binds view and model columns together for sorting
            restoreView.Columns[0].SortColumnId = 0;
            restoreView.Columns[1].SortColumnId = 1;
            restoreView.Columns[2].SortColumnId = 2;
            // the date column needs a custom sorting function that can compare DateTime objects
            backupsStore.SetSortFunc(1,new TreeIterCompareFunc(DateTimeTreeIterCompareFunc));
            backupsStore.SetSortColumnId(1,SortType.Ascending); // sort by date
            restoreView.Selection.Changed += (sender, e) =>
            {
                if(restoreView.Selection.CountSelectedRows() != 0)
                {
                    btnOK.Sensitive = true;
                    TreeIter iter;
                    restoreView.Selection.GetSelected(out iter);
                    currentHash = backupsStore.GetValue(iter,3) as string;
                }
                else
                {
                    btnOK.Sensitive = false;
                }
            };
            ShowAll();
        }
开发者ID:Glought,项目名称:MultiMC,代码行数:49,代码来源:RestoreBackupDialog.cs

示例3: SortedColumnListStore

		public SortedColumnListStore (ColumnSchemaCollection columns)
		{
			if (columns == null)
				throw new ArgumentNullException ("columns");
			
			this.columns = columns;
			
			store = new ListStore (typeof (bool), typeof (string), typeof (ColumnSchema));
			store.SetSortColumnId (ColNameIndex, SortType.Ascending);
			store.SetSortFunc (ColNameIndex, new TreeIterCompareFunc (SortName));
			
			foreach (ColumnSchema col in columns)
				AddColumn (col);
			
			columns.ItemAdded += new SortedCollectionItemEventHandler<ColumnSchema> (OnColumnAdded);
			columns.ItemRemoved += new SortedCollectionItemEventHandler<ColumnSchema> (OnColumnRemoved);
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:17,代码来源:SortedColumnListStore.cs

示例4: SortedTableListStore

		public SortedTableListStore (TableSchemaCollection tables)
		{
			if (tables == null)
				throw new ArgumentNullException ("tables");
			
			this.tables = tables;
			
			store = new ListStore (typeof (bool), typeof (string), typeof (TableSchema));
			store.SetSortColumnId (ColNameIndex, SortType.Ascending);
			store.SetSortFunc (ColNameIndex, new TreeIterCompareFunc (SortName));
			
			foreach (TableSchema table in tables)
				AddTable (table);
			
			tables.ItemAdded += new SortedCollectionItemEventHandler<TableSchema> (OnTableAdded);
			tables.ItemRemoved += new SortedCollectionItemEventHandler<TableSchema> (OnTableRemoved);
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:17,代码来源:SortedTableListStore.cs

示例5: ProjectReferencePanel

		public ProjectReferencePanel (SelectReferenceDialog selectDialog) : base (false, 6)
		{
			this.selectDialog = selectDialog;
			
			store = new ListStore (typeof (string), typeof (string), typeof(Project), typeof(bool), typeof(Gdk.Pixbuf), typeof(bool), typeof(string));
			store.SetSortFunc (0, CompareNodes);
			treeView = new TreeView (store);
			
			TreeViewColumn firstColumn = new TreeViewColumn ();
			TreeViewColumn secondColumn = new TreeViewColumn ();
			
			CellRendererToggle tog_render = new CellRendererToggle ();
			tog_render.Xalign = 0;
			tog_render.Toggled += new Gtk.ToggledHandler (AddReference);
			firstColumn.PackStart (tog_render, false);
			firstColumn.AddAttribute (tog_render, "active", 3);
			firstColumn.AddAttribute (tog_render, "visible", 5);

			secondColumn.Title = GettextCatalog.GetString ("Project");
			Gtk.CellRendererPixbuf pix_render = new Gtk.CellRendererPixbuf ();
			secondColumn.PackStart (pix_render, false);
			secondColumn.AddAttribute (pix_render, "pixbuf", 4);
			
			CellRendererText text_render = new CellRendererText ();
			secondColumn.PackStart (text_render, true);
			secondColumn.AddAttribute (text_render, "text", 0);
			secondColumn.AddAttribute (text_render, "foreground", 6);
			
			treeView.AppendColumn (firstColumn);
			treeView.AppendColumn (secondColumn);
			treeView.AppendColumn (GettextCatalog.GetString ("Directory"), new CellRendererText (), "markup", 1);
			
			ScrolledWindow sc = new ScrolledWindow ();
			sc.ShadowType = Gtk.ShadowType.In;
			sc.Add (treeView);
			PackStart (sc, true, true, 0);
			
			store.SetSortColumnId (0, SortType.Ascending);
			ShowAll ();
			
			BorderWidth = 6;
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:42,代码来源:ProjectReferencePanel.cs

示例6: GacReferencePanel

        public GacReferencePanel (SelectReferenceDialog selectDialog)
        {
            this.selectDialog = selectDialog;

            store = new ListStore (typeof (string), typeof (string), typeof (SystemAssembly), typeof (bool), typeof (string), typeof (string));
            treeView = new TreeView (store);

            TreeViewColumn firstColumn = new TreeViewColumn ();
            CellRendererToggle tog_render = new CellRendererToggle ();
            tog_render.Toggled += new Gtk.ToggledHandler (AddReference);
            firstColumn.PackStart (tog_render, false);
            firstColumn.AddAttribute (tog_render, "active", 3);

            treeView.AppendColumn (firstColumn);

            TreeViewColumn secondColumn = new TreeViewColumn ();
            secondColumn.Title = GettextCatalog.GetString ("Assembly");
            CellRendererPixbuf crp = new CellRendererPixbuf ();
            secondColumn.PackStart (crp, false);
            crp.StockId = "md-package";

            CellRendererText text_render = new CellRendererText ();
            secondColumn.PackStart (text_render, true);
            secondColumn.AddAttribute (text_render, "text", 0);

            treeView.AppendColumn (secondColumn);

            treeView.AppendColumn (GettextCatalog.GetString ("Version"), new CellRendererText (), "text", 1);
            treeView.AppendColumn (GettextCatalog.GetString ("Package"), new CellRendererText (), "text", 5);

            treeView.Columns[1].Resizable = true;

            store.SetSortColumnId (0, SortType.Ascending);
            store.SetSortFunc (0, new TreeIterCompareFunc (Sort));

            ScrolledWindow sc = new ScrolledWindow ();
            sc.ShadowType = Gtk.ShadowType.In;
            sc.Add (treeView);
            this.PackStart (sc, true, true, 0);
            ShowAll ();
            BorderWidth = 6;
        }
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:42,代码来源:GacReferencePanel.cs

示例7: OpenTaskView

        public OpenTaskView()
        {
            store = new Gtk.ListStore (
                typeof (Gdk.Pixbuf), // image
                typeof (int),        // line
                typeof (string),     // desc
                typeof (string),     // file
                typeof (string),     // path
                typeof (Task),       // task
                typeof (bool),       // read?
                typeof (bool),       // marked?
                typeof (int));       // read? -- use Pango weight

            TreeIterCompareFunc sortFunc = new TreeIterCompareFunc (TaskSortFunc);
            store.SetSortFunc (COL_TASK, sortFunc);
            store.DefaultSortFunc = sortFunc;
            store.SetSortColumnId (COL_TASK, SortType.Ascending);

            view = new Gtk.TreeView (store);
            view.RulesHint = true;
            view.PopupMenu += new PopupMenuHandler (OnPopupMenu);
            view.ButtonPressEvent += new ButtonPressEventHandler (OnButtonPressed);
            view.HeadersClickable = true;
            AddColumns ();

            sw = new Gtk.ScrolledWindow ();
            sw.ShadowType = ShadowType.In;
            sw.Add (view);

            Runtime.TaskService.TasksChanged     += (EventHandler) Runtime.DispatchService.GuiDispatch (new EventHandler (ShowResults));
            Runtime.TaskService.TaskAdded        += (TaskEventHandler) Runtime.DispatchService.GuiDispatch (new TaskEventHandler (TaskAdded));
            Runtime.ProjectService.EndBuild      += (ProjectCompileEventHandler) Runtime.DispatchService.GuiDispatch (new ProjectCompileEventHandler (SelectTaskView));
            Runtime.ProjectService.CombineOpened += (CombineEventHandler) Runtime.DispatchService.GuiDispatch (new CombineEventHandler (OnCombineOpen));
            Runtime.ProjectService.CombineClosed += (CombineEventHandler) Runtime.DispatchService.GuiDispatch (new CombineEventHandler (OnCombineClosed));
            view.RowActivated            += new RowActivatedHandler (OnRowActivated);
            Control.ShowAll ();
        }
开发者ID:slluis,项目名称:monodevelop-prehistoric,代码行数:37,代码来源:OpenTaskView.cs

示例8: UpdateFromCatalog

		void UpdateFromCatalog ()
		{
			filter = this.searchEntryFilter.Entry.Text;
			if (!IsCaseSensitive && filter != null)
				filter = filter.ToUpper ();
			if (RegexSearch) {
				try {
					RegexOptions options = RegexOptions.Compiled;
					if (!IsCaseSensitive)
						options |= RegexOptions.IgnoreCase;
					regex = new Regex (filter, options);
				} catch (Exception e) {
					IdeApp.Workbench.StatusBar.ShowError (e.Message);
					this.searchEntryFilter.Entry.ModifyBase (StateType.Normal, errorColor);
					return;
				}
			}
			this.searchEntryFilter.Entry.ModifyBase (StateType.Normal, Style.Base (StateType.Normal));
			
			int found = 0;
			ListStore newStore = new ListStore (typeof(CatalogEntry));
			
			try {
				foreach (CatalogEntry entry in catalog) {
					if (!ShouldFilter (entry, filter)) {
						newStore.AppendValues (entry);
						found++;
					}
				}
			} catch (Exception) {
				
			}
			
			newStore.SetSortFunc (0, delegate (TreeModel model, TreeIter iter1, TreeIter iter2) {
				CatalogEntry entry1 = (CatalogEntry)model.GetValue (iter1, 0);
				CatalogEntry entry2 = (CatalogEntry)model.GetValue (iter2, 0);
				return GetTypeSortIndicator (entry1).CompareTo (GetTypeSortIndicator (entry2));
			});
			newStore.SetSortFunc (1, delegate (TreeModel model, TreeIter iter1, TreeIter iter2) {
				CatalogEntry entry1 = (CatalogEntry)model.GetValue (iter1, 0);
				CatalogEntry entry2 = (CatalogEntry)model.GetValue (iter2, 0);
				return entry1.String.CompareTo (entry2.String);
			});
			newStore.SetSortFunc (2, delegate (TreeModel model, TreeIter iter1, TreeIter iter2) {
				CatalogEntry entry1 = (CatalogEntry)model.GetValue (iter1, 0);
				CatalogEntry entry2 = (CatalogEntry)model.GetValue (iter2, 0);
				return entry1.GetTranslation (0).CompareTo (entry2.GetTranslation (0));
			});
			IdeApp.Workbench.StatusBar.ShowMessage (string.Format (GettextCatalog.GetPluralString ("Found {0} catalog entry.", "Found {0} catalog entries.", found), found));
			store.Dispose ();
			treeviewEntries.Model = store = newStore;
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:52,代码来源:POEditorWidget.cs

示例9: SearchResultWidget

		public SearchResultWidget ()
		{
			var vbox = new VBox ();
			var toolbar = new Toolbar () {
				Orientation = Orientation.Vertical,
				IconSize = IconSize.Menu,
				ToolbarStyle = ToolbarStyle.Icons,
			};
			this.PackStart (vbox, true, true, 0);
			this.PackStart (toolbar, false, false, 0);
			labelStatus = new Label () {
				Xalign = 0,
				Justify = Justification.Left,
			};
			var hpaned = new HPaned ();
			vbox.PackStart (hpaned, true, true, 0);
			vbox.PackStart (labelStatus, false, false, 0);
			var resultsScroll = new CompactScrolledWindow ();
			hpaned.Pack1 (resultsScroll, true, true);
			scrolledwindowLogView = new CompactScrolledWindow ();
			hpaned.Pack2 (scrolledwindowLogView, true, true);
			textviewLog = new TextView () {
				Editable = false,
			};
			scrolledwindowLogView.Add (textviewLog);
			
			store = new ListStore (typeof (SearchResult),
				typeof (bool) // didRead
				);
			
			treeviewSearchResults = new PadTreeView () {
				Model = store,
				HeadersClickable = true,
				RulesHint = true,
			};

			treeviewSearchResults.Selection.Mode = Gtk.SelectionMode.Multiple;
			resultsScroll.Add (treeviewSearchResults);

			var projectColumn = new TreeViewColumn {
				Resizable = true,
				SortColumnId = 1,
				Title = GettextCatalog.GetString ("Project"),
				Sizing = TreeViewColumnSizing.Fixed,
				FixedWidth = 100
			};

			var projectPixbufRenderer = new CellRendererImage ();
			projectColumn.PackStart (projectPixbufRenderer, false);
			projectColumn.SetCellDataFunc (projectPixbufRenderer, ResultProjectIconDataFunc);

			var renderer = treeviewSearchResults.TextRenderer;
			renderer.Ellipsize = Pango.EllipsizeMode.End;
			projectColumn.PackStart (renderer, true);
			projectColumn.SetCellDataFunc (renderer, ResultProjectDataFunc);
			treeviewSearchResults.AppendColumn (projectColumn);

			var fileNameColumn = new TreeViewColumn {
				Resizable = true,
				SortColumnId = 2,
				Title = GettextCatalog.GetString ("File"),
				Sizing = TreeViewColumnSizing.Fixed,
				FixedWidth = 200
			};

			var fileNamePixbufRenderer = new CellRendererImage ();
			fileNameColumn.PackStart (fileNamePixbufRenderer, false);
			fileNameColumn.SetCellDataFunc (fileNamePixbufRenderer, FileIconDataFunc);
			
			fileNameColumn.PackStart (renderer, true);
			fileNameColumn.SetCellDataFunc (renderer, FileNameDataFunc);
			treeviewSearchResults.AppendColumn (fileNameColumn);


			TreeViewColumn textColumn = treeviewSearchResults.AppendColumn (GettextCatalog.GetString ("Text"),
				renderer, ResultTextDataFunc);
			textColumn.Resizable = true;
			textColumn.Sizing = TreeViewColumnSizing.Fixed;
			textColumn.FixedWidth = 300;

			pathColumn = treeviewSearchResults.AppendColumn (GettextCatalog.GetString ("Path"),
				                            renderer, ResultPathDataFunc);
			pathColumn.SortColumnId = 3;
			pathColumn.Resizable = true;
			pathColumn.Sizing = TreeViewColumnSizing.Fixed;
			pathColumn.FixedWidth = 500;

			store.DefaultSortFunc = DefaultSortFunc;
			store.SetSortFunc (1, CompareProjectFileNames);
			store.SetSortFunc (2, CompareFileNames);
			store.SetSortFunc (3, CompareFilePaths);

			treeviewSearchResults.RowActivated += TreeviewSearchResultsRowActivated;
			
			buttonStop = new ToolButton (new ImageView (Gui.Stock.Stop, Gtk.IconSize.Menu), null) { Sensitive = false };
			buttonStop.Clicked += ButtonStopClicked;
			buttonStop.TooltipText = GettextCatalog.GetString ("Stop");
			toolbar.Insert (buttonStop, -1);

			var buttonClear = new ToolButton (new ImageView (Gui.Stock.Clear, Gtk.IconSize.Menu), null);
//.........这里部分代码省略.........
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:101,代码来源:SearchResultWidget.cs

示例10: VolumeView

        public VolumeView()
        {
            iconCache = new IconCache(this);
            sortProperty = VolumeSortProperty.VolumeID;
            toggleColumn = false;

            //
            // init columns
            //
            TreeViewColumn col;

            col = new TreeViewColumn(string.Empty, new CellRendererPixbuf(), "pixbuf", 0);
            col.Expand = false;
            AppendColumn(col);

            col = new TreeViewColumn(string.Empty, new CellRendererText(), "markup", 1);
            col.Expand = true;
            AppendColumn(col);

            //
            // setup store
            //
            ListStore store = new Gtk.ListStore(typeof(Gdk.Pixbuf),
                                                typeof(string),
                                                /* Volume - not visible */
                                                typeof(Volume));

            // must be assignet before
            // assinging the sort func
            this.Model = store;

            Gtk.TreeIterCompareFunc sortfunc = delegate(TreeModel m, TreeIter a, TreeIter b) {
                Volume vol_a = GetVolume(a);
                Volume vol_b = GetVolume(b);

                if (vol_a == null || vol_b == null)
                    return 0;

                switch (sortProperty) {
                    case VolumeSortProperty.Added:
                        return Math.Sign(vol_a.Added.Subtract(vol_b.Added).Ticks);
                    case VolumeSortProperty.ArchiveNo:
                        return Sorting.NatCompare(vol_a.ArchiveNo, vol_b.ArchiveNo);
                    case VolumeSortProperty.Category:
                        return string.Compare(vol_a.Category, vol_b.Category);
                    case VolumeSortProperty.DriveType:
                        return Math.Sign(vol_a.DriveType - vol_b.DriveType);
                    case VolumeSortProperty.Title:
                        return string.Compare(vol_a.Title, vol_b.Title);
                    case VolumeSortProperty.VolumeID:
                        return Math.Sign(vol_a.VolumeID - vol_b.VolumeID);
                    default:
                        throw new ArgumentException("Invalid VolumeSortProperty");
                }

                return 0;
            };

            store.SetSortFunc(0, sortfunc);
            store.SetSortFunc(1, sortfunc);

            // set initial sorting
            /* Sort(sortProperty, true); */
        }
开发者ID:pulb,项目名称:basenji,代码行数:64,代码来源:VolumeView.cs

示例11: Initialize


//.........这里部分代码省略.........
			errorBtn.Toggled += new EventHandler (FilterChanged);
			errorBtn.TooltipText = errorTipText;
			UpdateErrorsNum();
			toolbar.Add (errorBtn);
			
			warnBtn = new ToggleButton ();
			warnBtn.Active = (bool)PropertyService.Get (showWarningsPropertyName, true);
			string warnTipText;
			if ((InternalLog.EnabledLoggingLevel & EnabledLoggingLevel.Warn) != EnabledLoggingLevel.Warn) {
				warnBtn.Sensitive = false;
				warnTipText = GettextCatalog.GetString ("Logging of warnings is not enabled");
			} else {
				warnTipText = GettextCatalog.GetString ("Show warnings");
			}
			warnBtn.Image = new Gtk.Image (Gtk.Stock.DialogWarning, Gtk.IconSize.Menu);
			warnBtn.Image.Show ();
			warnBtn.Toggled += new EventHandler (FilterChanged);
			warnBtn.TooltipText = warnTipText;
			UpdateWarningsNum();
			toolbar.Add (warnBtn);
			
			msgBtn = new ToggleButton ();
			msgBtn.Active = (bool)PropertyService.Get (showMessagesPropertyName, true);
			string msgTipText;
			if ((InternalLog.EnabledLoggingLevel & EnabledLoggingLevel.Info) != EnabledLoggingLevel.Info) {
				msgBtn.Sensitive = false;
				msgTipText = GettextCatalog.GetString ("Logging of informational messages is not enabled");
			} else {
				msgTipText = GettextCatalog.GetString ("Show messages");
			}
			msgBtn.Image = new Gtk.Image (Gtk.Stock.DialogInfo, Gtk.IconSize.Menu);
			msgBtn.Image.Show ();
			msgBtn.Toggled += new EventHandler (FilterChanged);
			msgBtn.TooltipText = msgTipText;
			UpdateMessagesNum();
			toolbar.Add (msgBtn);
			
			debugBtn = new ToggleButton ();
			debugBtn.Active = (bool)PropertyService.Get (showDebugPropertyName, true);
			string debugTipText;
			if ((InternalLog.EnabledLoggingLevel & EnabledLoggingLevel.Debug) != EnabledLoggingLevel.Debug) {
				debugBtn.Sensitive = false;
				debugTipText = GettextCatalog.GetString ("Logging of debug messages is not enabled");
			} else {
				debugTipText = GettextCatalog.GetString ("Show debug");
			}
			debugBtn.Image = new Gtk.Image (Gtk.Stock.DialogQuestion, Gtk.IconSize.Menu);
			debugBtn.Image.Show ();
			debugBtn.Toggled += new EventHandler (FilterChanged);
			debugBtn.TooltipText = debugTipText;
			UpdateDebugNum();
			toolbar.Add (debugBtn);
			
			toolbar.Add (new SeparatorToolItem ());
			
			Gtk.Button clearBtn = new Gtk.Button (new Gtk.Image (Gtk.Stock.Clear, Gtk.IconSize.Menu));
			clearBtn.Clicked += new EventHandler (OnClearList);
			toolbar.Add (clearBtn);
			toolbar.ShowAll ();

			// Content
			
			store = new Gtk.ListStore (typeof (Gdk.Pixbuf),      // image - type
			                           typeof (string),          // desc
			                           typeof (string),          // time
			                           typeof (string),          // type string
			                           typeof (LogMessage));     // message

			TreeModelFilterVisibleFunc filterFunct = new TreeModelFilterVisibleFunc (FilterTaskTypes);
			filter = new TreeModelFilter (store, null);
            filter.VisibleFunc = filterFunct;
			
			view = new MonoDevelop.Ide.Gui.Components.PadTreeView (new Gtk.TreeModelSort (filter));
			view.RulesHint = true;
			view.PopupMenu += new PopupMenuHandler (OnPopupMenu);
			view.ButtonPressEvent += new ButtonPressEventHandler (OnButtonPressed);
			view.HeadersClickable = true;
			view.Selection.Mode = SelectionMode.Multiple;
			
			AddColumns ();
			
			sw = new Gtk.ScrolledWindow ();
			sw.ShadowType = ShadowType.None;
			sw.Add (view);
			
			LoggingService.AddLogger (this);
						
			iconWarning = sw.RenderIcon (Gtk.Stock.DialogWarning, Gtk.IconSize.Menu, "");
			iconError = sw.RenderIcon (Gtk.Stock.DialogError, Gtk.IconSize.Menu, "");
			iconInfo = sw.RenderIcon (Gtk.Stock.DialogInfo, Gtk.IconSize.Menu, "");
			iconDebug = sw.RenderIcon (Gtk.Stock.DialogQuestion, Gtk.IconSize.Menu, "");
			
			control = sw;
			sw.ShowAll ();
			
			Refresh ();

			store.SetSortFunc ((int)Columns.Time, TimeSortFunc);
			((TreeModelSort)view.Model).SetSortColumnId ((int)Columns.Time, SortType.Descending);
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:101,代码来源:InternalLogPad.cs

示例12: UserTasksView

		public UserTasksView ()
		{
			highPrioColor = StringToColor ((string)PropertyService.Get ("Monodevelop.UserTasksHighPrioColor", ""));
			normalPrioColor = StringToColor ((string)PropertyService.Get ("Monodevelop.UserTasksNormalPrioColor", ""));
			lowPrioColor = StringToColor ((string)PropertyService.Get ("Monodevelop.UserTasksLowPrioColor", ""));
			
			store = new ListStore (
				typeof (string),     // priority
				typeof (bool),		 // completed 
				typeof (string),     // desc
				typeof (Task),	 // user task
				typeof (Gdk.Color),  // foreground color
				typeof (int));		 // font style
			
			view = new MonoDevelop.Ide.Gui.Components.PadTreeView (store);
			view.RulesHint = true;
			view.SearchColumn = (int)Columns.Description;
			view.Selection.Changed += new EventHandler (SelectionChanged);
			view.PopupMenu += new PopupMenuHandler (OnUserPopupMenu);
			view.ButtonPressEvent += new ButtonPressEventHandler (OnUserButtonPressed);
			
			TreeViewColumn col;
			
			CellRendererComboBox cellRendPriority = new CellRendererComboBox ();
			cellRendPriority.Values = priorities;
			cellRendPriority.Editable = true;
			cellRendPriority.Changed += new ComboSelectionChangedHandler (UserTaskPriorityEdited);
			col = view.AppendColumn (GettextCatalog.GetString ("Priority"), cellRendPriority, "text", Columns.Priority, "foreground-gdk", Columns.Foreground, "weight", Columns.Bold);
			col.Clickable = true;
			col.Resizable = true;
			TreeIterCompareFunc sortFunc = new TreeIterCompareFunc (PrioirtySortFunc);
			store.SetSortFunc ((int)Columns.Priority, sortFunc);
			col.Clicked += new EventHandler (UserTaskPriorityResort);
			
			CellRendererToggle cellRendCompleted = new CellRendererToggle ();
			cellRendCompleted.Toggled += new ToggledHandler (UserTaskCompletedToggled);
			cellRendCompleted.Activatable = true;
			col = view.AppendColumn (String.Empty, cellRendCompleted, "active", Columns.Completed);
			col.Clickable = true;
			col.Clicked += new EventHandler (UserTaskCompletedResort);
			
			cellRendDesc = view.TextRenderer;
			cellRendDesc.Editable = true;
			cellRendDesc.Edited += new EditedHandler (UserTaskDescEdited);
			col = view.AppendColumn (GettextCatalog.GetString ("Description"), cellRendDesc, "text", Columns.Description, "strikethrough", Columns.Completed, "foreground-gdk", Columns.Foreground, "weight", Columns.Bold);
			col.Clickable = true;
			col.Resizable = true;
			col.Clicked += new EventHandler (UserTaskDescResort);
			
			newButton = new Button ();
			newButton.Image = new Gtk.Image (Gtk.Stock.New, IconSize.Button);
			newButton.Label = GettextCatalog.GetString ("New Task");
			newButton.ImagePosition = PositionType.Left;
			newButton.Clicked += new EventHandler (NewUserTaskClicked); 
			newButton.TooltipText = GettextCatalog.GetString ("Create New Task");
			
			delButton = new Button (new Gtk.Image (Gtk.Stock.Delete, IconSize.Button));
			delButton.Clicked += new EventHandler (DeleteUserTaskClicked); 
			delButton.TooltipText = GettextCatalog.GetString ("Delete Task");

			TaskService.UserTasks.TasksChanged += (TaskEventHandler) DispatchService.GuiDispatch (new TaskEventHandler (UserTasksChanged));
			TaskService.UserTasks.TasksAdded += (TaskEventHandler) DispatchService.GuiDispatch (new TaskEventHandler (UserTasksChanged));
			TaskService.UserTasks.TasksRemoved += (TaskEventHandler) DispatchService.GuiDispatch (new TaskEventHandler (UserTasksChanged));
			
			IdeApp.Workspace.FirstWorkspaceItemOpened += CombineOpened;
			IdeApp.Workspace.LastWorkspaceItemClosed += CombineClosed;
			PropertyService.PropertyChanged += (EventHandler<PropertyChangedEventArgs>) DispatchService.GuiDispatch (new EventHandler<PropertyChangedEventArgs> (OnPropertyUpdated));	
			ValidateButtons ();
			// Initialize with existing tags.
			UserTasksChanged (this, null);
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:71,代码来源:UserTasksView.cs

示例13: iFolderData

 private iFolderData()
 {
     simiasManager = Util.GetSimiasManager();
        try
        {
     Debug.PrintLine(String.Format("Url = {0}", simiasManager.WebServiceUri));
     ifws = new iFolderWebService();
     ifws.Url =
      simiasManager.WebServiceUri.ToString() +
      "/iFolder.asmx";
     LocalService.Start(ifws, simiasManager.WebServiceUri, simiasManager.DataPath);
        }
        catch(Exception e)
        {
     ifws = null;
     throw new Exception("Unable to create ifolder web service");
        }
        try
        {
     simws = new SimiasWebService();
     simws.Url =
      simiasManager.WebServiceUri.ToString() +
      "/Simias.asmx";
     LocalService.Start(simws, simiasManager.WebServiceUri, simiasManager.DataPath);
        }
        catch(Exception e)
        {
     simws = null;
     throw new Exception("Unable to create simias web service");
        }
        domainController = DomainController.GetDomainController();
        iFolderListStore = new ListStore(typeof(iFolderHolder));
        iFolderListStore.SetSortFunc(
     0,
     new TreeIterCompareFunc(TreeModelSortFunction));
        iFolderListStore.SetSortColumnId(0, SortType.Ascending);
        ifolderIters = new Hashtable();
        deletediFolders = new Hashtable();
        if (domainController != null)
        {
     domainController.DomainAdded +=
      new DomainAddedEventHandler(OnDomainAddedEvent);
     domainController.DomainDeleted +=
      new DomainDeletedEventHandler(OnDomainDeletedEvent);
     domainController.DomainLoggedOut +=
      new DomainLoggedOutEventHandler(OnDomainLoggedOutEvent);
        }
        eventBroker = SimiasEventBroker.GetSimiasEventBroker();
        if (eventBroker != null)
        {
     eventBroker.CollectionSyncEventFired += OniFolderSyncEvent;
     eventBroker.FileSyncEventFired += OniFolderFileSyncEvent;
        }
 }
开发者ID:RoDaniel,项目名称:featurehouse,代码行数:54,代码来源:iFolderData.cs

示例14: SearchResultWidget

		public SearchResultWidget ()
		{
			this.Build ();
			
			store = new ListStore (typeof (SearchResult), 
			                       typeof (bool)          // didRead
			                       );
			treeviewSearchResults.Model = store;
			treeviewSearchResults.Selection.Mode = Gtk.SelectionMode.Multiple;
			treeviewSearchResults.HeadersClickable = true;
			treeviewSearchResults.PopupMenu += OnPopupMenu;
			treeviewSearchResults.ButtonPressEvent += HandleButtonPressEvent;
			treeviewSearchResults.RulesHint = true;
			
			TreeViewColumn fileNameColumn = new TreeViewColumn ();
			fileNameColumn.Resizable = true;
			fileNameColumn.SortColumnId  = 0;
			fileNameColumn.Title = GettextCatalog.GetString ("File");
			var fileNamePixbufRenderer = new CellRendererPixbuf ();
			fileNameColumn.PackStart (fileNamePixbufRenderer, false);
			fileNameColumn.SetCellDataFunc (fileNamePixbufRenderer, new Gtk.TreeCellDataFunc (FileIconDataFunc));
			
			CellRendererText fileNameRenderer = new CellRendererText ();
			fileNameColumn.PackStart (fileNameRenderer, true);
			fileNameColumn.SetCellDataFunc (fileNameRenderer, new Gtk.TreeCellDataFunc (FileNameDataFunc));
			treeviewSearchResults.AppendColumn (fileNameColumn);
			
			TreeViewColumn lineColumn = treeviewSearchResults.AppendColumn (GettextCatalog.GetString ("Line"), new Gtk.CellRendererText (), new Gtk.TreeCellDataFunc (ResultLineDataFunc));
			lineColumn.SortColumnId = 1;
			
			TreeViewColumn textColumn = treeviewSearchResults.AppendColumn (GettextCatalog.GetString ("Text"), new Gtk.CellRendererText (), new Gtk.TreeCellDataFunc (ResultTextDataFunc));
			textColumn.SortColumnId = 2;
			textColumn.Resizable = true;
			
			TreeViewColumn pathColumn = treeviewSearchResults.AppendColumn (GettextCatalog.GetString ("Path"), new Gtk.CellRendererText (), new Gtk.TreeCellDataFunc (ResultPathDataFunc));
			pathColumn.SortColumnId = 3;
			pathColumn.Resizable = true;
			store.SetSortFunc (0, new TreeIterCompareFunc (CompareFileNames));
			store.SetSortFunc (1, new TreeIterCompareFunc (CompareLineNumbers));
			store.SetSortFunc (3, new TreeIterCompareFunc (CompareFilePaths));
			
			treeviewSearchResults.RowActivated += TreeviewSearchResultsRowActivated;
			
			buttonStop = new ToolButton ("gtk-stop");
			buttonStop.Sensitive = false;
			buttonStop.Clicked += ButtonStopClicked;
			
			buttonStop.TooltipText = GettextCatalog.GetString ("Stop");
			toolbar.Insert (buttonStop, -1);

			ToolButton buttonClear = new ToolButton ("gtk-clear");
			buttonClear.Clicked += ButtonClearClicked;
			buttonClear.TooltipText = GettextCatalog.GetString ("Clear results");
			toolbar.Insert (buttonClear, -1);
			
			ToggleToolButton buttonOutput = new ToggleToolButton (MonoDevelop.Ide.Gui.Stock.OutputIcon);
			buttonOutput.Clicked += ButtonOutputClicked;
			buttonOutput.TooltipText = GettextCatalog.GetString ("Show output");
			toolbar.Insert (buttonOutput, -1);
			
			buttonPin = new ToggleToolButton ("md-pin-up");
			buttonPin.Clicked += ButtonPinClicked;
			buttonPin.TooltipText = GettextCatalog.GetString ("Pin results pad");
			toolbar.Insert (buttonPin, -1);
			
			store.SetSortColumnId (3, SortType.Ascending);
			ShowAll ();
			
			scrolledwindowLogView.Hide ();
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:70,代码来源:SearchResultWidget.cs

示例15: InitPackTreeView

        private void InitPackTreeView()
        {
            packStore = new TreeStore(typeof(Packer.Item));

            folderStore = new ListStore(typeof(Gdk.Pixbuf), typeof(string), typeof(Packer.Item));
            packTreeView.Model = folderStore;
            packTreeView.HeadersVisible = false;
            packTreeView.Selection.Mode = SelectionMode.Multiple;
            packTreeView.EnableSearch = true;
            packTreeView.SearchColumn = 1;

            packTreeView.AppendColumn("Icon", new CellRendererPixbuf(), "pixbuf", 0);
            packTreeView.AppendColumn("Name", new CellRendererText(), "text", 1);

            folderStore.SetSortFunc(0, (model, a, b) =>
            {
                Packer.Item itemA = model.GetValue(a, 2) as Packer.Item;
                Packer.Item itemB = model.GetValue(b, 2) as Packer.Item;

                var ItemCost = new Func<Packer.Item, int>(item =>
                {
                    return (null == item ? 0 : (item.IsFolder ? (item.IsRoot ? 3 : 2) : 1));
                });

                if (ItemCost(itemA) > ItemCost(itemB))
                    return -1;
                else if (ItemCost(itemA) < ItemCost(itemB))
                    return 1;
                else if (null == itemA && null == itemB)
                    return 0;
                else
                    return itemA.Name.CompareTo(itemB.Name);
            });
            folderStore.SetSortColumnId(0, SortType.Ascending);
        }
开发者ID:whztt07,项目名称:DGLE,代码行数:35,代码来源:MainWindow.cs


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