Example #1
0
        private void OnHeaderClicked(object sender, EventArgs e)
        {
            DataTableHeader header = ((DataTableHeader)sender);

            if (selectedHeader != header)
            {
                if (selectedHeader != null)
                {
                    selectedHeader.SetSelected(false);
                    selectedHeader = null;
                }
                selectedHeader = header;
                selectedHeader.SetSelected(true);
                selectedField = datatable.GetStructType().GetField(selectedHeader.name);
                if (header == keyHeader)
                {
                    rows.Sort(SortKeys);
                }
                else
                {
                    rows.Sort(SortSelected);
                }
            }
            else
            {
                rows.Reverse();
            }
            OnSearchUpdated();
            Repaint();
        }
Example #2
0
        private DataTableHeader CreateHeader(string name, float size = 200f)
        {
            DataTableHeader h = new DataTableHeader(name, size);

            h.Clicked   += OnHeaderClicked;
            h.Repainted += OnRepaint;
            h.Resized   += OnResized;
            return(h);
        }
Example #3
0
        public void LoadTable(IDataTable <T> table)
        {
            datatable = table;

            headers.Clear();
            headers.Add(CreateHeader("Type"));
            headers.Add(CreateHeader("Name"));
            headers.Add(CreateHeader("Path"));
            keyHeader = CreateHeader("Key", 80f);

            rows.Clear();
            table.ForEachEntries((string key, T value) =>
            {
                rows.Add(CreateRow(key, value));
            });
            OnSearchUpdated();
            RefreshRowSizes();
            Repaint();
        }