-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1005 from AvaloniaUI/monomac
MonoMac-based backend
- Loading branch information
Showing
32 changed files
with
1,778 additions
and
13 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
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,5 @@ | ||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<ItemGroup> | ||
<PackageReference Include="MonoMac.NetStandard" Version="0.0.3" /> | ||
</ItemGroup> | ||
</Project> |
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,33 @@ | ||
<Window xmlns="https://github.com/avaloniaui" MinWidth="500" MinHeight="300" | ||
Title="Avalonia Control Gallery" | ||
Icon="resm:ControlCatalog.Assets.test_icon.ico?assembly=ControlCatalog" | ||
xmlns:local="clr-namespace:ControlCatalog;assembly=ControlCatalog" HasSystemDecorations="False"> | ||
<Grid RowDefinitions="5,*,5" ColumnDefinitions="5,*,5"> | ||
<DockPanel Grid.Column="1" Grid.Row="1" > | ||
<Grid Name="TitleBar" Background="LightBlue" DockPanel.Dock="Top" ColumnDefinitions="Auto,*,Auto"> | ||
<TextBlock VerticalAlignment="Center" Margin="5,0,0,0">Title</TextBlock> | ||
<StackPanel Grid.Column="2" Orientation="Horizontal"> | ||
<StackPanel.Styles> | ||
<Style Selector="Button"> | ||
<Setter Property="Margin" Value="2"/> | ||
</Style> | ||
</StackPanel.Styles> | ||
<Button Name="MinimizeButton">_</Button> | ||
<Button Name="MaximizeButton">[ ]</Button> | ||
<Button Name="CloseButton">X</Button> | ||
</StackPanel> | ||
</Grid> | ||
<Border Background="White" Margin="5"> | ||
<TextBlock>Hello world!</TextBlock> | ||
</Border> | ||
</DockPanel> | ||
<Border Name="TopLeft" Background="Red"/> | ||
<Border Name="TopRight" Background="Red" Grid.Column="2" /> | ||
<Border Name="BottomLeft" Background="Red" Grid.Row="2" /> | ||
<Border Name="BottomRight" Background="Red" Grid.Row="2" Grid.Column="2"/> | ||
<Border Name="Top" Background="Blue" Grid.Column="1" /> | ||
<Border Name="Right" Background="Blue" Grid.Row="1" Grid.Column="2" /> | ||
<Border Name="Bottom" Background="Blue" Grid.Row="2" Grid.Column="1" /> | ||
<Border Name="Left" Background="Blue" Grid.Row="1" /> | ||
</Grid> | ||
</Window> |
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,53 @@ | ||
using Avalonia; | ||
using Avalonia.Controls; | ||
using Avalonia.Markup.Xaml; | ||
using System; | ||
using Avalonia.Input; | ||
|
||
namespace ControlCatalog | ||
{ | ||
public class DecoratedWindow : Window | ||
{ | ||
public DecoratedWindow() | ||
{ | ||
this.InitializeComponent(); | ||
this.AttachDevTools(); | ||
} | ||
|
||
void SetupSide(string name, StandardCursorType cursor, WindowEdge edge) | ||
{ | ||
var ctl = this.FindControl<Control>(name); | ||
ctl.Cursor = new Cursor(cursor); | ||
ctl.PointerPressed += delegate | ||
{ | ||
PlatformImpl.BeginResizeDrag(edge); | ||
}; | ||
} | ||
|
||
private void InitializeComponent() | ||
{ | ||
AvaloniaXamlLoader.Load(this); | ||
this.FindControl<Control>("TitleBar").PointerPressed += delegate | ||
{ | ||
PlatformImpl.BeginMoveDrag(); | ||
}; | ||
SetupSide("Left", StandardCursorType.LeftSide, WindowEdge.West); | ||
SetupSide("Right", StandardCursorType.RightSide, WindowEdge.East); | ||
SetupSide("Top", StandardCursorType.TopSide, WindowEdge.North); | ||
SetupSide("Bottom", StandardCursorType.BottomSize, WindowEdge.South); | ||
SetupSide("TopLeft", StandardCursorType.TopLeftCorner, WindowEdge.NorthWest); | ||
SetupSide("TopRight", StandardCursorType.TopRightCorner, WindowEdge.NorthEast); | ||
SetupSide("BottomLeft", StandardCursorType.BottomLeftCorner, WindowEdge.SouthWest); | ||
SetupSide("BottomRight", StandardCursorType.BottomRightCorner, WindowEdge.SouthEast); | ||
this.FindControl<Button>("MinimizeButton").Click += delegate { this.WindowState = WindowState.Minimized; }; | ||
this.FindControl<Button>("MaximizeButton").Click += delegate | ||
{ | ||
WindowState = WindowState == WindowState.Maximized ? WindowState.Normal : WindowState.Maximized; | ||
}; | ||
this.FindControl<Button>("CloseButton").Click += delegate | ||
{ | ||
Close(); | ||
}; | ||
} | ||
} | ||
} |
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,12 @@ | ||
<UserControl xmlns="https://github.com/avaloniaui"> | ||
<StackPanel Orientation="Vertical" Gap="4" Margin="4"> | ||
<Button Name="OpenFile">Open File</Button> | ||
<Button Name="SaveFile">Save File</Button> | ||
<Button Name="SelectFolder">Select Folder</Button> | ||
<StackPanel Orientation="Horizontal"> | ||
<CheckBox Name="IsModal" IsChecked="True"/> | ||
<TextBlock>Modal to window</TextBlock> | ||
</StackPanel> | ||
<Button Name="DecoratedWindow">Decorated window</Button> | ||
</StackPanel> | ||
</UserControl> |
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,46 @@ | ||
using Avalonia.Controls; | ||
using Avalonia.Markup.Xaml; | ||
#pragma warning disable 4014 | ||
|
||
namespace ControlCatalog.Pages | ||
{ | ||
public class DialogsPage : UserControl | ||
{ | ||
public DialogsPage() | ||
{ | ||
this.InitializeComponent(); | ||
this.FindControl<Button>("OpenFile").Click += delegate | ||
{ | ||
new OpenFileDialog() | ||
{ | ||
Title = "Open file" | ||
}.ShowAsync(GetWindow()); | ||
}; | ||
this.FindControl<Button>("SaveFile").Click += delegate | ||
{ | ||
new SaveFileDialog() | ||
{ | ||
Title = "Save file" | ||
}.ShowAsync(GetWindow()); | ||
}; | ||
this.FindControl<Button>("SelectFolder").Click += delegate | ||
{ | ||
new OpenFolderDialog() | ||
{ | ||
Title = "Select folder" | ||
}.ShowAsync(GetWindow()); | ||
}; | ||
this.FindControl<Button>("DecoratedWindow").Click += delegate | ||
{ | ||
new DecoratedWindow().Show(); | ||
}; | ||
} | ||
|
||
Window GetWindow() => this.FindControl<CheckBox>("IsModal").IsChecked ? (Window)this.VisualRoot : null; | ||
|
||
private void InitializeComponent() | ||
{ | ||
AvaloniaXamlLoader.Load(this); | ||
} | ||
} | ||
} |
Oops, something went wrong.