コード例 #1
0
		static NotebookManager ()
		{
			notebooks = new Gtk.ListStore (typeof (Notebook));

			sortedNotebooks = new Gtk.TreeModelSort (notebooks);
			sortedNotebooks.SetSortFunc (0, new Gtk.TreeIterCompareFunc (CompareNotebooksSortFunc));
			sortedNotebooks.SetSortColumnId (0, Gtk.SortType.Ascending);
			
			filteredNotebooks = new Gtk.TreeModelFilter (sortedNotebooks, null);
			filteredNotebooks.VisibleFunc = FilterNotebooks;
			
			AllNotesNotebook allNotesNotebook = new AllNotesNotebook ();
			Gtk.TreeIter iter = notebooks.Append ();
			notebooks.SetValue (iter, 0, allNotesNotebook);
			
			UnfiledNotesNotebook unfiledNotesNotebook = new UnfiledNotesNotebook ();
			iter = notebooks.Append ();
			notebooks.SetValue (iter, 0, unfiledNotesNotebook);

			// <summary>
			// The key for this dictionary is Notebook.Name.ToLower ().
			// </summary>
			notebookMap = new Dictionary<string, Gtk.TreeIter> ();
			
			// Load the notebooks now if the notes have already been loaded
			// or wait for the NotesLoaded event otherwise.
			if (Tomboy.DefaultNoteManager.Initialized)
				LoadNotebooks ();
			else
				Tomboy.DefaultNoteManager.NotesLoaded += OnNotesLoaded;
		}
コード例 #2
0
 static void RowDeleted_cb(IntPtr inst, IntPtr path)
 {
     try {
         Gtk.TreeModelFilter __obj = GLib.Object.GetObject(inst, false) as Gtk.TreeModelFilter;
         __obj.OnRowDeleted(path == IntPtr.Zero ? null : (Gtk.TreePath)GLib.Opaque.GetOpaque(path, typeof(Gtk.TreePath), false));
     } catch (Exception e) {
         GLib.ExceptionManager.RaiseUnhandledException(e, false);
     }
 }
コード例 #3
0
ファイル: NotebookManager.cs プロジェクト: shubhtr/tomboy-1
        static NotebookManager()
        {
            notebooks = new Gtk.ListStore(typeof(Notebook));

            sortedNotebooks = new Gtk.TreeModelSort(notebooks);
            sortedNotebooks.SetSortFunc(0, new Gtk.TreeIterCompareFunc(CompareNotebooksSortFunc));
            sortedNotebooks.SetSortColumnId(0, Gtk.SortType.Ascending);

            filteredNotebooks             = new Gtk.TreeModelFilter(sortedNotebooks, null);
            filteredNotebooks.VisibleFunc = FilterNotebooks;

            AllNotesNotebook allNotesNotebook = new AllNotesNotebook();

            Gtk.TreeIter iter = notebooks.Append();
            notebooks.SetValue(iter, 0, allNotesNotebook);

            UnfiledNotesNotebook unfiledNotesNotebook = new UnfiledNotesNotebook();

            iter = notebooks.Append();
            notebooks.SetValue(iter, 0, unfiledNotesNotebook);

            // <summary>
            // The key for this dictionary is Notebook.Name.ToLower ().
            // </summary>
            notebookMap = new Dictionary <string, Gtk.TreeIter> ();

            // Load the notebooks now if the notes have already been loaded
            // or wait for the NotesLoaded event otherwise.
            if (Tomboy.DefaultNoteManager.Initialized)
            {
                LoadNotebooks();
            }
            else
            {
                Tomboy.DefaultNoteManager.NotesLoaded += OnNotesLoaded;
            }
        }
コード例 #4
0
ファイル: GtkListView.cs プロジェクト: xush1611/GuiTestSharp
        internal void Fill(List <T> values)
        {
            if (values == null)
            {
                return;
            }

            Gtk.ListStore listStore = new Gtk.ListStore(typeof(T));

            values.ForEach((val) => listStore.AppendValues(val));

            mModelFilter             = new Gtk.TreeModelFilter(listStore, null);
            mModelFilter.VisibleFunc = mVisibleFunc;

            mModelSort = new Gtk.TreeModelSort(mModelFilter);
            SetSortFunctions(mModelSort, mSortFunctionByColumn);

            if (View.Model != null)
            {
                (View.Model as Gtk.TreeModelSort).Dispose();
            }

            View.Model = mModelSort;
        }
コード例 #5
0
    public TreeViewExample()
    {
        // Create a Window
        Gtk.Window window = new Gtk.Window("TreeView Example");
        window.SetSizeRequest(500, 200);

        // Create an Entry used to filter the tree
        filterEntry = new Gtk.Entry();

        // Fire off an event when the text in the Entry changes
        filterEntry.Changed += OnFilterEntryTextChanged;

        // Create a nice label describing the Entry
        Gtk.Label filterLabel = new Gtk.Label("Artist Search:");

        // Put them both into a little box so they show up side by side
        Gtk.HBox filterBox = new Gtk.HBox();
        filterBox.PackStart(filterLabel, false, false, 5);
        filterBox.PackStart(filterEntry, true, true, 5);

        // Create our TreeView
        Gtk.TreeView tree = new Gtk.TreeView();

        // Create a box to hold the Entry and Tree
        Gtk.VBox box = new Gtk.VBox();

        // Add the widgets to the box
        box.PackStart(filterBox, false, false, 5);
        box.PackStart(tree, true, true, 5);

        window.Add(box);

        // Create a column for the artist name
        Gtk.TreeViewColumn artistColumn = new Gtk.TreeViewColumn();
        artistColumn.Title = "Artist";

        // Create the text cell that will display the artist name
        Gtk.CellRendererText artistNameCell = new Gtk.CellRendererText();

        // Add the cell to the column
        artistColumn.PackStart(artistNameCell, true);

        // Create a column for the song title
        Gtk.TreeViewColumn songColumn = new Gtk.TreeViewColumn();
        songColumn.Title = "Song Title";

        // Do the same for the song title column
        Gtk.CellRendererText songTitleCell = new Gtk.CellRendererText();
        songColumn.PackStart(songTitleCell, true);

        // Add the columns to the TreeView
        tree.AppendColumn(artistColumn);
        tree.AppendColumn(songColumn);

        // Tell the Cell Renderers which items in the model to display
        artistColumn.AddAttribute(artistNameCell, "text", 0);
        songColumn.AddAttribute(songTitleCell, "text", 1);

        // Create a model that will hold two strings - Artist Name and Song Title
        Gtk.ListStore musicListStore = new Gtk.ListStore(typeof(string), typeof(string));

        // Add some data to the store
        musicListStore.AppendValues("BT", "Circles");
        musicListStore.AppendValues("Daft Punk", "Technologic");
        musicListStore.AppendValues("Daft Punk", "Digital Love");
        musicListStore.AppendValues("The Crystal Method", "PHD");
        musicListStore.AppendValues("The Crystal Method", "Name of the game");
        musicListStore.AppendValues("The Chemical Brothers", "Galvanize");

        // Instead of assigning the ListStore model directly to the TreeStore, we create a TreeModelFilter
        // which sits between the Model (the ListStore) and the View (the TreeView) filtering what the model sees.
        // Some may say that this is a "Controller", even though the name and usage suggests that it is still part of
        // the Model.
        filter = new Gtk.TreeModelFilter(musicListStore, null);

        // Specify the function that determines which rows to filter out and which ones to display
        filter.VisibleFunc = new Gtk.TreeModelFilterVisibleFunc(FilterTree);

        // Assign the filter as our tree's model
        tree.Model = filter;

        // Show the window and everything on it
        window.ShowAll();
    }
コード例 #6
0
        private void UpdateModel()
        {
            // Create a list store with all the check information
            checkPropsList = new Gtk.ListStore (typeof(CheckClass), typeof(string));
            // Create a list with all checks objects
            checkList = DataManager.GetChecks ();
            // Add all checks and customer name to the list store
            foreach (CheckClass check in checkList) {
                string name = (DAL.DataManager.GetCustomer (check.CustomerID)).Name;
                checkPropsList.AppendValues (check, name);
            }
            // Add filter for searching
            filter = new Gtk.TreeModelFilter (checkPropsList, null);
            filter.VisibleFunc = new Gtk.TreeModelFilterVisibleFunc (FilterTree);

            // Configure sorter and the sort funcions
            sorter = new Gtk.TreeModelSort (filter);
            sorter.SetSortFunc (0, CompareCustomerIDFunc);
            sorter.SetSortFunc (1, CompareCustomerNameFunc);
            sorter.SetSortFunc (2, CompareCheckNumberFunc);
            sorter.SetSortFunc (3, CompareBankNumberFunc);
            sorter.SetSortFunc (4, CompareBranchNumberFunc);
            sorter.SetSortFunc (5, CompareSerialFunc);
            sorter.SetSortFunc (6, CompareDueDateFunc);
            sorter.SetSortFunc (7, CompareValueFunc);

            // Set the treeview model
            checktableview.Model = sorter;
        }
コード例 #7
0
        void CreateControl()
        {
//            control = new HPaned ();

//            store = new Gtk.ListStore (typeof (Gdk.Pixbuf), // image - type
//                typeof (bool),       // read?
//                typeof (Task));       // read? -- use Pango weight

//            Gtk.TreeModelFilterVisibleFunc filterFunct = new Gtk.TreeModelFilterVisibleFunc();
            filter = new Gtk.TreeModelFilter(store, null);
//            filter.VisibleFunc = filterFunct;
//
            sort = new Gtk.TreeModelSort(filter);
//            sort.SetSortFunc (VisibleColumns.Type, SeverityIterSort);
//            sort.SetSortFunc (VisibleColumns.Project, ProjectIterSort);
//            sort.SetSortFunc (VisibleColumns.File, FileIterSort);
//
            view           = new PadTreeView(sort);
            view.RulesHint = true;
//            view.DoPopupMenu = (evnt) => IdeApp.CommandService.ShowContextMenu (view, evnt, CreateMenu ());
//            AddColumns ();
//            LoadColumnsVisibility ();
//            view.Columns[VisibleColumns.Type].SortColumnId = VisibleColumns.Type;
//            view.Columns[VisibleColumns.Project].SortColumnId = VisibleColumns.Project;
//            view.Columns[VisibleColumns.File].SortColumnId = VisibleColumns.File;

            sw            = new CompactScrolledWindow();
            sw.ShadowType = Gtk.ShadowType.None;
            sw.Add(view);
//            TaskService.Errors.TasksRemoved      += DispatchService.GuiDispatch<TaskEventHandler> (ShowResults);
//            TaskService.Errors.TasksAdded        += DispatchService.GuiDispatch<TaskEventHandler> (TaskAdded);
//            TaskService.Errors.TasksChanged      += DispatchService.GuiDispatch<TaskEventHandler> (TaskChanged);
//            TaskService.Errors.CurrentLocationTaskChanged += HandleTaskServiceErrorsCurrentLocationTaskChanged;
//
//            IdeApp.Workspace.FirstWorkspaceItemOpened += OnCombineOpen;
//            IdeApp.Workspace.LastWorkspaceItemClosed += OnCombineClosed;

//            view.RowActivated += new Gtk.RowActivatedHandler (OnRowActivated);

            iconWarning = sw.RenderIcon(Stock.Warning, Gtk.IconSize.Menu, "");
            iconError   = sw.RenderIcon(Stock.Error, Gtk.IconSize.Menu, "");
            iconInfo    = sw.RenderIcon(Gtk.Stock.DialogInfo, Gtk.IconSize.Menu, "");

//            control.Add1 (sw);
//
//            outputView = new LogView ();
//            control.Add2 (outputView);

            Control.ShowAll();

//            control.SizeAllocated += HandleControlSizeAllocated;

//            bool outputVisible = PropertyService.Get<bool> (outputViewVisiblePropertyName, false);
//            if (outputVisible) {
//                outputView.Visible = true;
//                logBtn.Active = true;
//            } else {
//                outputView.Hide ();
//            }
//
//            sw.SizeAllocated += HandleSwSizeAllocated;



//            control.FocusChain = new Gtk.Widget [] { sw };
        }