GitLab Commit is coming up on August 3-4. Learn how to innovate together using GitLab, the DevOps platform. Register for free: gitlabcommitvirtual2021.com

Commit f8221167 authored by Benoît Minisini's avatar Benoît Minisini
Browse files

Add a Tag property to many view control items.

[GB.GUI.BASE]
* NEW: GridView: Cells have now a Tag property.
* NEW: GridView: Columns have now a Tag property.
* NEW: TreeView: Items have now a Tag property.
* NEW: ListView: Items have now a Tag property.
* NEW: ColumnView: Items have now a Tag property.
* NEW: IconView: Items have now a Tag property.
parent 8ee32f0d
Pipeline #241364559 failed with stage
in 25 minutes and 31 seconds
......@@ -7,7 +7,7 @@ Component=gb.image
Component=gb.gui
Component=gb.settings
Arguments=[["-style=oxygen"],["-style=qtcurve"]]
Environment="GB_JIT_DEBUG=1\nGB_GUI=gb.qt5\nLIBOVERLAY_SCROLLBAR=0\n GTK_DEBUG=interactive"
Environment="GB_REVERSE=1\nGB_JIT_DEBUG=1\nGB_GUI=gb.qt5\nLIBOVERLAY_SCROLLBAR=0\n GTK_DEBUG=interactive"
TabSize=2
Translate=1
Language=en
......
......@@ -16,6 +16,7 @@ Property Padding As Integer
Property RowSpan As Integer
Property ColumnSpan As Integer
Property Border As Border
Property Tag As Variant
Property Read X, {Left} As Integer
Property Read Y, {Top} As Integer
......@@ -242,3 +243,15 @@ Private Sub Border_Write(Value As Border)
GetData(True).Border = Value
End
Private Function Tag_Read() As Variant
Return GetData(False).Tag
End
Private Sub Tag_Write(Value As Variant)
GetData(True).Tag = Value
End
......@@ -9,6 +9,7 @@ Property Resizable As Boolean
Property Expand As Boolean
Property Alignment As Integer
Property Background As Integer
Property Tag As Variant
Event _Refresh
......@@ -22,6 +23,7 @@ Private $bResizable As Boolean = True
Private $bExpand As Boolean
Private $iAlign As Integer
Private $iBackground As Integer = Color.Default
Private $vTag As Variant
Private Sub GetView() As GridView
......@@ -147,3 +149,15 @@ Private Sub Background_Write(Value As Integer)
GetView().Refresh
End
Private Function Tag_Read() As Variant
Return $vTag
End
Private Sub Tag_Write(Value As Variant)
$vTag = Value
End
......@@ -14,6 +14,7 @@ Public Background As Integer = Color.Default
Public Padding As Short
Public WordWrap As Boolean
Public Border As Border
Public Tag As Variant
Property Font As Font
......
......@@ -8,6 +8,7 @@ Property Text As String
Property RichText As String
Property Selected As Boolean
Property Editable As Boolean
Property Tag As Variant
Property Read Hovered As Boolean
Property Read X As Integer
......@@ -20,6 +21,7 @@ Public _Key As String
Private $sText As String
Private $sRichText As String
Private $hPicture As Picture
Private $vTag As Variant
Private $bSelected As Boolean
Private $bEditable As Boolean
Private $bEllipsized As Boolean
......@@ -770,3 +772,15 @@ Public Sub _Invalidate()
$hInside = Null
End
Private Function Tag_Read() As Variant
Return $vTag
End
Private Sub Tag_Write(Value As Variant)
$vTag = Value
End
......@@ -411,7 +411,7 @@ Static Public Sub Arrow(X As Float, Y As Float, Width As Float, Height As Float,
Dim SX, SY As Float
SX = Min(Width / 2, Height / 2) / 2
SX = Min(Width, Height) / 4
If SX <= 0 Then Return
SY = SX * 2
......
......@@ -558,10 +558,12 @@ Public Sub GridView_Draw(X As Integer, Y As Integer, W As Integer, H As Integer,
If hItem.Count Then
XA = X + W + $iDepthW / 4
YA = Y + $iDepthW / 4
WA = $iDepthW / 2
HA = H - $iDepthW / 2
HA = H / 2
If HA < Desktop.Scale Then HA = Min(H, Desktop.Scale)
WA = HA
XA = X + W + ($iDepthW + WA) / 4
YA = Y + CInt(H - HA) \ 2
Paint.Arrow(XA, YA, WA, HA, If(hItem.Expanded, Align.Bottom, Align.Left))
Paint.Background = Color.SetAlpha(Style.ForegroundOf($hView), 64)
Paint.LineWidth = $iDepthW / 12
......@@ -651,10 +653,11 @@ Public Sub GridView_Draw(X As Integer, Y As Integer, W As Integer, H As Integer,
If hItem.Count Then
Paint.Background = Color.LightForeground
XA = X + $iDepthW / 4
YA = Y + $iDepthW / 4
WA = $iDepthW / 2
HA = H - $iDepthW / 2
HA = H / 2
If HA < Desktop.Scale Then HA = Min(H, Desktop.Scale)
WA = HA
XA = X + ($iDepthW - WA) / 2
YA = Y + (H - HA) / 2
Paint.Arrow(XA, YA, WA, HA, If(hItem.Expanded, Align.Bottom, Align.Right))
Paint.Background = Color.SetAlpha(Style.ForegroundOf($hView), 64)
Paint.LineWidth = $iDepthW / 12
......
......@@ -18,6 +18,7 @@ Property Selected As Boolean
Property Background As Integer
Property Foreground As Integer
Property Font As Font
Property Tag As Variant
Private $sKey As String
Private $sParent As String
......@@ -29,6 +30,7 @@ Private $bEditable As Boolean
Private $iBg As Integer = Color.Default
Private $iFg As Integer = Color.Default
Private $hFont As Font
Private $vTag As Variant
Private $aChildren As String[]
Private $aText As String[]
......@@ -41,6 +43,7 @@ Public _Index As Integer
Public _GrandChildren As Integer
Event _Refresh
Private $iLock As Integer
Private Sub GetTree() As _TreeView
......@@ -587,3 +590,15 @@ Public Sub _Unlock()
Endif
End
Private Function Tag_Read() As Variant
Return $vTag
End
Private Sub Tag_Write(Value As Variant)
$vTag = Value
End
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment