mirror of
https://gitee.com/chinware/atomui.git
synced 2024-12-02 03:47:52 +08:00
增加 TreeViewToken
This commit is contained in:
parent
f01fb5a68c
commit
370a0580fc
@ -167,8 +167,6 @@ public class Expander : AvaloniaExpander
|
||||
|
||||
#endregion
|
||||
|
||||
private bool _animating = false;
|
||||
private bool _enableAnimation = true;
|
||||
private AnimationTargetPanel? _animationTarget;
|
||||
private Border? _headerDecorator;
|
||||
private IconButton? _expandButton;
|
||||
@ -182,13 +180,10 @@ public class Expander : AvaloniaExpander
|
||||
TokenResourceBinder.CreateTokenBinding(this, MotionDurationProperty, GlobalResourceKey.MotionDurationSlow);
|
||||
TokenResourceBinder.CreateGlobalResourceBinding(this, BorderThicknessProperty, GlobalResourceKey.BorderThickness,
|
||||
BindingPriority.Template, new RenderScaleAwareThicknessConfigure(this));
|
||||
// SetupHeaderLayout();
|
||||
SetupEffectiveBorderThickness();
|
||||
SetupExpanderBorderThickness();
|
||||
SetupIconButton();
|
||||
_enableAnimation = false;
|
||||
HandleExpandedChanged();
|
||||
_enableAnimation = true;
|
||||
if (_expandButton is not null) {
|
||||
_expandButton.Click += (sender, args) =>
|
||||
{
|
||||
@ -266,7 +261,7 @@ public class Expander : AvaloniaExpander
|
||||
var position = e.GetPosition(_headerDecorator);
|
||||
if (_headerDecorator is not null) {
|
||||
var targetRect = new Rect(_headerDecorator.Bounds.Size);
|
||||
if (targetRect.Contains(position) && !_animating) {
|
||||
if (targetRect.Contains(position)) {
|
||||
IsExpanded = !IsExpanded;
|
||||
}
|
||||
}
|
||||
|
@ -408,6 +408,15 @@ namespace AtomUI.Theme.Styling
|
||||
public static readonly TokenResourceKey ToolTipArrowSize = new TokenResourceKey("ToolTip.ToolTipArrowSize");
|
||||
}
|
||||
|
||||
public static class TreeViewResourceKey
|
||||
{
|
||||
public static readonly TokenResourceKey TitleHeight = new TokenResourceKey("TreeView.TitleHeight");
|
||||
public static readonly TokenResourceKey NodeHoverBg = new TokenResourceKey("TreeView.NodeHoverBg");
|
||||
public static readonly TokenResourceKey NodeSelectedBg = new TokenResourceKey("TreeView.NodeSelectedBg");
|
||||
public static readonly TokenResourceKey DirectoryNodeSelectedColor = new TokenResourceKey("TreeView.DirectoryNodeSelectedColor");
|
||||
public static readonly TokenResourceKey DirectoryNodeSelectedBg = new TokenResourceKey("TreeView.DirectoryNodeSelectedBg");
|
||||
}
|
||||
|
||||
public static class CaptionButtonResourceKey
|
||||
{
|
||||
public static readonly TokenResourceKey HoverBackgroundColor = new TokenResourceKey("CaptionButton.HoverBackgroundColor");
|
||||
|
8
src/AtomUI.Controls/TreeView/TreeView.cs
Normal file
8
src/AtomUI.Controls/TreeView/TreeView.cs
Normal file
@ -0,0 +1,8 @@
|
||||
namespace AtomUI.Controls;
|
||||
|
||||
using AvaloniaTreeView = Avalonia.Controls.TreeView;
|
||||
|
||||
public class TreeView : AvaloniaTreeView
|
||||
{
|
||||
|
||||
}
|
8
src/AtomUI.Controls/TreeView/TreeViewItem.cs
Normal file
8
src/AtomUI.Controls/TreeView/TreeViewItem.cs
Normal file
@ -0,0 +1,8 @@
|
||||
namespace AtomUI.Controls;
|
||||
|
||||
using AvaloniaTreeItem = Avalonia.Controls.TreeViewItem;
|
||||
|
||||
public class TreeViewItem : AvaloniaTreeItem
|
||||
{
|
||||
|
||||
}
|
6
src/AtomUI.Controls/TreeView/TreeViewItemTheme.cs
Normal file
6
src/AtomUI.Controls/TreeView/TreeViewItemTheme.cs
Normal file
@ -0,0 +1,6 @@
|
||||
namespace AtomUI.Controls;
|
||||
|
||||
public class TreeViewItemTheme
|
||||
{
|
||||
|
||||
}
|
6
src/AtomUI.Controls/TreeView/TreeViewTheme.cs
Normal file
6
src/AtomUI.Controls/TreeView/TreeViewTheme.cs
Normal file
@ -0,0 +1,6 @@
|
||||
namespace AtomUI.Controls;
|
||||
|
||||
public class TreeViewTheme
|
||||
{
|
||||
|
||||
}
|
55
src/AtomUI.Controls/TreeView/TreeViewToken.cs
Normal file
55
src/AtomUI.Controls/TreeView/TreeViewToken.cs
Normal file
@ -0,0 +1,55 @@
|
||||
using AtomUI.Theme.TokenSystem;
|
||||
using Avalonia.Media;
|
||||
|
||||
namespace AtomUI.Controls;
|
||||
|
||||
[ControlDesignToken]
|
||||
internal class TreeViewToken : AbstractControlDesignToken
|
||||
{
|
||||
public const string ID = "TreeView";
|
||||
|
||||
public TreeViewToken()
|
||||
: base(ID)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 节点标题高度
|
||||
/// </summary>
|
||||
public double TitleHeight { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 节点悬浮态背景色
|
||||
/// </summary>
|
||||
public Color NodeHoverBg { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 节点选中态背景色
|
||||
/// </summary>
|
||||
public Color NodeSelectedBg { get; set; }
|
||||
|
||||
#region 内部 Token 定义
|
||||
|
||||
/// <summary>
|
||||
/// 目录树节点选中文字颜色
|
||||
/// </summary>
|
||||
public Color DirectoryNodeSelectedColor { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 目录树节点选中背景色
|
||||
/// </summary>
|
||||
public Color DirectoryNodeSelectedBg { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
internal override void CalculateFromAlias()
|
||||
{
|
||||
base.CalculateFromAlias();
|
||||
TitleHeight = _globalToken.HeightToken.ControlHeightSM;
|
||||
NodeHoverBg = _globalToken.ControlItemBgHover;
|
||||
NodeSelectedBg = _globalToken.ControlItemBgActive;
|
||||
|
||||
DirectoryNodeSelectedColor = _globalToken.ColorTextLightSolid;
|
||||
DirectoryNodeSelectedBg = _globalToken.ColorToken.ColorPrimaryToken.ColorPrimary;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user