Beispiel #1
0
        internal static int GetItemCount <T>(GtkListView <T> listView)
        {
            int result = -1;

            GtkGuiActionRunner.RunGuiAction(() =>
            {
                if (listView.View.Model == null)
                {
                    result = 0;
                    return;
                }
                ;

                result = listView.View.Model.IterNChildren();
            });

            return(result);
        }
Beispiel #2
0
        internal static T GetItemAt <T>(GtkListView <T> listView, int index)
        {
            T result = default(T);

            GtkGuiActionRunner.RunGuiAction(() =>
            {
                TreeView tree = listView.View;
                TreeIter treeIter;
                if (!tree.Model.IterNthChild(out treeIter, index))
                {
                    return;
                }

                result = (T)tree.Model.GetValue(treeIter, 0);
            });

            return(result);
        }
            internal static GtkListView <string> Build()
            {
                var comparer = new RowComparer();
                var renderer = new ColumnRenderer();
                var columns  = new List <TreeViewColumn>();

                columns.Add(
                    TreeBuilder.CreateColumn(
                        "Text", // TODO move constant elsewhere
                        250,    // TODO move constant elsewhere
                        renderer.RenderText));

                var result = new GtkListView <string>(
                    columns,
                    new Dictionary <int, TreeIterCompareFunc>()
                {
                    { (int)Columns.Text, comparer.Compare }
                },
                    null);

                return(result);
            }