ScoobyRom.DataView2DModelGtk.InitStore C# (CSharp) Method

InitStore() protected method

protected InitStore ( ) : void
return void
        protected override void InitStore()
        {
            // TODO avoid reflection
            int count = ((ColumnNr2D[])Enum.GetValues (typeof(ColumnNr2D))).Length;
            // WARNING: crashes when an array slot wasn't initialized
            Type[] types = new Type[count];

            // using enum in the store --> Gtk-WARNING **: Attempting to sort on invalid type GtkSharpValue
            // --> use int instead

            types [(int)ColumnNr2D.Category] = typeof(string);
            types [(int)ColumnNr2D.Toggle] = typeof(bool);
            types [(int)ColumnNr2D.Icon] = typeof(Gdk.Pixbuf);
            types [(int)ColumnNr2D.Title] = typeof(string);
            types [(int)ColumnNr2D.Type] = typeof(int);
            types [(int)ColumnNr2D.UnitY] = typeof(string);

            types [(int)ColumnNr2D.NameX] = typeof(string);
            types [(int)ColumnNr2D.UnitX] = typeof(string);

            types [(int)ColumnNr2D.CountX] = typeof(int);

            types [(int)ColumnNr2D.Xmin] = typeof(float);
            types [(int)ColumnNr2D.Xmax] = typeof(float);
            types [(int)ColumnNr2D.Ymin] = typeof(float);
            types [(int)ColumnNr2D.Yavg] = typeof(float);
            types [(int)ColumnNr2D.Ymax] = typeof(float);

            types [(int)ColumnNr2D.Multiplier] = typeof(float);
            types [(int)ColumnNr2D.Offset] = typeof(float);

            types [(int)ColumnNr2D.Location] = typeof(int);
            types [(int)ColumnNr2D.XPos] = typeof(int);
            types [(int)ColumnNr2D.YPos] = typeof(int);

            types [(int)ColumnNr2D.Description] = typeof(string);

            types [(int)ColumnNr2D.Obj] = typeof(object);

            store = new ListStore (types);

            // not called on TreeView-built-in reorder! called a lot when re-populating store
            //store.RowsReordered += HandleTreeStoreRowsReordered;
            store.RowChanged += HandleTreeStoreRowChanged;
        }