implementing CellRenderer from UWT - requires MBS.Framework.UserInterface @ a75f688

This commit is contained in:
Michael Becker 2021-05-11 22:56:04 -04:00
parent 1eeb6e5348
commit 215a5f9182
No known key found for this signature in database
GPG Key ID: 98C333A81F18C22C
13 changed files with 61 additions and 47 deletions

View File

@ -2,6 +2,20 @@
<!-- Generated with glade 3.22.2 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkTreeStore" id="tm">
<columns>
<!-- column-name colFileName -->
<column type="gchararray"/>
<!-- column-name colFileSize -->
<column type="gchararray"/>
<!-- column-name colFileType -->
<column type="gchararray"/>
<!-- column-name colFileDateModified -->
<column type="gchararray"/>
<!-- column-name colImage -->
<column type="GdkPixbuf"/>
</columns>
</object>
<object class="GtkWindow">
<property name="can_focus">False</property>
<child type="titlebar">
@ -45,6 +59,12 @@
<property name="title" translatable="yes">Name</property>
<property name="clickable">True</property>
<property name="reorderable">True</property>
<child>
<object class="GtkCellRendererPixbuf"/>
<attributes>
<attribute name="pixbuf">4</attribute>
</attributes>
</child>
<child>
<object class="GtkCellRendererText"/>
<attributes>
@ -107,16 +127,4 @@
</object>
</child>
</object>
<object class="GtkTreeStore" id="tm">
<columns>
<!-- column-name colFileName -->
<column type="gchararray"/>
<!-- column-name colFileSize -->
<column type="gchararray"/>
<!-- column-name colFileType -->
<column type="gchararray"/>
<!-- column-name colFileDateModified -->
<column type="gchararray"/>
</columns>
</object>
</interface>

View File

@ -94,8 +94,8 @@ namespace UniversalEditor.UserInterface.Controls
lv = new ListViewControl();
lv.Model = tm;
lv.Columns.Add (new ListViewColumnText (lv.Model.Columns [0], "Name"));
lv.Columns.Add (new ListViewColumnText (lv.Model.Columns [1], "Description"));
lv.Columns.Add(new ListViewColumn("Name", new CellRenderer[] { new CellRendererText(lv.Model.Columns[0]) }));
lv.Columns.Add(new ListViewColumn("Description", new CellRenderer[] { new CellRendererText(lv.Model.Columns[1]) }));
lv.HeaderStyle = ColumnHeaderStyle.None;
ctObjectModel.Controls.Add (lv, new BoxLayout.Constraints (true, true));

View File

@ -353,7 +353,7 @@ namespace UniversalEditor.UserInterface.Editors.Database.Views
DefaultTreeModel tmResults = new DefaultTreeModel(list.ToArray());
for (int i = 0; i < db.Tables[0].Fields.Count; i++)
{
lvResults.Columns.Add(new ListViewColumnText(tmResults.Columns[i], db.Tables[0].Fields[i].Name));
lvResults.Columns.Add(new ListViewColumn(db.Tables[0].Fields[i].Name, new CellRenderer[] { new CellRendererText(tmResults.Columns[i]) }));
}
foreach (DatabaseRecord rec in db.Tables[0].Records)
{

View File

@ -38,6 +38,7 @@ using MBS.Framework;
using MBS.Framework.UserInterface.Controls;
using System.Text;
using System.Diagnostics.Contracts;
using MBS.Framework.UserInterface.Drawing;
namespace UniversalEditor.Editors.FileSystem
{
@ -48,6 +49,8 @@ namespace UniversalEditor.Editors.FileSystem
private DefaultTreeModel tm = null;
private TextBox txtPath;
private const int DELIVERED_COLUMNS_COUNT = 5;
[EventHandler(nameof(txtPath), "KeyDown")]
private void txtPath_KeyDown(object sender, KeyEventArgs e)
{
@ -337,7 +340,8 @@ namespace UniversalEditor.Editors.FileSystem
new TreeModelRowColumn(tm.Columns[0], f.Name),
new TreeModelRowColumn(tm.Columns[1], String.Format("{0} items", (f.Files.Count + f.Folders.Count))),
new TreeModelRowColumn(tm.Columns[2], "Folder"),
new TreeModelRowColumn(tm.Columns[3], now.ToString())
new TreeModelRowColumn(tm.Columns[3], now.ToString()),
new TreeModelRowColumn(tm.Columns[4], Image.FromStock(StockType.Folder, 16))
});
row.RowColumns[1].RawValue = (f.Folders.Count + f.Files.Count);
row.RowColumns[3].RawValue = now.ToBinary();
@ -606,7 +610,8 @@ namespace UniversalEditor.Editors.FileSystem
new TreeModelRowColumn(tm.Columns[0], f.Name),
new TreeModelRowColumn(tm.Columns[1], (f.Folders.Count + f.Files.Count).ToString() + " items"),
new TreeModelRowColumn(tm.Columns[2], "Folder"),
new TreeModelRowColumn(tm.Columns[3], "")
new TreeModelRowColumn(tm.Columns[3], ""),
new TreeModelRowColumn(tm.Columns[4], Image.FromStock(StockType.Folder, 16))
});
r.RowColumns[1].RawValue = (long)(f.Folders.Count + f.Files.Count);
r.RowColumns[3].RawValue = (long)0;
@ -633,14 +638,15 @@ namespace UniversalEditor.Editors.FileSystem
new TreeModelRowColumn(tm.Columns[0], f.Name),
new TreeModelRowColumn(tm.Columns[1], UserInterface.Common.FileInfo.FormatSize(f.Size)),
new TreeModelRowColumn(tm.Columns[2], "File"),
new TreeModelRowColumn(tm.Columns[3], f.ModificationTimestamp.ToString())
new TreeModelRowColumn(tm.Columns[3], f.ModificationTimestamp.ToString()),
new TreeModelRowColumn(tm.Columns[4], Image.FromStock(StockType.File, 16))
});
r.RowColumns[1].RawValue = f.Size;
r.RowColumns[3].RawValue = f.ModificationTimestamp.ToBinary();
for (int i = 0; i < fsom.AdditionalDetails.Count; i++)
{
r.RowColumns.Add(new TreeModelRowColumn(tm.Columns[4 + i], f.GetAdditionalDetail(fsom.AdditionalDetails[i].Name)));
r.RowColumns.Add(new TreeModelRowColumn(tm.Columns[DELIVERED_COLUMNS_COUNT + i], f.GetAdditionalDetail(fsom.AdditionalDetails[i].Name)));
}
}
r.SetExtraData<IFileSystemObject>("item", fso);
@ -769,14 +775,14 @@ namespace UniversalEditor.Editors.FileSystem
FileSystemObjectModel fsom = (ObjectModel as FileSystemObjectModel);
if (fsom == null) return;
for (int i = 4; i < tv.Columns.Count; i++)
for (int i = DELIVERED_COLUMNS_COUNT; i < tv.Columns.Count; i++)
{
tv.Columns.Remove(tv.Columns[i]);
}
for (int i = 0; i < fsom.AdditionalDetails.Count; i++)
{
tm.Columns.Add(new TreeModelColumn(typeof(string)));
tv.Columns.Add(new ListViewColumnText(tm.Columns[tm.Columns.Count - 1], fsom.AdditionalDetails[i].Title));
tv.Columns.Add(new ListViewColumn(fsom.AdditionalDetails[i].Title, new CellRenderer[] { new CellRendererText(tm.Columns[tm.Columns.Count - 1]) }));
}
tv.Model = tm;
@ -917,7 +923,7 @@ namespace UniversalEditor.Editors.FileSystem
if (!IsCreated) return;
for (int i = 4; i < tm.Columns.Count; i++)
for (int i = DELIVERED_COLUMNS_COUNT; i < tm.Columns.Count; i++)
{
tm.Columns.RemoveAt(i);
}

View File

@ -215,7 +215,7 @@ namespace UniversalEditor.UserInterface
ListViewControl lvToolbox = new ListViewControl();
lvToolbox.RowActivated += LvToolbox_RowActivated;
lvToolbox.Model = tmToolbox;
lvToolbox.Columns.Add(new ListViewColumnText(tmToolbox.Columns[0], "Item"));
lvToolbox.Columns.Add(new ListViewColumn("Item", new CellRenderer[] { new CellRendererText(tmToolbox.Columns[0]) }));
lvToolbox.HeaderStyle = ColumnHeaderStyle.None;
AddPanel("Toolbox", DockingItemPlacement.Left, lvToolbox);

View File

@ -23,7 +23,7 @@ namespace UniversalEditor.UserInterface.Panels
tm = new DefaultTreeModel(new Type[] { typeof(string) });
lv.Model = tm;
lv.HeaderStyle = ColumnHeaderStyle.None;
lv.Columns.Add(new ListViewColumnText(tm.Columns[0], "Item"));
lv.Columns.Add(new ListViewColumn("Item", new CellRenderer[] { new CellRendererText(tm.Columns[0]) }));
Controls.Add(lv, new BoxLayout.Constraints(true, true));
}

View File

@ -53,12 +53,12 @@ namespace UniversalEditor.UserInterface.Panels
tvErrorList.Model = tm;
tvErrorList.Columns.Add(new ListViewColumnText(tm.Columns[0], "Line"));
tvErrorList.Columns.Add(new ListViewColumnText(tm.Columns[1], "Description"));
tvErrorList.Columns.Add(new ListViewColumnText(tm.Columns[2], "File"));
tvErrorList.Columns.Add(new ListViewColumnText(tm.Columns[3], "Project"));
tvErrorList.Columns.Add(new ListViewColumnText(tm.Columns[4], "Path"));
tvErrorList.Columns.Add(new ListViewColumnText(tm.Columns[5], "Category"));
tvErrorList.Columns.Add(new ListViewColumn("Line", new CellRenderer[] { new CellRendererText(tm.Columns[0]) }));
tvErrorList.Columns.Add(new ListViewColumn("Description", new CellRenderer[] { new CellRendererText(tm.Columns[1]) } ));
tvErrorList.Columns.Add(new ListViewColumn("File", new CellRenderer[] { new CellRendererText(tm.Columns[2]) } ));
tvErrorList.Columns.Add(new ListViewColumn("Project", new CellRenderer[] { new CellRendererText(tm.Columns[3]) } ));
tvErrorList.Columns.Add(new ListViewColumn("Path", new CellRenderer[] { new CellRendererText(tm.Columns[4]) } ));
tvErrorList.Columns.Add(new ListViewColumn("Category", new CellRenderer[] { new CellRendererText(tm.Columns[5]) }));
(Application.Instance as IHostApplication).Messages.MessageAdded += (sender, e) =>
{

View File

@ -184,7 +184,7 @@ namespace UniversalEditor.UserInterface.Panels
tvSolutionExplorer.RowActivated += tvSolutionExplorer_RowActivated;
// (UniversalEditor.exe:24867): Gtk-CRITICAL **: 21:28:56.913: gtk_tree_store_set_value: assertion 'G_IS_VALUE (value)' failed
tvSolutionExplorer.Columns.Add(new ListViewColumnText(tmSolutionExplorer.Columns[0], "File Name"));
tvSolutionExplorer.Columns.Add(new ListViewColumn("File name", new CellRenderer[] { new CellRendererText(tmSolutionExplorer.Columns[0]) }));
this.Controls.Add(tvSolutionExplorer, new BoxLayout.Constraints(true, true));

View File

@ -148,7 +148,7 @@ namespace UniversalEditor.Editors.Contact
tmAddresses = new DefaultTreeModel(new Type[] { typeof(string) });
lvPhysicalAddresses = new ListViewControl();
lvPhysicalAddresses.Columns.Add(new ListViewColumnText(tmAddresses.Columns[0], "Address"));
lvPhysicalAddresses.Columns.Add(new ListViewColumn("Address", new CellRenderer[] { new CellRendererText(tmAddresses.Columns[0]) }));
lvPhysicalAddresses.Model = tmAddresses;
ct.Controls.Add(lvPhysicalAddresses, new BoxLayout.Constraints(true, true));
@ -167,7 +167,7 @@ namespace UniversalEditor.Editors.Contact
tmAddresses = new DefaultTreeModel(new Type[] { typeof(string) });
ListViewControl lvAddresses = new ListViewControl();
lvAddresses.Columns.Add(new ListViewColumnText(tmAddresses.Columns[0], "Address"));
lvAddresses.Columns.Add(new ListViewColumn("Address", new CellRenderer[] { new CellRendererText(tmAddresses.Columns[0]) }));
ct.Controls.Add(lvAddresses, new BoxLayout.Constraints(true, true));
StackSidebarPanel panel = new StackSidebarPanel();
@ -185,7 +185,7 @@ namespace UniversalEditor.Editors.Contact
tmAddresses = new DefaultTreeModel(new Type[] { typeof(string) });
ListViewControl lvAddresses = new ListViewControl();
lvAddresses.Columns.Add(new ListViewColumnText(tmAddresses.Columns[0], "Address"));
lvAddresses.Columns.Add(new ListViewColumn("Address", new CellRenderer[] { new CellRendererText(tmAddresses.Columns[0]) }));
ct.Controls.Add(lvAddresses, new BoxLayout.Constraints(true, true));
StackSidebarPanel panel = new StackSidebarPanel();

View File

@ -76,10 +76,10 @@ namespace UniversalEditor.Plugins.Executable.UserInterface.Editors.Executable
tvSections = new ListViewControl();
tvSections.Model = tmSections;
tvSections.Columns.Add(new ListViewColumnText(tmSections.Columns[0], "Name"));
tvSections.Columns.Add(new ListViewColumnText(tmSections.Columns[1], "Physical address"));
tvSections.Columns.Add(new ListViewColumnText(tmSections.Columns[2], "Virtual address"));
tvSections.Columns.Add(new ListViewColumnText(tmSections.Columns[3], "Size"));
tvSections.Columns.Add(new ListViewColumn("Name", new CellRenderer[] { new CellRendererText(tmSections.Columns[0]) }));
tvSections.Columns.Add(new ListViewColumn("Physical address", new CellRenderer[] { new CellRendererText(tmSections.Columns[1]) }));
tvSections.Columns.Add(new ListViewColumn("Virtual address", new CellRenderer[] { new CellRendererText(tmSections.Columns[2]) }));
tvSections.Columns.Add(new ListViewColumn("Size", new CellRenderer[] { new CellRendererText(tmSections.Columns[3]) }));
tvSections.BeforeContextMenu += tvSections_BeforeContextMenu;
tbs = new TabContainer();
@ -125,8 +125,8 @@ namespace UniversalEditor.Plugins.Executable.UserInterface.Editors.Executable
ListViewControl lvOtherInformation = new ListViewControl();
lvOtherInformation.Model = tmOtherInformation;
lvOtherInformation.Columns.Add(new ListViewColumnText(tmOtherInformation.Columns[0], "Name"));
lvOtherInformation.Columns.Add(new ListViewColumnText(tmOtherInformation.Columns[1], "Value"));
lvOtherInformation.Columns.Add(new ListViewColumn("Name", new CellRenderer[] { new CellRendererText(tmOtherInformation.Columns[0]) }));
lvOtherInformation.Columns.Add(new ListViewColumn("Value", new CellRenderer[] { new CellRendererText(tmOtherInformation.Columns[1]) }));
tabVersion.Controls.Add(lvOtherInformation, new GridLayout.Constraints(4, 0, 1, 2, ExpandMode.Both));
tbs.TabPages.Add(tabVersion);

View File

@ -260,8 +260,8 @@ namespace UniversalEditor.Plugins.Executable.UserInterface.Editors.Executable
tmTypes = new DefaultTreeModel(new Type[] { typeof(string), typeof(string) });
tvTypes.Model = tmTypes;
tvTypes.Columns.Add(new ListViewColumnText(tmTypes.Columns[0], "Name"));
tvTypes.Columns.Add(new ListViewColumnText(tmTypes.Columns[1], "Type"));
tvTypes.Columns.Add(new ListViewColumn("Name", new CellRenderer[] { new CellRendererText(tmTypes.Columns[0]) }));
tvTypes.Columns.Add(new ListViewColumn("Type", new CellRenderer[] { new CellRendererText(tmTypes.Columns[1]) }));
scLeftRight.Panel1.Controls.Add(tvTypes, new BoxLayout.Constraints(true, true));
scLeftRight.Panel2.Layout = new BoxLayout(Orientation.Vertical);

View File

@ -47,10 +47,10 @@ namespace UniversalEditor.Plugins.Multimedia.UserInterface.Editors.Multimedia.Au
lvSamples = new ListViewControl();
lvSamples.SelectionMode = SelectionMode.Multiple;
lvSamples.BeforeContextMenu += lvSamples_BeforeContextMenu;
lvSamples.Columns.Add(new ListViewColumnText(tmSamples.Columns[0], "Name"));
lvSamples.Columns.Add(new ListViewColumnText(tmSamples.Columns[1], "Frequency"));
lvSamples.Columns.Add(new ListViewColumnText(tmSamples.Columns[2], "Channels"));
lvSamples.Columns.Add(new ListViewColumnText(tmSamples.Columns[3], "Size"));
lvSamples.Columns.Add(new ListViewColumn("Name", new CellRenderer[] { new CellRendererText(tmSamples.Columns[0]) }));
lvSamples.Columns.Add(new ListViewColumn("Frequency", new CellRenderer[] { new CellRendererText(tmSamples.Columns[1]) }));
lvSamples.Columns.Add(new ListViewColumn("Channels", new CellRenderer[] { new CellRendererText(tmSamples.Columns[2]) }));
lvSamples.Columns.Add(new ListViewColumn("Size", new CellRenderer[] { new CellRendererText(tmSamples.Columns[3]) }));
lvSamples.Model = tmSamples;
Controls.Add(lvSamples, new BoxLayout.Constraints(true, true));

View File

@ -99,7 +99,7 @@ namespace UniversalEditor.Plugins.Scientific.UserInterface.Editors.DataSetCollec
for (int i = 0; i < ds.Dimensions; i++)
{
tv.Columns.Add(new ListViewColumnText(tm.Columns[i], i.ToString()));
tv.Columns.Add(new ListViewColumn(i.ToString(), new CellRenderer[] { new CellRendererText(tm.Columns[i]) }));
for (int j = 0; j < ds.Sizes[i]; j++)
{