コード例 #1
0
ファイル: Gtk_Tree.cs プロジェクト: Kurasuke/gst-plugin-sub
        public static bool SetRowDragData(Gtk.SelectionData selection_data, Gtk.ITreeModel tree_model, Gtk.TreePath path)
        {
            bool raw_ret = gtk_tree_set_row_drag_data(selection_data == null ? IntPtr.Zero : selection_data.Handle, tree_model == null ? IntPtr.Zero : ((tree_model is GLib.Object) ? (tree_model as GLib.Object).Handle : (tree_model as Gtk.TreeModelAdapter).Handle), path == null ? IntPtr.Zero : path.Handle);
            bool ret     = raw_ret;

            return(ret);
        }
        void InvokeNative(Gtk.ITreeModel model, Gtk.TreePath path, Gtk.TreeIter iter)
        {
            IntPtr native_iter = GLib.Marshaller.StructureToPtrAlloc(iter);

            native_cb(model == null ? IntPtr.Zero : ((model is GLib.Object) ? (model as GLib.Object).Handle : (model as Gtk.TreeModelAdapter).Handle), path == null ? IntPtr.Zero : path.Handle, native_iter, __data);
            Marshal.FreeHGlobal(native_iter);
        }
コード例 #3
0
        protected virtual int SortTreeStore(TreeModel model,
                                            Gtk.TreeIter iter1,
                                            Gtk.TreeIter iter2)
        {
            var server1 = (ServerModel)model.GetValue(iter1, 0);
            var server2 = (ServerModel)model.GetValue(iter2, 0);

            // protocol nodes don't have a ServerModel
            if (server1 == null && server2 == null)
            {
                return(0);
            }
            if (server2 == null)
            {
                return(1);
            }
            if (server1 == null)
            {
                return(-1);
            }
            var s1 = String.Format("{0}/{1}:{2} ({3})",
                                   server1.Protocol, server1.Hostname,
                                   server1.Port, server1.ServerID);
            var s2 = String.Format("{0}/{1}:{2} ({3})",
                                   server2.Protocol, server2.Hostname,
                                   server2.Port, server2.ServerID);

            return(s1.CompareTo(s2));
        }
コード例 #4
0
        void InvokeNative(Gtk.ICellLayout cell_layout, Gtk.CellRenderer cell, Gtk.ITreeModel tree_model, Gtk.TreeIter iter)
        {
            IntPtr native_iter = GLib.Marshaller.StructureToPtrAlloc(iter);

            native_cb(cell_layout == null ? IntPtr.Zero : ((cell_layout is GLib.Object) ? (cell_layout as GLib.Object).Handle : (cell_layout as Gtk.CellLayoutAdapter).Handle), cell == null ? IntPtr.Zero : cell.Handle, tree_model == null ? IntPtr.Zero : ((tree_model is GLib.Object) ? (tree_model as GLib.Object).Handle : (tree_model as Gtk.TreeModelAdapter).Handle), native_iter, __data);
            Marshal.FreeHGlobal(native_iter);
        }
コード例 #5
0
        public void CellSetCellData(Gtk.ITreeModel tree_model, Gtk.TreeIter iter, bool is_expander, bool is_expanded)
        {
            IntPtr native_iter = GLib.Marshaller.StructureToPtrAlloc(iter);

            gtk_tree_view_column_cell_set_cell_data(Handle, tree_model == null ? IntPtr.Zero : ((tree_model is GLib.Object) ? (tree_model as GLib.Object).Handle : (tree_model as Gtk.TreeModelAdapter).Handle), native_iter, is_expander, is_expanded);
            Marshal.FreeHGlobal(native_iter);
        }
コード例 #6
0
        void InvokeNative(Gtk.TreeViewColumn tree_column, Gtk.CellRenderer cell, Gtk.ITreeModel tree_model, Gtk.TreeIter iter)
        {
            IntPtr native_iter = GLib.Marshaller.StructureToPtrAlloc(iter);

            native_cb(tree_column == null ? IntPtr.Zero : tree_column.Handle, cell == null ? IntPtr.Zero : cell.Handle, tree_model == null ? IntPtr.Zero : ((tree_model is GLib.Object) ? (tree_model as GLib.Object).Handle : (tree_model as Gtk.TreeModelAdapter).Handle), native_iter, __data);
            Marshal.FreeHGlobal(native_iter);
        }
コード例 #7
0
        bool InvokeNative(Gtk.ITreeModel model, Gtk.TreeIter iter)
        {
            IntPtr native_iter = GLib.Marshaller.StructureToPtrAlloc(iter);
            bool   __result    = native_cb(model == null ? IntPtr.Zero : ((model is GLib.Object) ? (model as GLib.Object).Handle : (model as Gtk.TreeModelAdapter).Handle), native_iter, __data);

            Marshal.FreeHGlobal(native_iter);
            return(__result);
        }
コード例 #8
0
        public Gtk.TreePath[] GetSelectedRows(out Gtk.ITreeModel model)
        {
            IntPtr native_model;
            IntPtr raw_ret = gtk_tree_selection_get_selected_rows(Handle, out native_model);

            Gtk.TreePath[] ret = (Gtk.TreePath[])GLib.Marshaller.ListPtrToArray(raw_ret, typeof(GLib.List), true, true, typeof(Gtk.TreePath));
            model = Gtk.TreeModelAdapter.GetObject(native_model, false);
            return(ret);
        }
コード例 #9
0
        public TreeEnumerator(ITreeModel model)
        {
            this.model = model;

            model.RowChanged    += new RowChangedHandler(row_changed);
            model.RowDeleted    += new RowDeletedHandler(row_deleted);
            model.RowInserted   += new RowInsertedHandler(row_inserted);
            model.RowsReordered += new RowsReorderedHandler(rows_reordered);
        }
コード例 #10
0
		public TreeEnumerator (ITreeModel model)
		{
			this.model = model;
			
			model.RowChanged += new RowChangedHandler (row_changed);
			model.RowDeleted += new RowDeletedHandler (row_deleted);
			model.RowInserted += new RowInsertedHandler (row_inserted);
			model.RowsReordered += new RowsReorderedHandler (rows_reordered);
		}
コード例 #11
0
        int InvokeNative(Gtk.ITreeModel model, Gtk.TreeIter a, Gtk.TreeIter b)
        {
            IntPtr native_a = GLib.Marshaller.StructureToPtrAlloc(a);
            IntPtr native_b = GLib.Marshaller.StructureToPtrAlloc(b);
            int    __result = native_cb(model == null ? IntPtr.Zero : ((model is GLib.Object) ? (model as GLib.Object).Handle : (model as Gtk.TreeModelAdapter).Handle), native_a, native_b, __data);

            Marshal.FreeHGlobal(native_a);
            Marshal.FreeHGlobal(native_b);
            return(__result);
        }
コード例 #12
0
        void InvokeNative(Gtk.ITreeModel model, Gtk.TreeIter iter, ref GLib.Value value, int column)
        {
            IntPtr native_iter  = GLib.Marshaller.StructureToPtrAlloc(iter);
            IntPtr native_value = GLib.Marshaller.StructureToPtrAlloc(value);

            native_cb(model == null ? IntPtr.Zero : ((model is GLib.Object) ? (model as GLib.Object).Handle : (model as Gtk.TreeModelAdapter).Handle), native_iter, native_value, column, __data);
            Marshal.FreeHGlobal(native_iter);
            value = (GLib.Value)Marshal.PtrToStructure(native_value, typeof(GLib.Value));
            Marshal.FreeHGlobal(native_value);
        }
コード例 #13
0
ファイル: Gtk_Tree.cs プロジェクト: Kurasuke/gst-plugin-sub
        public static bool GetRowDragData(Gtk.SelectionData selection_data, out Gtk.ITreeModel tree_model, out Gtk.TreePath path)
        {
            IntPtr native_tree_model;
            IntPtr native_path;
            bool   raw_ret = gtk_tree_get_row_drag_data(selection_data == null ? IntPtr.Zero : selection_data.Handle, out native_tree_model, out native_path);
            bool   ret     = raw_ret;

            tree_model = Gtk.TreeModelAdapter.GetObject(native_tree_model, false);
            path       = native_path == IntPtr.Zero ? null : (Gtk.TreePath)GLib.Opaque.GetOpaque(native_path, typeof(Gtk.TreePath), true);
            return(ret);
        }
コード例 #14
0
        public bool GetSelected(out Gtk.ITreeModel model, out Gtk.TreeIter iter)
        {
            IntPtr native_model;
            IntPtr native_iter = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Gtk.TreeIter)));
            bool   raw_ret     = gtk_tree_selection_get_selected(Handle, out native_model, native_iter);
            bool   ret         = raw_ret;

            model = Gtk.TreeModelAdapter.GetObject(native_model, false);
            iter  = Gtk.TreeIter.New(native_iter);
            Marshal.FreeHGlobal(native_iter);
            return(ret);
        }
コード例 #15
0
        private bool InternalCursorOnMatch(Gtk.ITreeModel model, Gtk.TreeIter iter)
        {
            CursorOnMatchNativeDelegate unmanaged = class_abi.BaseOverride <CursorOnMatchNativeDelegate>(this.LookupGType(), "cursor_on_match");

            if (unmanaged == null)
            {
                return(false);
            }

            IntPtr native_iter = GLib.Marshaller.StructureToPtrAlloc(iter);
            bool   __result    = unmanaged(this.Handle, model == null ? IntPtr.Zero : ((model is GLib.Object) ? (model as GLib.Object).Handle : (model as Gtk.TreeModelAdapter).Handle), native_iter);

            Marshal.FreeHGlobal(native_iter);
            return(__result);
        }
コード例 #16
0
ファイル: Gtk_ComboBox.cs プロジェクト: thiblahute/gtk-sharp
 public ComboBox(Gtk.ITreeModel model) : base(IntPtr.Zero)
 {
     if (GetType() != typeof(ComboBox))
     {
         var vals  = new List <GLib.Value> ();
         var names = new List <string> ();
         if (model != null)
         {
             names.Add("model");
             vals.Add(new GLib.Value(model));
         }
         CreateNativeObject(names.ToArray(), vals.ToArray());
         return;
     }
     Raw = gtk_combo_box_new_with_model(model == null ? IntPtr.Zero : ((model is GLib.Object) ? (model as GLib.Object).Handle : (model as Gtk.TreeModelAdapter).Handle));
 }
コード例 #17
0
 public TreeModelSort(Gtk.ITreeModel child_model) : base(IntPtr.Zero)
 {
     if (GetType() != typeof(TreeModelSort))
     {
         var vals  = new List <GLib.Value> ();
         var names = new List <string> ();
         if (child_model != null)
         {
             names.Add("model");
             vals.Add(new GLib.Value(child_model));
         }
         CreateNativeObject(names.ToArray(), vals.ToArray());
         return;
     }
     Raw = gtk_tree_model_sort_new_with_model(child_model == null ? IntPtr.Zero : ((child_model is GLib.Object) ? (child_model as GLib.Object).Handle : (child_model as Gtk.TreeModelAdapter).Handle));
 }
コード例 #18
0
        private bool InternalCursorOnMatch(Gtk.ITreeModel model, Gtk.TreeIter iter)
        {
            CursorOnMatchNativeDelegate unmanaged = null;

            unsafe {
                IntPtr *raw_ptr = (IntPtr *)(((long)this.LookupGType().GetThresholdType().GetClassPtr()) + (long)class_abi.GetFieldOffset("cursor_on_match"));
                unmanaged = (CursorOnMatchNativeDelegate)Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(CursorOnMatchNativeDelegate));
            }
            if (unmanaged == null)
            {
                return(false);
            }

            IntPtr native_iter = GLib.Marshaller.StructureToPtrAlloc(iter);
            bool   __result    = unmanaged(this.Handle, model == null ? IntPtr.Zero : ((model is GLib.Object) ? (model as GLib.Object).Handle : (model as Gtk.TreeModelAdapter).Handle), native_iter);

            Marshal.FreeHGlobal(native_iter);
            return(__result);
        }
コード例 #19
0
        private void InternalModify(Gtk.ITreeModel child_model, Gtk.TreeIter iter, GLib.Value value, int column)
        {
            ModifyNativeDelegate unmanaged = null;

            unsafe {
                IntPtr *raw_ptr = (IntPtr *)(((long)this.LookupGType().GetThresholdType().GetClassPtr()) + (long)class_abi.GetFieldOffset("modify"));
                unmanaged = (ModifyNativeDelegate)Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(ModifyNativeDelegate));
            }
            if (unmanaged == null)
            {
                return;
            }

            IntPtr native_iter  = GLib.Marshaller.StructureToPtrAlloc(iter);
            IntPtr native_value = GLib.Marshaller.StructureToPtrAlloc(value);

            unmanaged(this.Handle, child_model == null ? IntPtr.Zero : ((child_model is GLib.Object) ? (child_model as GLib.Object).Handle : (child_model as Gtk.TreeModelAdapter).Handle), native_iter, native_value, column);
            Marshal.FreeHGlobal(native_iter);
            Marshal.FreeHGlobal(native_value);
        }
コード例 #20
0
 public TreeModelFilter(Gtk.ITreeModel child_model, Gtk.TreePath root) : base(IntPtr.Zero)
 {
     if (GetType() != typeof(TreeModelFilter))
     {
         var vals  = new List <GLib.Value> ();
         var names = new List <string> ();
         if (child_model != null)
         {
             names.Add("child_model");
             vals.Add(new GLib.Value(child_model));
         }
         if (root != null)
         {
             names.Add("virtual-root");
             vals.Add(new GLib.Value(root));
         }
         CreateNativeObject(names.ToArray(), vals.ToArray());
         return;
     }
     Raw = gtk_tree_model_filter_new(child_model == null ? IntPtr.Zero : ((child_model is GLib.Object) ? (child_model as GLib.Object).Handle : (child_model as Gtk.TreeModelAdapter).Handle), root == null ? IntPtr.Zero : root.Handle);
 }
コード例 #21
0
        public int StringCompareAuthor(Gtk.ITreeModel model, Gtk.TreeIter tia, Gtk.TreeIter tib)
        {
            var    a = (BibtexRecord)model.GetValue(tia, 0);
            var    b = (BibtexRecord)model.GetValue(tib, 0);
            string A, B;

            if (a != null)
            {
                if (a.GetAuthors().Count > 0)
                {
                    A = a.GetAuthors()[0];
                }
                else
                {
                    A = "";
                }
            }
            else
            {
                A = "";
            }
            if (b != null)
            {
                if (b.GetAuthors().Count > 0)
                {
                    B = b.GetAuthors()[0];
                }
                else
                {
                    B = "";
                }
            }
            else
            {
                B = "";
            }
            Debug.WriteLine(10, "Comparing {1} and {2}", A, B);
            return(String.Compare(A.ToLower(), B.ToLower()));
        }
コード例 #22
0
        public int StringCompare(Gtk.ITreeModel model, Gtk.TreeIter tia, Gtk.TreeIter tib)
        {
            var    a = (BibtexRecord)model.GetValue(tia, 0);
            var    b = (BibtexRecord)model.GetValue(tib, 0);
            string A, B;
            string sortString = "";
            int    sortColumn;

            Gtk.SortType sortType;
            sorter.GetSortColumnId(out sortColumn, out sortType);

            switch (sortColumn)
            {
            case 1:
                sortString = "Author";
                break;

            case 2:
                sortString = "Title";
                break;

            case 3:
                sortString = "Year";
                break;

            case 4:
                sortString = "Journal";
                break;

            case 5:
                sortString = "Bibtex Key";
                break;

            case 6:
                sortString = "Volume";
                break;

            case 7:
                sortString = "Pages";
                break;
            }

            if (a != null)
            {
                if (a.HasField(sortString))
                {
                    A = a.GetField(sortString);
                }
                else
                {
                    A = "";
                }
            }
            else
            {
                A = "";
            }
            if (b != null)
            {
                if (b.HasField(sortString))
                {
                    B = b.GetField(sortString);
                }
                else
                {
                    B = "";
                }
            }
            else
            {
                B = "";
            }
            Debug.WriteLine(10, "sortString: {0} Comparing {1} and {2}", sortString, A, B);
            return(String.Compare(A.ToLower(), B.ToLower()));
        }
コード例 #23
0
        static void RenderColumnTextFromBibtexRecord(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.ITreeModel model, Gtk.TreeIter iter)
        {
            // See here for an example of how you can highlight cells
            // based on something todo with the entry
            //
            // TODO: extend this feature to highlight entries that
            // are missing required fields

            if ((model != null) && (column != null) && (column.Title != null))
            {
                var record = (BibtexRecord)model.GetValue(iter, 0);
                if (record != null)
                {
                    if (record.HasField(column.Title) && column.Title != "Author")
                    {
                        (cell as Gtk.CellRendererText).Text       = StringOps.TeXToUnicode(record.GetField(column.Title));
                        (cell as Gtk.CellRendererText).Background = "white";
                        (cell as Gtk.CellRendererText).Ellipsize  = Pango.EllipsizeMode.End;
                    }
                    else if (record.HasField(column.Title) && column.Title == "Author")
                    {
                        StringArrayList authors       = record.GetAuthors();
                        string          author_string = "";
                        foreach (string author in authors)
                        {
                            if (author_string == "")
                            {
                                author_string = author;
                            }
                            else
                            {
                                author_string = String.Concat(author_string, "; ", author);
                            }
                        }
                        (cell as Gtk.CellRendererText).Text       = StringOps.TeXToUnicode(author_string);
                        (cell as Gtk.CellRendererText).Background = "white";
                        (cell as Gtk.CellRendererText).Ellipsize  = Pango.EllipsizeMode.End;
                    }
                    else
                    {
                        (cell as Gtk.CellRendererText).Text = "";
                        // could highlight important fields that are missing data too,
                        // for e.g. the line below:
                        //(cell as Gtk.CellRendererText).Background = "green";
                    }
                    if (!BibtexRecordTypeLibrary.Contains(record.RecordType))
                    {
                        (cell as Gtk.CellRendererText).Foreground = "red";
                    }
                    else
                    {
                        (cell as Gtk.CellRendererText).Foreground = "black";
                    }
                }
            }
        }
コード例 #24
0
        static void RenderColumnPixbufFromBibtexRecord(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.ITreeModel model, Gtk.TreeIter iter)
        {
            if (model != null)
            {
                var record = (BibtexRecord)model.GetValue(iter, 0);

                var pixbuf = (Gdk.Pixbuf)record.GetCustomDataField("smallThumbnail");

                if ((cell != null) && (record != null))
                {
                    (cell as Gtk.CellRendererPixbuf).Pixbuf = pixbuf;
                }
            }
        }
コード例 #25
0
 protected virtual bool OnCursorOnMatch(Gtk.ITreeModel model, Gtk.TreeIter iter)
 {
     return(InternalCursorOnMatch(model, iter));
 }
コード例 #26
0
 protected virtual bool OnMatchSelected(Gtk.ITreeModel model, Gtk.TreeIter iter)
 {
     return(InternalMatchSelected(model, iter));
 }
コード例 #27
0
 public TreeRowReference(GLib.Object proxy, Gtk.ITreeModel model, Gtk.TreePath path)
 {
     Raw = gtk_tree_row_reference_new_proxy(proxy == null ? IntPtr.Zero : proxy.Handle, model == null ? IntPtr.Zero : ((model is GLib.Object) ? (model as GLib.Object).Handle : (model as Gtk.TreeModelAdapter).Handle), path == null ? IntPtr.Zero : path.Handle);
 }
コード例 #28
0
        static void RenderFilterColumnTextFromBibtexRecords(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.ITreeModel model, Gtk.TreeIter iter)
        {
            Debug.WriteLine(10, "Rendering cell");
            string val = (string)model.GetValue(iter, 0);

            Debug.WriteLine(10, "Value = " + val);
            (cell as Gtk.CellRendererText).Text = StringOps.TeXToUnicode(val);
        }
コード例 #29
0
        public LitTreeView(Gtk.ITreeModel model)
        {
            sorter = new Gtk.TreeModelSort(model);

            columnsIconSettings      = new BibliographerSettings("apps.bibliographer.columns.icon");
            columnsAuthorSettings    = new BibliographerSettings("apps.bibliographer.columns.author");
            columnsTitleSettings     = new BibliographerSettings("apps.bibliographer.columns.title");
            columnsYearSettings      = new BibliographerSettings("apps.bibliographer.columns.year");
            columnsJournalSettings   = new BibliographerSettings("apps.bibliographer.columns.journal");
            columnsBibtexKeySettings = new BibliographerSettings("apps.bibliographer.columns.bibtexkey");
            columnsVolumeSettings    = new BibliographerSettings("apps.bibliographer.columns.volume");
            columnsPagesSettings     = new BibliographerSettings("apps.bibliographer.columns.pages");

            Model = sorter;

            Gtk.CellRendererPixbuf columnIconRenderer;
            Gtk.CellRendererText   columnAuthorRenderer;
            Gtk.CellRendererText   columnTitleRenderer;
            Gtk.CellRendererText   columnYearRenderer;
            Gtk.CellRendererText   columnJournalRenderer;
            Gtk.CellRendererText   columnBibtexKeyRenderer;
            Gtk.CellRendererText   columnVolumeRenderer;
            Gtk.CellRendererText   columnPagesRenderer;

            columnIconRenderer      = new Gtk.CellRendererPixbuf();
            columnAuthorRenderer    = new Gtk.CellRendererText();
            columnTitleRenderer     = new Gtk.CellRendererText();
            columnYearRenderer      = new Gtk.CellRendererText();
            columnJournalRenderer   = new Gtk.CellRendererText();
            columnBibtexKeyRenderer = new Gtk.CellRendererText();
            columnVolumeRenderer    = new Gtk.CellRendererText();
            columnPagesRenderer     = new Gtk.CellRendererText();

            AppendColumn("Icon", columnIconRenderer, "image");
            AppendColumn("Author", columnAuthorRenderer, "text");
            AppendColumn("Title", columnTitleRenderer, "text");
            AppendColumn("Year", columnYearRenderer, "text");
            AppendColumn("Journal", columnJournalRenderer, "text");
            AppendColumn("Bibtex Key", columnBibtexKeyRenderer, "text");
            AppendColumn("Volume", columnVolumeRenderer, "text");
            AppendColumn("Pages", columnPagesRenderer, "text");

            HeadersClickable = true;

            var textDataFunc   = new Gtk.TreeCellDataFunc(RenderColumnTextFromBibtexRecord);
            var pixmapDataFunc = new Gtk.TreeCellDataFunc(RenderColumnPixbufFromBibtexRecord);

            int idx = 0;

            foreach (Gtk.TreeViewColumn column in Columns)
            {
                column.Expand      = false;
                column.Reorderable = true;
                column.Resizable   = true;
                column.Clickable   = true;

                if (column.Title == "Icon")
                {
                    column.FixedWidth = columnsIconSettings.GetInt("width");
                    column.Visible    = columnsIconSettings.GetBoolean("visible");
                    column.SetCellDataFunc(column.Cells[0], pixmapDataFunc);
                    column.Sizing      = Gtk.TreeViewColumnSizing.Fixed;
                    column.Resizable   = false;
                    column.Reorderable = false;
                    column.Clickable   = false;
                    column.MinWidth    = 20;
                }
                else if (column.Title == "Author")
                {
                    column.FixedWidth = columnsAuthorSettings.GetInt("width");
                    column.Visible    = columnsAuthorSettings.GetBoolean("visible");
                    column.SetCellDataFunc(column.Cells[0], textDataFunc);
                    column.SortColumnId = 1;
                    sorter.SetSortFunc(1, StringCompareAuthor);
                    column.Clicked += OnColumnSort;
                    if (column != Columns[columnsAuthorSettings.GetInt("order") - 1])
                    {
                        MoveColumnAfter(column, Columns[columnsAuthorSettings.GetInt("order") - 1]);
                    }
                }
                else if (column.Title == "Title")
                {
                    column.Expand     = true;
                    column.FixedWidth = columnsTitleSettings.GetInt("width");
                    column.Visible    = columnsTitleSettings.GetBoolean("visible");
                    column.SetCellDataFunc(column.Cells[0], textDataFunc);
                    column.SortColumnId = 2;
                    sorter.SetSortFunc(2, StringCompare);
                    column.Clicked += OnColumnSort;
                    if (column != Columns[columnsTitleSettings.GetInt("order") - 1])
                    {
                        MoveColumnAfter(column, Columns[columnsTitleSettings.GetInt("order") - 1]);
                    }
                }
                else if (column.Title == "Year")
                {
                    column.FixedWidth = columnsYearSettings.GetInt("width");
                    column.Visible    = columnsYearSettings.GetBoolean("visible");
                    column.SetCellDataFunc(column.Cells[0], textDataFunc);
                    column.SortColumnId = 3;
                    sorter.SetSortFunc(3, StringCompare);
                    column.Clicked += OnColumnSort;
                    if (column != Columns[columnsYearSettings.GetInt("order") - 1])
                    {
                        MoveColumnAfter(column, Columns[columnsYearSettings.GetInt("order") - 1]);
                    }
                }
                else if (column.Title == "Journal")
                {
                    column.FixedWidth = columnsJournalSettings.GetInt("width");
                    column.Visible    = columnsJournalSettings.GetBoolean("visible");
                    column.SetCellDataFunc(column.Cells[0], textDataFunc);
                    column.SortColumnId = 4;
                    sorter.SetSortFunc(4, StringCompare);
                    column.Clicked += OnColumnSort;
                    if (column != Columns[columnsJournalSettings.GetInt("order") - 1])
                    {
                        MoveColumnAfter(column, Columns[columnsJournalSettings.GetInt("order") - 1]);
                    }
                }
                else if (column.Title == "Bibtex Key")
                {
                    column.FixedWidth = columnsBibtexKeySettings.GetInt("width");
                    column.Visible    = columnsBibtexKeySettings.GetBoolean("visible");
                    column.SetCellDataFunc(column.Cells[0], textDataFunc);
                    column.SortColumnId = 5;
                    sorter.SetSortFunc(5, StringCompare);
                    column.Clicked += OnColumnSort;
                    if (column != Columns[columnsBibtexKeySettings.GetInt("order") - 1])
                    {
                        MoveColumnAfter(column, Columns[columnsBibtexKeySettings.GetInt("order") - 1]);
                    }
                }
                else if (column.Title == "Volume")
                {
                    column.FixedWidth = columnsVolumeSettings.GetInt("width");
                    column.Visible    = columnsVolumeSettings.GetBoolean("visible");
                    column.SetCellDataFunc(column.Cells[0], textDataFunc);
                    column.SortColumnId = 6;
                    sorter.SetSortFunc(6, StringCompare);
                    column.Clicked += OnColumnSort;
                    if (column != Columns[columnsVolumeSettings.GetInt("order") - 1])
                    {
                        MoveColumnAfter(column, Columns[columnsVolumeSettings.GetInt("order") - 1]);
                    }
                }
                else if (column.Title == "Pages")
                {
                    column.FixedWidth = columnsPagesSettings.GetInt("width");
                    column.Visible    = columnsPagesSettings.GetBoolean("visible");
                    column.SetCellDataFunc(column.Cells[0], textDataFunc);
                    column.SortColumnId = 7;
                    sorter.SetSortFunc(7, StringCompare);
                    column.Clicked += OnColumnSort;
                    if (column != Columns[columnsPagesSettings.GetInt("order") - 1])
                    {
                        MoveColumnAfter(column, Columns[columnsPagesSettings.GetInt("order") - 1]);
                    }
                }
                idx++;
            }

            //RedrawColumns ();

            // Callbacks for the LitTreeView
            ColumnsChanged += OnColumnsChanged;
            DragMotion     += OnDragMotion;
            RowActivated   += OnRowActivated;
            DragLeave      += OnDragLeave;

            Show();
        }
コード例 #30
0
        bool InvokeNative(Gtk.TreeSelection selection, Gtk.ITreeModel model, Gtk.TreePath path, bool path_currently_selected)
        {
            bool __result = native_cb(selection == null ? IntPtr.Zero : selection.Handle, model == null ? IntPtr.Zero : ((model is GLib.Object) ? (model as GLib.Object).Handle : (model as Gtk.TreeModelAdapter).Handle), path == null ? IntPtr.Zero : path.Handle, path_currently_selected, __data);

            return(__result);
        }
コード例 #31
0
ファイル: Gtk_ComboBox.cs プロジェクト: thiblahute/gtk-sharp
        public static ComboBox NewWithModelAndEntry(Gtk.ITreeModel model)
        {
            ComboBox result = new ComboBox(gtk_combo_box_new_with_model_and_entry(model == null ? IntPtr.Zero : ((model is GLib.Object) ? (model as GLib.Object).Handle : (model as Gtk.TreeModelAdapter).Handle)));

            return(result);
        }