diff options
author | Vsevolod Kukol <sevoku@microsoft.com> | 2018-03-09 14:00:14 +0300 |
---|---|---|
committer | Vsevolod Kukol <sevoku@microsoft.com> | 2018-03-09 14:00:14 +0300 |
commit | db25a8b0e51a5642d63e4b6d4bdf7630e4ed15fa (patch) | |
tree | 41cc790d0e17450b59ff36ebaa2b6013b05c2a10 /Xwt.XamMac/Xwt.Mac | |
parent | d3556d947e0d87dc469ae1d492a9911e24416b8f (diff) |
[Mac] Improve table row height calculation
This patch reduces the amount of required recalculations
while resizing rows and fixes row reallocation when
the NSTableView is being resized.
Diffstat (limited to 'Xwt.XamMac/Xwt.Mac')
-rw-r--r-- | Xwt.XamMac/Xwt.Mac/ListViewBackend.cs | 6 | ||||
-rw-r--r-- | Xwt.XamMac/Xwt.Mac/TreeViewBackend.cs | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/Xwt.XamMac/Xwt.Mac/ListViewBackend.cs b/Xwt.XamMac/Xwt.Mac/ListViewBackend.cs index 64bb5ddd..d4da4a8e 100644 --- a/Xwt.XamMac/Xwt.Mac/ListViewBackend.cs +++ b/Xwt.XamMac/Xwt.Mac/ListViewBackend.cs @@ -191,12 +191,12 @@ namespace Xwt.Mac for (int i = 0; i < Columns.Count; i++) { CompositeCell cell = tryReuse ? Table.GetView (i, row, false) as CompositeCell : null; - if (cell == null) + if (cell == null) { cell = (Columns [i] as TableColumn)?.DataView as CompositeCell; - - if (cell != null) { cell.ObjectValue = NSNumber.FromNInt (row); height = (nfloat)Math.Max (height, cell.FittingSize.Height); + } else { + height = (nfloat)Math.Max (height, cell.GetRequiredHeightForWidth (cell.Frame.Width)); } } updatingRowHeight = false; diff --git a/Xwt.XamMac/Xwt.Mac/TreeViewBackend.cs b/Xwt.XamMac/Xwt.Mac/TreeViewBackend.cs index 4246a391..9d131bd0 100644 --- a/Xwt.XamMac/Xwt.Mac/TreeViewBackend.cs +++ b/Xwt.XamMac/Xwt.Mac/TreeViewBackend.cs @@ -204,12 +204,12 @@ namespace Xwt.Mac for (int i = 0; i < Columns.Count; i++) { CompositeCell cell = tryReuse ? Tree.GetView (i, row, false) as CompositeCell : null; - if (cell == null) + if (cell == null) { cell = (Columns [i] as TableColumn)?.DataView as CompositeCell; - - if (cell != null) { cell.ObjectValue = pos; height = (nfloat)Math.Max (height, cell.FittingSize.Height); + } else { + height = (nfloat)Math.Max (height, cell.GetRequiredHeightForWidth (cell.Frame.Width)); } } updatingRowHeight = false; |