Fix Splitter and add 'ColumnView.Columns.Padding' property.

[GB.GUI.BASE]
* BUG: Splitter: Fix layout in vertical mode.
* NEW: Splitter: A double-click on the handle now resets the layout.
* NEW: ColumnView: Add 'Padding' property to the ColumnView.Columns object.
* NEW: ColumnView: No column padding by default.
This commit is contained in:
Benoît Minisini 2022-12-20 10:54:37 +01:00
parent 0ca614c4cb
commit 20b5c1c794
3 changed files with 35 additions and 6 deletions

View File

@ -386,11 +386,12 @@ Public Sub Resize_MouseMove()
' [0 -> I] / [I + 1 -> N - 1]
XMin = (S + 1) * ($iMinSize + SW) - SW
XMax = $hPanel.W - (($aLayout.Count - S - 1) * ($iMinSize + SW) - SW)
If $bVertical Then
XMax = $hPanel.H - (($aLayout.Count - S - 1) * ($iMinSize + SW) - SW)
X = Mouse.ScreenY - $hPanel.ScreenY - Mouse.StartY + Desktop.Scale \ 2
Else
XMax = $hPanel.W - (($aLayout.Count - S - 1) * ($iMinSize + SW) - SW)
X = Mouse.ScreenX - $hPanel.ScreenX - Mouse.StartX + Desktop.Scale \ 2
Endif
@ -538,3 +539,16 @@ Private Sub Arrangement_Write(Value As Integer)
UpdateMouse
End
Public Sub Resize_DblClick()
Dim aLayout As Integer[]
Dim I As Integer
aLayout = Layout_Read()
For I = 0 To aLayout.Max
If aLayout[I] Then aLayout[I] = 1
Next
Layout_Write(aLayout)
End

View File

@ -6,6 +6,7 @@ Property Count As Integer
Property Read Max As Integer
Property Sort As Integer
Property Ascending As Boolean
Property Padding As Integer
Event _Refresh
@ -64,3 +65,15 @@ Private Function Max_Read() As Integer
Return Count_Read() - 1
End
Private Function Padding_Read() As Integer
Return GetView().Columns.Padding
End
Private Sub Padding_Write(Value As Integer)
GetView().Columns.Padding = Value
End

View File

@ -784,10 +784,10 @@ Public Sub GridView_Draw(X As Integer, Y As Integer, W As Integer, H As Integer,
Else
If Me Is ColumnView Then
X += Desktop.Scale
W -= Desktop.Scale * 2
Endif
' If Me Is ColumnView Then
' X += Desktop.Scale
' W -= Desktop.Scale * 2
' Endif
If hItem.Foreground <> Color.Default Then Paint.Background = hItem.Foreground
Paint.DrawText(hItem[Column], X, Y, W, H, $hView.Columns[Column].Alignment)
@ -1512,9 +1512,11 @@ Private Sub UpdateRenameBox() As Boolean
Else
X = $hView.Columns[$iColRenaming].X - $hView.ScrollX
W = Min($hView.ClientW - X, $hView.Columns[$iColRenaming].Width)
X += $hView.Padding + $hView.Columns.Padding - 2
W -= ($hView.Padding + $hView.Columns.Padding) * 2 - 4
Endif
If W < 32 Then
If W < Desktop.Scale * 4 Then
Cancel
Return
Endif