diff --git a/GUIs.Common/GridBuilder.vb b/GUIs.Common/GridBuilder.vb index 52d6072d..4a817998 100644 --- a/GUIs.Common/GridBuilder.vb +++ b/GUIs.Common/GridBuilder.vb @@ -16,6 +16,54 @@ Public Class GridBuilder Views.AddRange(GridViews) End Sub + Public Sub SetDefaults(ParamArray pGridViews As GridView()) + For Each oView In pGridViews + WithDefaults(oView) + Next + End Sub + + Public Sub SetDefaults(ParamArray pTreeLists As TreeList()) + For Each oView In pTreeLists + WithDefaults(oView) + Next + End Sub + + Public Sub SetReadOnlyOptions(ParamArray pGridViews As GridView()) + For Each oView In pGridViews + WithReadOnlyOptions(oView) + Next + End Sub + + Public Sub SetReadOnlyOptions(ParamArray pTreeLists As TreeList()) + For Each oView In pTreeLists + WithReadOnlyOptions(oView) + Next + End Sub + + Public Sub SetFontSizeDelta(pFontSizeDelta As Integer, ParamArray pGridViews As GridView()) + For Each oView In pGridViews + WithFontSizeDelta(oView, pFontSizeDelta) + Next + End Sub + + Public Sub SetFontSizeDelta(pFontSizeDelta As Integer, ParamArray pTreeLists As TreeList()) + For Each oView In pTreeLists + WithFontSizeDelta(oView, pFontSizeDelta) + Next + End Sub + + Public Sub SetClipboardHandler(ParamArray pGridViews As GridView()) + For Each oView In pGridViews + WithClipboardHandler(oView) + Next + End Sub + + Public Sub SetClipboardHandler(ParamArray pTreeLists As TreeList()) + For Each oView In pTreeLists + WithClipboardHandler(oView) + Next + End Sub + ''' ''' Applies common properties to all GridViews ''' @@ -101,6 +149,15 @@ Public Class GridBuilder Return Me End Function + Public Function WithFontSizeDelta(pTreeList As TreeList, pFontSizeDelta As Integer) As GridBuilder + pTreeList.Appearance.Row.FontSizeDelta = pFontSizeDelta + pTreeList.Appearance.GroupFooter.FontSizeDelta = pFontSizeDelta + pTreeList.Appearance.FilterPanel.FontSizeDelta = pFontSizeDelta + pTreeList.Appearance.HeaderPanel.FontSizeDelta = pFontSizeDelta + + Return Me + End Function + Public Function WithClipboardHandler() As GridBuilder For Each oGridView In Views WithClipboardHandler(oGridView) @@ -115,6 +172,23 @@ Public Class GridBuilder Return Me End Function + Public Function WithClipboardHandler(View As TreeList) As GridBuilder + AddHandler View.KeyDown, AddressOf TreeList_ClipboardHandler + + Return Me + End Function + + Private Sub TreeList_ClipboardHandler(sender As Object, e As KeyEventArgs) + Dim view As TreeList = CType(sender, TreeList) + Dim oNode = view.FocusedNode + If e.Control AndAlso e.KeyCode = Keys.C Then + If view.GetRowCellValue(oNode, view.FocusedColumn) IsNot Nothing AndAlso view.GetRowCellValue(oNode, view.FocusedColumn).ToString() <> [String].Empty Then + Clipboard.SetText(view.GetRowCellValue(oNode, view.FocusedColumn).ToString()) + End If + e.Handled = True + End If + End Sub + Private Sub GridView_ClipboardHandler(sender As Object, e As KeyEventArgs) Dim view As GridView = CType(sender, GridView) If e.Control AndAlso e.KeyCode = Keys.C Then