-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
66 changed files
with
914 additions
and
268 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 9 additions & 1 deletion
10
...ioIntegration/Views/BalloonPopup.axaml.cs → ...oniaStyles/Controls/BalloonPopup.axaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
using System; | ||
using Avalonia; | ||
using Avalonia.Controls; | ||
|
||
namespace AvaloniaStyles.Controls; | ||
|
||
public class ThreeSidesPanel : Panel | ||
{ | ||
protected override Size MeasureOverride(Size availableSize) | ||
{ | ||
double totalWidth = 0; | ||
double maxHeight = 0; | ||
foreach (var child in Children) | ||
{ | ||
child.Measure(availableSize); | ||
maxHeight = Math.Max(maxHeight, child.DesiredSize.Height); | ||
totalWidth += child.DesiredSize.Width; | ||
} | ||
return new Size(totalWidth, maxHeight); | ||
} | ||
|
||
protected override Size ArrangeOverride(Size finalSize) | ||
{ | ||
double leftDesiredWidth = 0; | ||
double rightDesiredWidth = 0; | ||
double centerDesiredWidth = 0; | ||
Control? leftChild = null, centerChild = null, rightChild = null; | ||
for (var index = 0; index < Children.Count; index++) | ||
{ | ||
var child = Children[index]; | ||
var desiredWidth = child.DesiredSize.Width; | ||
if (index == 0) | ||
{ | ||
leftDesiredWidth = desiredWidth; | ||
leftChild = child; | ||
} | ||
else if (index == 1) | ||
{ | ||
rightDesiredWidth = desiredWidth; | ||
rightChild = child; | ||
} | ||
else if (index == 2) | ||
{ | ||
centerDesiredWidth = 400;//desiredWidth; | ||
centerChild = child; | ||
} | ||
} | ||
|
||
var totalWidth = finalSize.Width; | ||
|
||
var leftSpaceLeft = Math.Max(0, totalWidth / 2 - leftDesiredWidth); | ||
var rightSpaceLeft = Math.Max(0, totalWidth / 2 - rightDesiredWidth); | ||
|
||
var spaceLeft = leftSpaceLeft + rightSpaceLeft; | ||
centerDesiredWidth = Math.Min(spaceLeft, centerDesiredWidth); | ||
|
||
leftDesiredWidth = Math.Min(totalWidth - rightDesiredWidth, leftDesiredWidth); | ||
|
||
leftChild?.Arrange(new Rect(0, 0, leftDesiredWidth, finalSize.Height)); | ||
var centerRect = new Rect(Math.Max(leftDesiredWidth, finalSize.Width / 2 - centerDesiredWidth / 2), 0, | ||
centerDesiredWidth, finalSize.Height); | ||
var rightRect = new Rect(finalSize.Width - rightDesiredWidth, 0, rightDesiredWidth, finalSize.Height); | ||
var overflowRight = Math.Max(0, centerRect.Right - rightRect.Left); | ||
centerRect = new Rect(centerRect.X - overflowRight, centerRect.Y, centerRect.Width, centerRect.Height); | ||
centerChild?.Arrange(centerRect); | ||
rightChild?.Arrange(rightRect); | ||
|
||
return finalSize; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.