├── docs ├── logo │ ├── logo_en.png │ └── logo_ru.png └── images │ └── template_app.jpg ├── Samples ├── Application │ ├── Assets │ │ ├── Logo.png │ │ ├── icon.png │ │ └── Warn64.png │ ├── composer.json │ ├── Views │ │ ├── Pages │ │ │ ├── HomePage.php │ │ │ ├── ButtonsPage.php │ │ │ ├── FieldsPage.php │ │ │ ├── ColorZonePage.php │ │ │ ├── ProgressIndicatorsPage.php │ │ │ ├── HomePage.axaml │ │ │ ├── ProgressIndicatorsPage.axaml │ │ │ ├── FieldsPage.axaml │ │ │ └── ButtonsPage.axaml │ │ ├── MainWindow.axaml │ │ └── MainWindow.php │ ├── App.axaml │ ├── App.php │ ├── Program.php │ └── Application.msbuildproj ├── ThreadsApp │ ├── Assets │ │ └── Logo.png │ ├── composer.json │ ├── App.axaml │ ├── App.php │ ├── Views │ │ └── MainWindow.axaml │ ├── ThreadsApp.msbuildproj │ └── Program.php ├── MVVM │ ├── ViewLocator.php │ ├── ViewModels │ │ ├── ViewModelBase.php │ │ ├── AddItemViewModel.php │ │ ├── ToDoListViewModel.php │ │ └── MainWindowViewModel.php │ ├── composer.json │ ├── Services │ │ └── ToDoListService.php │ ├── Views │ │ ├── MainWindow.php │ │ ├── AddItemView.php │ │ ├── ToDoListView.php │ │ ├── MainWindow.axaml │ │ ├── AddItemView.axaml │ │ └── ToDoListView.axaml │ ├── App.axaml │ ├── Models │ │ └── TodoItem.php │ ├── App.php │ ├── MVVM.msbuildproj │ └── Program.php └── AvaloniaClock │ ├── composer.json │ ├── App.axaml │ ├── Views │ ├── MainWindow.axaml │ ├── MainWindow.php │ └── ClockPanel.php │ ├── App.php │ ├── Program.php │ └── AvaloniaClock.msbuildproj ├── nuget.config ├── reinstall-templates.ps1 ├── PHP Libraries └── Peachpie.Avalonia │ ├── src │ └── Peachpie │ │ └── Avalonia │ │ ├── Traits │ │ ├── BaseTrait.php │ │ ├── StyleKeyOverrideTrait.php │ │ ├── PropertyTrait.php │ │ ├── GetControlTrait.php │ │ └── EventTrait.php │ │ ├── Collections │ │ ├── UxDictionary.php │ │ └── UxObservableDictionary.php │ │ ├── IStyleKeyOverride.php │ │ ├── UxApplication.php │ │ └── Ux │ │ ├── Ux.php │ │ └── EventProxy.php │ ├── composer.json │ └── Peachpie.Avalonia.msbuildproj ├── Templates └── Peachpie.Avalonia.Templates │ ├── templates │ └── php │ │ ├── library │ │ ├── src │ │ │ └── HelloWorld.php │ │ ├── composer.json │ │ ├── PeachpieLibraryTemplate.msbuildproj │ │ └── .template.config │ │ │ └── template.json │ │ ├── avalonia.library │ │ ├── src │ │ │ └── HelloWorld.php │ │ ├── composer.json │ │ ├── PeachpieAvaloniaLibraryTemplate.msbuildproj │ │ └── .template.config │ │ │ └── template.json │ │ ├── console │ │ ├── composer.json │ │ ├── PeachpieConsoleAppTemplate.php │ │ ├── PeachpieConsoleAppTemplate.msbuildproj │ │ ├── .template.config │ │ │ └── template.json │ │ └── src │ │ │ └── Event.php │ │ ├── app │ │ ├── composer.json │ │ ├── src │ │ │ ├── App.axaml │ │ │ ├── Forms │ │ │ │ ├── MainWindow.axaml │ │ │ │ └── MainWindow.php │ │ │ └── App.php │ │ ├── PeachpieAvaloniaAppTemplate.php │ │ ├── PeachpieAvaloniaAppTemplate.msbuildproj │ │ └── .template.config │ │ │ └── template.json │ │ └── window │ │ ├── NewWindow.php │ │ ├── NewWindow.axaml │ │ └── .template.config │ │ └── template.json │ ├── Peachpie.Avalonia.Templates.csproj │ └── readme.md ├── PeachPie Extension Libraries ├── Peachpie.Avalonia.Core │ ├── src │ │ ├── Collections │ │ │ ├── AvaloniaObjectList.cs │ │ │ ├── AvaloniaDictionary.cs │ │ │ └── ObservableDictionary.cs │ │ ├── PhpExtension │ │ │ ├── ExtensionMethods.cs │ │ │ └── MessageBox.cs │ │ ├── Extension │ │ │ ├── Property.cs │ │ │ ├── ControlFinder.cs │ │ │ └── Event.cs │ │ ├── ViewLocatorBase.cs │ │ ├── StyleKeyOverride.cs │ │ └── AppPhpBuilder.cs │ ├── vendor │ │ └── Peachpie │ │ │ └── Avalonia │ │ │ └── Core │ │ │ ├── ViewLocatorBase.php │ │ │ ├── ExtensionMethods.php │ │ │ ├── Extension │ │ │ └── ControlFinder.php │ │ │ └── AppPhpBuilder.php │ └── Peachpie.Avalonia.Core.csproj ├── Peachpie.Community.ToolKit │ ├── src │ │ ├── Threading │ │ │ └── Tasks │ │ │ │ ├── ManagedTaskCreationOptions.cs │ │ │ │ ├── ManagedTaskException.cs │ │ │ │ └── ManagedTaskEventArgs.cs │ │ ├── Reactive │ │ │ └── ReactiveObject.cs │ │ ├── Output │ │ │ └── Logger.cs │ │ ├── TypeHelper.cs │ │ ├── Collections │ │ │ └── ObservableCollection.cs │ │ └── Listener │ │ │ └── Event.cs │ ├── vendor │ │ └── Peachpie │ │ │ └── Community │ │ │ ├── Threading │ │ │ ├── Tasks │ │ │ │ ├── ManagedTaskException.php │ │ │ │ ├── ManagedTaskEventArgs.php │ │ │ │ ├── ManagedTaskCreationOptions.php │ │ │ │ └── ManagedTask.php │ │ │ └── Timer.php │ │ │ ├── Reactive │ │ │ └── ReactiveObject.php │ │ │ ├── Listener │ │ │ └── Event.php │ │ │ ├── Output │ │ │ └── Logger.php │ │ │ ├── TypeHelper.php │ │ │ └── Collections │ │ │ └── ObservableCollection.php │ └── Peachpie.Community.ToolKit.csproj ├── Peachpie.Avalonia.Fonts.Inter │ ├── AppPhpBuilderFonts.cs │ ├── vendor │ │ └── Peachpie │ │ │ └── Avalonia │ │ │ └── Fonts │ │ │ └── Inter │ │ │ └── AppPhpBuilderFonts.php │ └── Peachpie.Avalonia.Fonts.Inter.csproj ├── Peachpie.Avalonia.Desktop │ ├── src │ │ └── AppPhpBuilderDesktop.cs │ ├── vendor │ │ └── Peachpie │ │ │ └── Avalonia │ │ │ └── Desktop │ │ │ └── AppPhpBuilderDesktop.php │ └── Peachpie.Avalonia.Desktop.csproj └── Peachpie.Vendor.Stubs │ ├── Peachpie.Vendor.Stubs.csproj │ ├── NugetResolver.cs │ ├── build │ └── Peachpie.Vendor.Stubs.targets │ ├── PackageDiscovery.cs │ ├── XmlDocProvider.cs │ ├── GeneratePhpStubs.cs │ └── PackageStubsRestore.cs ├── .github └── workflows │ └── PackagePublish.yml ├── LICENSE.md ├── Directory.Build.props └── .gitignore /docs/logo/logo_en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FibonacciFox/Peachpie.Avalonia/HEAD/docs/logo/logo_en.png -------------------------------------------------------------------------------- /docs/logo/logo_ru.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FibonacciFox/Peachpie.Avalonia/HEAD/docs/logo/logo_ru.png -------------------------------------------------------------------------------- /docs/images/template_app.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FibonacciFox/Peachpie.Avalonia/HEAD/docs/images/template_app.jpg -------------------------------------------------------------------------------- /Samples/Application/Assets/Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FibonacciFox/Peachpie.Avalonia/HEAD/Samples/Application/Assets/Logo.png -------------------------------------------------------------------------------- /Samples/Application/Assets/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FibonacciFox/Peachpie.Avalonia/HEAD/Samples/Application/Assets/icon.png -------------------------------------------------------------------------------- /Samples/ThreadsApp/Assets/Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FibonacciFox/Peachpie.Avalonia/HEAD/Samples/ThreadsApp/Assets/Logo.png -------------------------------------------------------------------------------- /Samples/Application/Assets/Warn64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FibonacciFox/Peachpie.Avalonia/HEAD/Samples/Application/Assets/Warn64.png -------------------------------------------------------------------------------- /Samples/MVVM/ViewLocator.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /reinstall-templates.ps1: -------------------------------------------------------------------------------- 1 | dotnet new uninstall Peachpie.Avalonia.Templates 2 | cd ./Templates/Peachpie.Avalonia.Templates/ 3 | dotnet build 4 | dotnet new install Peachpie.Avalonia.Templates 5 | pause -------------------------------------------------------------------------------- /Samples/MVVM/ViewModels/ViewModelBase.php: -------------------------------------------------------------------------------- 1 | =8.1" 5 | }, 6 | "license": "MIT", 7 | "authors": [ { "name": "FibonacciFox" } ], 8 | "autoload": { 9 | "psr-4": { 10 | "Peachpie\\Avalonia\\": "src/" 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /Templates/Peachpie.Avalonia.Templates/templates/php/avalonia.library/src/HelloWorld.php: -------------------------------------------------------------------------------- 1 | 7 | { 8 | public bool IsReadOnly => ((ICollection)this).IsReadOnly; 9 | } -------------------------------------------------------------------------------- /PHP Libraries/Peachpie.Avalonia/src/Peachpie/Avalonia/IStyleKeyOverride.php: -------------------------------------------------------------------------------- 1 | =8.4" 7 | }, 8 | "license": "MIT", 9 | "authors": [ { "name": "FibonacciFox" } ], 10 | "autoload": { 11 | "psr-4": { 12 | "": "" 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /Samples/Application/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fibonaccifox/application", 3 | "description": "Application", 4 | "type": "application", 5 | "require": { 6 | "php": ">=8.4" 7 | }, 8 | "license": "MIT", 9 | "authors": [ { "name": "FibonacciFox" } ], 10 | "autoload": { 11 | "psr-4": { 12 | "": "" 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /Samples/AvaloniaClock/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fibonaccifox/application", 3 | "description": "Application", 4 | "type": "application", 5 | "require": { 6 | "php": ">=8.1" 7 | }, 8 | "license": "MIT", 9 | "authors": [ { "name": "FibonacciFox" } ], 10 | "autoload": { 11 | "psr-4": { 12 | "": "" 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /Samples/ThreadsApp/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fibonaccifox/application", 3 | "description": "ThreadsApp", 4 | "type": "application", 5 | "require": { 6 | "php": ">=8.1" 7 | }, 8 | "license": "MIT", 9 | "authors": [ { "name": "FibonacciFox" } ], 10 | "autoload": { 11 | "psr-4": { 12 | "": "" 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /PeachPie Extension Libraries/Peachpie.Avalonia.Core/vendor/Peachpie/Avalonia/Core/ViewLocatorBase.php: -------------------------------------------------------------------------------- 1 | =8.4" 7 | }, 8 | "license": "MIT", 9 | "authors": [ { "name": "author" } ], 10 | "autoload": { 11 | "psr-4": { 12 | "PeachpieConsoleAppTemplate\\": "src/" 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /PeachPie Extension Libraries/Peachpie.Avalonia.Core/src/PhpExtension/ExtensionMethods.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Threading; 2 | using Pchp.Core; 3 | 4 | [assembly: PhpExtension] 5 | 6 | namespace Peachpie.Avalonia.Core.PhpExtension; 7 | 8 | public static class ExtensionMethods 9 | { 10 | public static void UiLater(Context ctx, IPhpCallable callback) 11 | { 12 | Dispatcher.UIThread.Post(() => callback.Invoke(ctx)); 13 | } 14 | } -------------------------------------------------------------------------------- /Samples/ThreadsApp/App.axaml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /PeachPie Extension Libraries/Peachpie.Community.ToolKit/src/Threading/Tasks/ManagedTaskException.cs: -------------------------------------------------------------------------------- 1 | 2 | using Pchp.Library.Spl; 3 | 4 | namespace Peachpie.Community.Threading.Tasks; 5 | 6 | public class ManagedTaskException : Exception 7 | { 8 | public ManagedTaskException(string message) 9 | : base(message) { } 10 | 11 | public ManagedTaskException(string message, long inner) 12 | : base(message, inner) { } 13 | } -------------------------------------------------------------------------------- /Samples/AvaloniaClock/App.axaml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Templates/Peachpie.Avalonia.Templates/templates/php/library/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "PeachpieLibraryTemplate", 3 | "description": "The Peachpie Library.", 4 | "type": "library", 5 | "version": "1.0.0", 6 | "require": { 7 | "php": ">=8.4" 8 | }, 9 | "license": "MIT", 10 | "authors": [ { "name": "author" } ], 11 | "autoload": { 12 | "psr-4": { 13 | "PeachpieLibraryTemplate\\": "src/" 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /Samples/MVVM/Services/ToDoListService.php: -------------------------------------------------------------------------------- 1 | =8.4" 7 | }, 8 | "license": "MIT", 9 | "authors": [ { "name": "author" } ], 10 | "autoload": { 11 | "psr-4": { 12 | "PeachpieAvaloniaAppTemplate\\": "src/" 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /Templates/Peachpie.Avalonia.Templates/templates/php/window/NewWindow.php: -------------------------------------------------------------------------------- 1 | InitializeComponent(); 11 | } 12 | 13 | public function InitializeComponent(): void 14 | { 15 | AvaloniaXamlLoader::Load(obj:$this); 16 | } 17 | } 18 | 19 | -------------------------------------------------------------------------------- /PeachPie Extension Libraries/Peachpie.Avalonia.Core/src/Collections/AvaloniaDictionary.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Collections; 2 | using Pchp.Core; 3 | 4 | namespace Peachpie.Avalonia.Core.Collections; 5 | 6 | public class AvaloniaDictionary 7 | { 8 | [PhpHidden] 9 | public AvaloniaDictionary Data { get;} = new(); 10 | public object this[object key] 11 | { 12 | get { return Data[key]; } 13 | set { Data[key] = value; } 14 | } 15 | } -------------------------------------------------------------------------------- /PeachPie Extension Libraries/Peachpie.Avalonia.Core/src/Extension/Property.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Controls; 3 | 4 | 5 | namespace Peachpie.Avalonia.Core.Extension; 6 | 7 | public static class Property 8 | { 9 | public static StyledProperty Register(string nameProperty) 10 | { 11 | #pragma warning disable AVP1001 12 | return AvaloniaProperty.Register(nameProperty); 13 | #pragma warning restore AVP1001 14 | } 15 | } -------------------------------------------------------------------------------- /PHP Libraries/Peachpie.Avalonia/src/Peachpie/Avalonia/Traits/StyleKeyOverrideTrait.php: -------------------------------------------------------------------------------- 1 | _description; 12 | } 13 | 14 | public function set_Description(\System\String $description): void { 15 | $this->_description = $description; 16 | $this->OnPropertyChanged(); 17 | } 18 | } -------------------------------------------------------------------------------- /Templates/Peachpie.Avalonia.Templates/templates/php/app/src/App.axaml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Templates/Peachpie.Avalonia.Templates/templates/php/avalonia.library/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "PeachpieAvaloniaLibraryTemplate", 3 | "description": "A library that extends PeachPie capabilities for Avalonia UI.", 4 | "type": "library", 5 | "version": "1.0.0", 6 | "require": { 7 | "php": ">=8.4" 8 | }, 9 | "license": "MIT", 10 | "authors": [ { "name": "author" } ], 11 | "autoload": { 12 | "psr-4": { 13 | "PeachpieAvaloniaLibraryTemplate\\": "src/" 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /Samples/Application/Views/Pages/HomePage.php: -------------------------------------------------------------------------------- 1 | InitializeComponent(); 13 | } 14 | 15 | private function InitializeComponent(): void 16 | { 17 | AvaloniaXamlLoader::Load(obj:$this); 18 | } 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /Samples/Application/Views/Pages/ButtonsPage.php: -------------------------------------------------------------------------------- 1 | InitializeComponent(); 13 | } 14 | 15 | private function InitializeComponent(): void 16 | { 17 | AvaloniaXamlLoader::Load(obj:$this); 18 | } 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /Samples/Application/Views/Pages/FieldsPage.php: -------------------------------------------------------------------------------- 1 | InitializeComponent(); 13 | } 14 | 15 | private function InitializeComponent(): void 16 | { 17 | AvaloniaXamlLoader::Load(obj:$this); 18 | } 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /Samples/Application/Views/Pages/ColorZonePage.php: -------------------------------------------------------------------------------- 1 | InitializeComponent(); 13 | } 14 | 15 | private function InitializeComponent(): void 16 | { 17 | AvaloniaXamlLoader::Load(obj:$this); 18 | } 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /Samples/MVVM/ViewModels/ToDoListViewModel.php: -------------------------------------------------------------------------------- 1 | listItems = new ObservableCollection($Items); 15 | } 16 | 17 | public function get_ListItems() : ObservableCollection 18 | { 19 | return $this->listItems; 20 | } 21 | 22 | } -------------------------------------------------------------------------------- /PeachPie Extension Libraries/Peachpie.Community.ToolKit/src/Reactive/ReactiveObject.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using System.Runtime.CompilerServices; 3 | 4 | namespace Peachpie.Community.Reactive; 5 | 6 | public class ReactiveObject : INotifyPropertyChanged 7 | { 8 | public event PropertyChangedEventHandler? PropertyChanged; 9 | 10 | protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) 11 | { 12 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 13 | } 14 | } -------------------------------------------------------------------------------- /PeachPie Extension Libraries/Peachpie.Community.ToolKit/src/Threading/Tasks/ManagedTaskEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Peachpie.Community.Threading.Tasks; 4 | 5 | public class ManagedTaskEventArgs : EventArgs 6 | { 7 | public int TaskId { get; } 8 | public object Result { get; } 9 | 10 | public ManagedTaskEventArgs(int taskId) 11 | { 12 | TaskId = taskId; 13 | } 14 | 15 | public ManagedTaskEventArgs(int taskId, object result) 16 | { 17 | TaskId = taskId; 18 | Result = result; 19 | } 20 | } -------------------------------------------------------------------------------- /Samples/MVVM/Views/MainWindow.php: -------------------------------------------------------------------------------- 1 | InitializeComponent(); 13 | } 14 | 15 | //Не удаляйте метод, если используете разметку axaml 16 | public function InitializeComponent(): void 17 | { 18 | AvaloniaXamlLoader::Load(obj:$this); 19 | } 20 | } 21 | 22 | } -------------------------------------------------------------------------------- /Templates/Peachpie.Avalonia.Templates/templates/php/window/NewWindow.axaml: -------------------------------------------------------------------------------- 1 | 9 | Welcome to PHP Avalonia! 10 | -------------------------------------------------------------------------------- /PeachPie Extension Libraries/Peachpie.Community.ToolKit/vendor/Peachpie/Community/Threading/Tasks/ManagedTaskException.php: -------------------------------------------------------------------------------- 1 | 11 | -------------------------------------------------------------------------------- /Samples/MVVM/Views/AddItemView.php: -------------------------------------------------------------------------------- 1 | InitializeComponent(); 13 | } 14 | 15 | //Не удаляйте метод, если используете разметку axaml 16 | public function InitializeComponent(): void 17 | { 18 | AvaloniaXamlLoader::Load(obj:$this); 19 | } 20 | } 21 | 22 | } -------------------------------------------------------------------------------- /Samples/MVVM/Views/ToDoListView.php: -------------------------------------------------------------------------------- 1 | InitializeComponent(); 13 | } 14 | 15 | //Не удаляйте метод, если используете разметку axaml 16 | public function InitializeComponent(): void 17 | { 18 | AvaloniaXamlLoader::Load(obj:$this); 19 | } 20 | } 21 | 22 | } -------------------------------------------------------------------------------- /Templates/Peachpie.Avalonia.Templates/templates/php/console/PeachpieConsoleAppTemplate.php: -------------------------------------------------------------------------------- 1 | getDescription() . "\n"; 9 | echo "Days until event: " . $event->daysUntil() . "\n"; 10 | 11 | $event->postpone(5); 12 | echo "After postponing 5 days: " . $event->getDescription() . "\n"; 13 | 14 | $event->advance(3); 15 | echo "After advancing 3 days: " . $event->getDescription() . "\n"; 16 | 17 | -------------------------------------------------------------------------------- /Samples/MVVM/App.axaml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /PeachPie Extension Libraries/Peachpie.Community.ToolKit/vendor/Peachpie/Community/Threading/Tasks/ManagedTaskEventArgs.php: -------------------------------------------------------------------------------- 1 | TaskId = $taskId; 19 | $this->Result = $result; 20 | } 21 | 22 | } -------------------------------------------------------------------------------- /Samples/Application/App.axaml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Samples/MVVM/Views/MainWindow.axaml: -------------------------------------------------------------------------------- 1 | 13 | -------------------------------------------------------------------------------- /Templates/Peachpie.Avalonia.Templates/templates/php/app/src/Forms/MainWindow.axaml: -------------------------------------------------------------------------------- 1 | 9 | 10 | -------------------------------------------------------------------------------- /PeachPie Extension Libraries/Peachpie.Avalonia.Fonts.Inter/AppPhpBuilderFonts.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Peachpie.Avalonia.Core; 3 | 4 | namespace Peachpie.Avalonia.Fonts.Inter; 5 | 6 | public static class AppPhpBuilderFonts 7 | { 8 | /// 9 | /// Configures the application to use the Inter font. 10 | /// Настраивает приложение для использования шрифта Inter. 11 | /// 12 | /// The current instance of AppPhpBuilder. / Текущий экземпляр AppPhpBuilder. 13 | public static AppPhpBuilder WithInterFont(this AppPhpBuilder appPhpBuilder) 14 | { 15 | appPhpBuilder.Builder.WithInterFont(); 16 | return appPhpBuilder; 17 | } 18 | } -------------------------------------------------------------------------------- /PeachPie Extension Libraries/Peachpie.Avalonia.Core/vendor/Peachpie/Avalonia/Core/ExtensionMethods.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | PeachpieConsoleAppTemplate.php 6 | net9.0 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /PeachPie Extension Libraries/Peachpie.Avalonia.Desktop/src/AppPhpBuilderDesktop.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Peachpie.Avalonia.Core; 3 | 4 | namespace Peachpie.Avalonia.Desktop; 5 | 6 | public static class AppPhpBuilderDesktop 7 | { 8 | /// 9 | /// Configures the application to use platform detection. 10 | /// Настраивает приложение относительно платформы. 11 | /// 12 | /// The current instance of AppPhpBuilder. / Текущий экземпляр AppPhpBuilder. 13 | public static AppPhpBuilder UsePlatformDetect(this AppPhpBuilder appPhpBuilder) 14 | { 15 | appPhpBuilder.Builder.UsePlatformDetect(); 16 | return appPhpBuilder; 17 | } 18 | 19 | } -------------------------------------------------------------------------------- /PeachPie Extension Libraries/Peachpie.Community.ToolKit/vendor/Peachpie/Community/Reactive/ReactiveObject.php: -------------------------------------------------------------------------------- 1 | PropertyChanged->Invoke($this, new PropertyChangedEventArgs($propertyName)); 22 | } 23 | } -------------------------------------------------------------------------------- /PeachPie Extension Libraries/Peachpie.Community.ToolKit/vendor/Peachpie/Community/Listener/Event.php: -------------------------------------------------------------------------------- 1 | InitializeComponent(); 12 | } 13 | 14 | public function OnFrameworkInitializationCompleted(): void 15 | { 16 | //Desktop 17 | if ($this->IsClassicDesktopStyleApplicationLifetime()) { 18 | $this->ApplicationLifetime->MainWindow = new MainWindow(); 19 | } 20 | 21 | parent::OnFrameworkInitializationCompleted(); 22 | } 23 | 24 | private function InitializeComponent(): void 25 | { 26 | AvaloniaXamlLoader::Load(obj:$this); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /Templates/Peachpie.Avalonia.Templates/templates/php/window/.template.config/template.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/template", 3 | "author": "FibonacciFox", 4 | "classifications": [ "Desktop", "PeachPie", "Xaml", "Avalonia", "Windows", "Linux", "macOS" ], 5 | "description": "An Avalonia UI PHP Window", 6 | "groupIdentity": "Peachpie.Avalonia.Window", 7 | "identity": "Peachpie.Avalonia.Window", 8 | "name": "Avalonia PHP Window", 9 | "shortName": "php.avalonia.window", 10 | "sourceName": "NewWindow", 11 | "defaultName": "Window", 12 | "preferNameDirectory": false, 13 | "primaryOutputs": [ 14 | { "path": "NewWindow.php" }, 15 | { "path": "NewWindow.axaml" } 16 | ], 17 | "tags": { 18 | "language": "PHP", 19 | "type": "item" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /PeachPie Extension Libraries/Peachpie.Avalonia.Core/src/PhpExtension/MessageBox.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Controls; 3 | using MsBox.Avalonia; 4 | using MsBox.Avalonia.Enums; 5 | using Pchp.Core; 6 | 7 | [assembly: PhpExtension] 8 | 9 | 10 | namespace Peachpie.Avalonia.Core.PhpExtension; 11 | 12 | public static class MessageBox 13 | { 14 | public static async void Alert([ImportValue(ImportValueAttribute.ValueSpec.This)] Window owner, PhpValue value) 15 | { 16 | var box = MessageBoxManager.GetMessageBoxStandard("Alert", value.String, ButtonEnum.Ok, Icon.Warning, WindowStartupLocation.CenterOwner); 17 | var textBlock = new TextBlock(); 18 | var text = textBlock.GetObservable(TextBlock.TextProperty); 19 | await box.ShowWindowDialogAsync(owner); 20 | } 21 | } -------------------------------------------------------------------------------- /Samples/MVVM/Models/TodoItem.php: -------------------------------------------------------------------------------- 1 | description; 12 | } 13 | public function set_Description(string $value) : void { 14 | $this->description = $value; 15 | } 16 | 17 | public function get_IsChecked() : bool { 18 | return $this->isChecked; 19 | } 20 | public function set_IsChecked(bool $value) : void { 21 | $this->isChecked = $value; 22 | } 23 | 24 | public function __construct(string $description, bool $isChecked = false) 25 | { 26 | $this->set_Description($description); 27 | $this->set_IsChecked($isChecked); 28 | } 29 | } -------------------------------------------------------------------------------- /Samples/AvaloniaClock/Views/MainWindow.php: -------------------------------------------------------------------------------- 1 | InitializeComponent(); 15 | 16 | $clockPanel = new ClockPanel(); 17 | $this->Content = $clockPanel; 18 | } 19 | 20 | private function InitializeComponent(): void 21 | { 22 | AvaloniaXamlLoader::Load(obj:$this); 23 | 24 | if ( defined('DEBUG') ) { 25 | Logger::Info("Debug Build!"); 26 | } 27 | } 28 | } 29 | 30 | } -------------------------------------------------------------------------------- /Samples/MVVM/App.php: -------------------------------------------------------------------------------- 1 | InitializeComponent(); 15 | } 16 | 17 | public function OnFrameworkInitializationCompleted() : void { 18 | $main = new MainWindow(); 19 | $main->DataContext = new MainWindowViewModel(); 20 | $this->ApplicationLifetime->MainWindow = $main; 21 | } 22 | 23 | public function InitializeComponent(): void 24 | { 25 | AvaloniaXamlLoader::Load(obj:$this); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /PHP Libraries/Peachpie.Avalonia/src/Peachpie/Avalonia/Traits/GetControlTrait.php: -------------------------------------------------------------------------------- 1 | ($name); 21 | return ControlFinder::ByName($this, $name); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /PeachPie Extension Libraries/Peachpie.Avalonia.Desktop/vendor/Peachpie/Avalonia/Desktop/AppPhpBuilderDesktop.php: -------------------------------------------------------------------------------- 1 | InitializeComponent(); 14 | } 15 | 16 | public function OnFrameworkInitializationCompleted(): void 17 | { 18 | //Desktop 19 | if ($this->IsClassicDesktopStyleApplicationLifetime()) { 20 | $this->ApplicationLifetime->MainWindow = new MainWindow(); 21 | } 22 | 23 | parent::OnFrameworkInitializationCompleted(); 24 | } 25 | 26 | private function InitializeComponent(): void 27 | { 28 | AvaloniaXamlLoader::Load(obj:$this); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /Samples/AvaloniaClock/App.php: -------------------------------------------------------------------------------- 1 | InitializeComponent(); 12 | } 13 | 14 | public function OnFrameworkInitializationCompleted(): void 15 | { 16 | //Desktop 17 | if ($this->IsClassicDesktopStyleApplicationLifetime()) { 18 | $this->ApplicationLifetime->MainWindow = new MainWindow(); 19 | } 20 | 21 | //Mobile 22 | // if ($this->IsSingleViewApplicationLifetime()) { 23 | // $this->ApplicationLifetime->MainView = new MyControl(); 24 | // } 25 | 26 | parent::OnFrameworkInitializationCompleted(); 27 | } 28 | 29 | private function InitializeComponent(): void 30 | { 31 | AvaloniaXamlLoader::Load(obj:$this); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Samples/Application/App.php: -------------------------------------------------------------------------------- 1 | InitializeComponent(); 12 | } 13 | 14 | public function OnFrameworkInitializationCompleted(): void 15 | { 16 | //Desktop 17 | if ($this->IsClassicDesktopStyleApplicationLifetime()) { 18 | $this->ApplicationLifetime->MainWindow = new MainWindow(); 19 | } 20 | 21 | //Mobile 22 | // if ($this->IsSingleViewApplicationLifetime()) { 23 | // $this->ApplicationLifetime->MainView = new MyControl(); 24 | // } 25 | 26 | parent::OnFrameworkInitializationCompleted(); 27 | } 28 | 29 | private function InitializeComponent(): void 30 | { 31 | AvaloniaXamlLoader::Load(obj:$this); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /PeachPie Extension Libraries/Peachpie.Community.ToolKit/vendor/Peachpie/Community/Output/Logger.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net9.0 5 | True 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | vendor 21 | true 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /PeachPie Extension Libraries/Peachpie.Avalonia.Core/vendor/Peachpie/Avalonia/Core/Extension/ControlFinder.php: -------------------------------------------------------------------------------- 1 | 9 | 10 | 13 | 16 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /PeachPie Extension Libraries/Peachpie.Vendor.Stubs/Peachpie.Vendor.Stubs.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | $(NoWarn);1591;8632 6 | Peachpie.Vendor.Stubs 7 | php;sdk;stubs 8 | True 9 | The library synchronizes PHP stubs from Nuget libraries with the project root directory. 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Samples/ThreadsApp/Views/MainWindow.axaml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | 17 | 18 | 19 | 20 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /PeachPie Extension Libraries/Peachpie.Community.ToolKit/vendor/Peachpie/Community/TypeHelper.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Template 5 | Peachpie.Avalonia.Templates 6 | Peachpie Avalonia Templates 7 | Templates for creating Avalonia PHP applications and libraries. 8 | dotnet-new;templates;php-avalonia 9 | True 10 | netstandard2.0 11 | true 12 | false 13 | content 14 | true 15 | true 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /PeachPie Extension Libraries/Peachpie.Avalonia.Desktop/Peachpie.Avalonia.Desktop.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(TargetFrameworkVersion) 5 | $(NoWarn);1591;8632 6 | Peachpie.Avalonia.Desktop 7 | Peachpie.Avalonia.Desktop 8 | peachpie;peachpie-avalonia-desktop; 9 | True 10 | A library that extends PeachPie capabilities for Avalonia UI. 11 | Peachpie.Avalonia.Desktop 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | vendor 26 | true 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /PeachPie Extension Libraries/Peachpie.Community.ToolKit/src/TypeHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Peachpie.Community; 4 | 5 | /// 6 | /// Utility methods for working with .NET types from PeachPie. 7 | /// 8 | public static class TypeHelper 9 | { 10 | /// 11 | /// Gets the System.Type of the provided non-null object instance. 12 | /// 13 | /// Any non-null object. 14 | /// The runtime type of . 15 | /// 16 | public static Type GetObjectType(object obj) 17 | { 18 | if (obj == null) throw new ArgumentNullException(nameof(obj)); 19 | return obj.GetType(); 20 | } 21 | 22 | /// 23 | /// Gets the base type of the provided object's runtime type, 24 | /// or null if this type is or an interface. 25 | /// 26 | /// Any non-null object. 27 | /// The base type, or null if none. 28 | /// 29 | public static Type? GetBaseType(object obj) 30 | { 31 | if (obj == null) throw new ArgumentNullException(nameof(obj)); 32 | return obj.GetType().BaseType; 33 | } 34 | } -------------------------------------------------------------------------------- /PeachPie Extension Libraries/Peachpie.Avalonia.Fonts.Inter/Peachpie.Avalonia.Fonts.Inter.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(TargetFrameworkVersion) 5 | $(NoWarn);1591;8632 6 | Peachpie.Avalonia.Fonts.Inter 7 | Peachpie.Avalonia.Fonts.Inter 8 | peachpie;peachpie-avalonia-fonts-inter; 9 | True 10 | A library that extends PeachPie capabilities for Avalonia UI. 11 | Peachpie.Avalonia.Fonts.Inter 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | vendor 26 | true 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /Samples/ThreadsApp/Program.php: -------------------------------------------------------------------------------- 1 | Args = null; 13 | $lifetime->ShutdownMode = ShutdownMode::OnMainWindowClose; 14 | 15 | // Конфигурация AppPhpBuilder с указанием типа приложения и имени сборки 16 | // Configure AppPhpBuilder with the specified application type and assembly name 17 | $appPhpBuilder = AppPhpBuilder::Configure("App"); 18 | $appPhpBuilder = AppPhpBuilderDesktop::UsePlatformDetect($appPhpBuilder); // Настройка платформенной детекции / Configure platform detection 19 | $appPhpBuilder = AppPhpBuilderFonts::WithInterFont($appPhpBuilder); // Использование шрифта Inter / Use the Inter font 20 | $appPhpBuilder->LogToTrace(); // Логирование в Trace / Log to Trace 21 | $appPhpBuilder->SetupWithLifetime($lifetime); // Настройка времени жизни приложения / Set up application lifetime 22 | 23 | // Запуск приложения 24 | // Start the application 25 | $lifetime->Start(args: null); 26 | -------------------------------------------------------------------------------- /Samples/MVVM/Program.php: -------------------------------------------------------------------------------- 1 | Args = null; 13 | $lifetime->ShutdownMode = ShutdownMode::OnMainWindowClose; 14 | 15 | // Конфигурация AppPhpBuilder с указанием типа приложения и имени сборки 16 | // Configure AppPhpBuilder with the specified application type and assembly name 17 | $appPhpBuilder = AppPhpBuilder::Configure("App", "MVVM"); 18 | $appPhpBuilder = AppPhpBuilderDesktop::UsePlatformDetect($appPhpBuilder); // Настройка платформенной детекции / Configure platform detection 19 | $appPhpBuilder = AppPhpBuilderFonts::WithInterFont($appPhpBuilder); // Использование шрифта Inter / Use the Inter font 20 | $appPhpBuilder->LogToTrace(); // Логирование в Trace / Log to Trace 21 | $appPhpBuilder->SetupWithLifetime($lifetime); // Настройка времени жизни приложения / Set up application lifetime 22 | 23 | // Запуск приложения 24 | // Start the application 25 | $lifetime->Start(args: null); 26 | -------------------------------------------------------------------------------- /Samples/Application/Program.php: -------------------------------------------------------------------------------- 1 | Args = null; 13 | $lifetime->ShutdownMode = ShutdownMode::OnMainWindowClose; 14 | 15 | // Конфигурация AppPhpBuilder с указанием типа приложения и имени сборки 16 | // Configure AppPhpBuilder with the specified application type and assembly name 17 | $appPhpBuilder = AppPhpBuilder::Configure("App", "Application"); 18 | $appPhpBuilder = AppPhpBuilderDesktop::UsePlatformDetect($appPhpBuilder); // Настройка платформенной детекции / Configure platform detection 19 | $appPhpBuilder = AppPhpBuilderFonts::WithInterFont($appPhpBuilder); // Использование шрифта Inter / Use the Inter font 20 | $appPhpBuilder->LogToTrace(); // Логирование в Trace / Log to Trace 21 | $appPhpBuilder->SetupWithLifetime($lifetime); // Настройка времени жизни приложения / Set up application lifetime 22 | 23 | // Запуск приложения 24 | // Start the application 25 | $lifetime->Start(args: null); 26 | -------------------------------------------------------------------------------- /Samples/AvaloniaClock/Program.php: -------------------------------------------------------------------------------- 1 | Args = null; 13 | $lifetime->ShutdownMode = ShutdownMode::OnMainWindowClose; 14 | 15 | // Конфигурация AppPhpBuilder с указанием типа приложения и имени сборки 16 | // Configure AppPhpBuilder with the specified application type and assembly name 17 | $appPhpBuilder = AppPhpBuilder::Configure("App", "AvaloniaClock"); 18 | $appPhpBuilder = AppPhpBuilderDesktop::UsePlatformDetect($appPhpBuilder); // Настройка платформенной детекции / Configure platform detection 19 | $appPhpBuilder = AppPhpBuilderFonts::WithInterFont($appPhpBuilder); // Использование шрифта Inter / Use the Inter font 20 | $appPhpBuilder->LogToTrace(); // Логирование в Trace / Log to Trace 21 | $appPhpBuilder->SetupWithLifetime($lifetime); // Настройка времени жизни приложения / Set up application lifetime 22 | 23 | // Запуск приложения 24 | // Start the application 25 | $lifetime->Start(args: null); 26 | -------------------------------------------------------------------------------- /Templates/Peachpie.Avalonia.Templates/templates/php/avalonia.library/PeachpieAvaloniaLibraryTemplate.msbuildproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net9.0 5 | True 6 | 7 | true 8 | true 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | vendor 24 | true 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /PeachPie Extension Libraries/Peachpie.Avalonia.Core/Peachpie.Avalonia.Core.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | $(TargetFrameworkVersion) 4 | $(NoWarn);1591;8632 5 | Peachpie.Avalonia.Core 6 | Peachpie.Avalonia.Core 7 | peachpie;peachpie-avalonia-core; 8 | True 9 | A library that extends PeachPie capabilities for Avalonia UI. 10 | Peachpie.Avalonia.Core 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | vendor 25 | true 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /Samples/AvaloniaClock/AvaloniaClock.msbuildproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | WinExe 6 | Program.php 7 | $(TargetFrameworkVersion) 8 | AvaloniaClock 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 30 | -------------------------------------------------------------------------------- /Templates/Peachpie.Avalonia.Templates/templates/php/app/PeachpieAvaloniaAppTemplate.php: -------------------------------------------------------------------------------- 1 | Args = null; 13 | $lifetime->ShutdownMode = ShutdownMode::OnMainWindowClose; 14 | 15 | // Конфигурация AppPhpBuilder с указанием типа приложения и имени сборки 16 | // Configure AppPhpBuilder with the specified application type and assembly name 17 | $appPhpBuilder = AppPhpBuilder::Configure("App", "PeachpieAvaloniaAppTemplate"); 18 | // Настройка платформенной детекции 19 | // Configure platform detection 20 | $appPhpBuilder = AppPhpBuilderDesktop::UsePlatformDetect($appPhpBuilder); 21 | // Использование шрифта Inter 22 | // Use the Inter font 23 | $appPhpBuilder = AppPhpBuilderFonts::WithInterFont($appPhpBuilder); 24 | // Логирование в Trace 25 | // Log to Trace 26 | $appPhpBuilder->LogToTrace(); 27 | // Настройка времени жизни приложения 28 | // Set up application lifetime 29 | $appPhpBuilder->SetupWithLifetime($lifetime); 30 | 31 | // Запуск приложения 32 | // Start the application 33 | $lifetime->Start(args: null); 34 | -------------------------------------------------------------------------------- /Samples/Application/Application.msbuildproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | WinExe 4 | Program.php 5 | $(TargetFrameworkVersion) 6 | Application 7 | true 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 | 32 | -------------------------------------------------------------------------------- /Templates/Peachpie.Avalonia.Templates/templates/php/app/PeachpieAvaloniaAppTemplate.msbuildproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinExe 5 | PeachpieAvaloniaAppTemplate.php 6 | net9.0 7 | 8 | true 9 | true 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 29 | -------------------------------------------------------------------------------- /PHP Libraries/Peachpie.Avalonia/src/Peachpie/Avalonia/Ux/Ux.php: -------------------------------------------------------------------------------- 1 | onClick(...) 12 | * Кэширует EventProxy, чтобы один Control имел один прокси. 13 | */ 14 | final class Ux 15 | { 16 | /** @var SplObjectStorage */ 17 | private static ?SplObjectStorage $map = null; 18 | 19 | public static function of(Control $c): EventProxy 20 | { 21 | if (self::$map === null) self::$map = new SplObjectStorage(); 22 | if (!isset(self::$map[$c])) self::$map[$c] = new EventProxy($c); 23 | return self::$map[$c]; 24 | } 25 | 26 | public static function on(Control $c, string|array $ev, callable $h): EventProxy 27 | { 28 | return self::of($c)->on($ev, $h); 29 | } 30 | 31 | public static function once(Control $c, string $ev, callable $h): EventProxy 32 | { 33 | return self::of($c)->once($ev, $h); 34 | } 35 | 36 | public static function off(Control $c, string $ev, ?callable $h = null): EventProxy 37 | { 38 | return self::of($c)->off($ev, $h); 39 | } 40 | 41 | public static function offAll(Control $c): void 42 | { 43 | self::of($c)->offAll(); 44 | } 45 | 46 | // Удобный хелпер поиска по имени (делегирует ControlFinder) 47 | public static function find(Control $root, string $name): mixed 48 | { 49 | return ControlFinder::ByName($root, $name); 50 | } 51 | } 52 | 53 | /** Необязательный глобальный сахар: ux($control)->onClick(...) */ 54 | function ux(Control $c): EventProxy { return Ux::of($c); } 55 | -------------------------------------------------------------------------------- /PHP Libraries/Peachpie.Avalonia/Peachpie.Avalonia.msbuildproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | $(TargetFrameworkVersion) 4 | $(NoWarn);1591;8632 5 | Peachpie.Avalonia 6 | Peachpie.Avalonia 7 | peachpie;peachpie-avalonia; 8 | True 9 | A library that extends PeachPie capabilities for Avalonia UI. 10 | Peachpie.Avalonia 11 | 12 | 13 | 14 | 15 | 16 | 17 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | vendor 37 | true 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /PHP Libraries/Peachpie.Avalonia/src/Peachpie/Avalonia/Traits/EventTrait.php: -------------------------------------------------------------------------------- 1 | add($callback), возвращая hook-объект 11 | * 3) Позволяет потом вызвать $hook->dispose() для отписки 12 | */ 13 | trait EventTrait 14 | { 15 | /** 16 | * Подписка на .NET-событие $eventName у текущего объекта (this). 17 | * Возвращает объект-подписку (hook), у которого есть метод `dispose()`. 18 | * 19 | * Пример использования: 20 | * $hook = $button->on("Click", function($sender, $args) { 21 | * echo "Button clicked!"; 22 | * }); 23 | * // Позже, если нужно отписаться: 24 | * $hook->dispose(); 25 | * 26 | * @param string $eventName 27 | * @param callable $callback 28 | * @return mixed Возвращаемый объект-подписку 29 | * @throws Exception Если событие не найдено 30 | */ 31 | public function on(string $eventName, callable $callback): mixed 32 | { 33 | // Проверяем, что действительно существует публичное свойство-событие 34 | // (например, $this->Click и т.д.) 35 | if (!property_exists($this, $eventName)) { 36 | throw new Exception("Event '$eventName' not found on " . get_class($this)); 37 | } 38 | 39 | // Извлекаем объект события, который PeachPie предоставляет как "ClrEvent" (или похожий тип). 40 | // У него должен быть метод ->add($callback), который возвращает 'hook' (подписку). 41 | $eventObj = $this->$eventName; 42 | 43 | // Вызываем ->add($callback). В новых версиях PeachPie это вернёт subscription-объект 44 | // со методом dispose(). 45 | return $eventObj->add($callback); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /PeachPie Extension Libraries/Peachpie.Community.ToolKit/src/Collections/ObservableCollection.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.ObjectModel; 2 | using System.Linq; 3 | using Pchp.Core; 4 | 5 | namespace Peachpie.Community.Collections; 6 | 7 | public class ObservableCollection : ObservableCollection, Iterator, ArrayAccess 8 | { 9 | private int _position = 0; 10 | 11 | public ObservableCollection() : base() 12 | { 13 | 14 | } 15 | 16 | public ObservableCollection(PhpArray phpArray) 17 | { 18 | if (phpArray.IntrinsicEnumerator == null) 19 | { 20 | return; 21 | } 22 | 23 | foreach (var item in phpArray) 24 | { 25 | Add(item.Value.Alias); 26 | } 27 | } 28 | 29 | public void SetAll(PhpArray phpArray) 30 | { 31 | if (phpArray.IntrinsicEnumerator == null) 32 | { 33 | return; 34 | } 35 | 36 | Clear(); 37 | 38 | foreach (var item in phpArray) 39 | { 40 | Add(item.Value.Alias); 41 | } 42 | } 43 | 44 | // Реализация методов интерфейса Iterator 45 | public void rewind() 46 | { 47 | _position = 0; 48 | } 49 | 50 | public void next() 51 | { 52 | _position++; 53 | } 54 | 55 | public bool valid() 56 | { 57 | return _position >= 0 && _position < Count; 58 | } 59 | 60 | public PhpValue key() 61 | { 62 | return _position; 63 | } 64 | 65 | public PhpValue current() 66 | { 67 | return PhpValue.FromClr(this[_position]); 68 | } 69 | 70 | // Реализация методов интерфейса ArrayAccess 71 | public PhpValue offsetGet(PhpValue offset) 72 | { 73 | return PhpValue.FromClr(this[offset.ToInt()]); 74 | } 75 | 76 | public void offsetSet(PhpValue offset, PhpValue value) 77 | { 78 | this[offset.ToInt()] = value.ToClr(); 79 | } 80 | 81 | public void offsetUnset(PhpValue offset) 82 | { 83 | RemoveAt(offset.ToInt()); 84 | } 85 | 86 | public bool offsetExists(PhpValue offset) 87 | { 88 | return offset.ToInt() >= 0 && offset.ToInt() < Count; 89 | } 90 | 91 | public PhpArray toArray() 92 | { 93 | return new PhpArray(this.ToArray()); 94 | } 95 | 96 | } -------------------------------------------------------------------------------- /Samples/Application/Views/Pages/ProgressIndicatorsPage.php: -------------------------------------------------------------------------------- 1 | InitializeComponent(); 30 | 31 | $this->Bar1 = Ux::find($this, "Bar1"); 32 | $this->Bar2 = Ux::find($this, "Bar2"); 33 | $this->Bar3= Ux::find($this, "Bar3"); 34 | $this->Bar4 = Ux::find($this, "Bar4"); 35 | $this->Bar5 = Ux::find($this, "Bar5"); 36 | $this->Bar6 = Ux::find($this, "Bar6"); 37 | $this->Bar7 = Ux::find($this, "Bar7"); 38 | $this->Bar8 = Ux::find($this, "Bar8"); 39 | 40 | DispatcherTimer::Run( action: function(): bool { 41 | 42 | if($this->valueBar > 100){ 43 | $this->valueBar = 0; 44 | } 45 | 46 | $this->Bar1->Value = $this->valueBar; 47 | $this->Bar2->Value = $this->valueBar; 48 | $this->Bar3->Value = $this->valueBar; 49 | $this->Bar4->Value = $this->valueBar; 50 | $this->Bar5->Value = $this->valueBar; 51 | $this->Bar6->Value = $this->valueBar; 52 | $this->Bar7->Value = $this->valueBar; 53 | $this->Bar8->Value = $this->valueBar; 54 | $this->valueBar += 25; 55 | 56 | return true; 57 | }, interval: TimeSpan::FromSeconds(0.5), priority: null); 58 | } 59 | 60 | private function InitializeComponent(): void 61 | { 62 | AvaloniaXamlLoader::Load(obj:$this); 63 | } 64 | } 65 | 66 | } -------------------------------------------------------------------------------- /PeachPie Extension Libraries/Peachpie.Avalonia.Core/src/Extension/Event.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Avalonia.Controls; 4 | using Avalonia.Interactivity; 5 | using Pchp.Core; 6 | 7 | namespace Peachpie.Avalonia.Core.Extension 8 | { 9 | public static class Event 10 | { 11 | private static readonly Dictionary CachedEventAvalonia = new(); 12 | 13 | public static void Bind(Context ctx, Control? targetObect, RoutedEvent eventType, IPhpCallable eventHandler , string? eventId) 14 | { 15 | if (targetObect == null || CachedEventAvalonia.TryGetValue(eventId, out var _)) 16 | { 17 | throw new ArgumentException($"Event handler '{eventId}' already exists"); 18 | } 19 | 20 | var handler = CreateHandler(ctx, eventHandler); 21 | targetObect.AddHandler(eventType, handler); 22 | CachedEventAvalonia.Add(eventId, (eventType, handler)); 23 | } 24 | 25 | public static void Off(object targetObect, string? eventId ) 26 | { 27 | if (targetObect == null) 28 | { 29 | throw new ArgumentException($"Event not found on object of type '{targetObect?.GetType().Name}'"); 30 | } 31 | 32 | if (targetObect is Control avaloniaControl && CachedEventAvalonia.TryGetValue(eventId, out var eventHandlerPairAvalonia)) 33 | { 34 | avaloniaControl.RemoveHandler(eventHandlerPairAvalonia.Item1, eventHandlerPairAvalonia.Item2); 35 | CachedEventAvalonia.Remove(eventId); 36 | } 37 | 38 | else 39 | { 40 | throw new ArgumentException($"Event handler '{eventId}' not found"); 41 | } 42 | } 43 | 44 | private static EventHandler CreateHandler(Context ctx, IPhpCallable callback) 45 | { 46 | return (sender, e) => callback.Invoke(ctx, PhpValue.FromClass(sender), PhpValue.FromClass(e)); 47 | } 48 | 49 | private static Delegate? CreateDelegate(Type? type, EventHandler handler) 50 | { 51 | return (Delegate) type?.GetConstructor(new[] {typeof(object), typeof(IntPtr)}) 52 | ?.Invoke(new object[] {handler.Target, handler.Method.MethodHandle.GetFunctionPointer()}); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 11.3.5 6 | 1.1.11 7 | 1.0.3 8 | $(Version) 9 | net9.0 10 | 11 | true 12 | true 13 | 14 | true 15 | true 16 | false 17 | false 18 | false 19 | false 20 | true 21 | true 22 | 23 | latest 24 | true 25 | $(DefineConstants);TRACE 26 | 27 | 31 | 32 | 33 | 34 | 35 | 36 | git 37 | https://github.com/FibonacciFox/Peachpie.Avalonia 38 | https://github.com/FibonacciFox/Peachpie.Avalonia 39 | $(MSBuildThisFileDirectory).nuget 40 | https://github.com/peachpiecompiler/peachpie/raw/master/docs/logos/round-orange-196x196.png 41 | FibonacciFox 42 | NU5048;AVA3001 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /PeachPie Extension Libraries/Peachpie.Community.ToolKit/src/Listener/Event.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Reflection; 4 | using Pchp.Core; 5 | 6 | namespace Peachpie.Community.Listener; 7 | 8 | public static class Event 9 | { 10 | public static void On(Context ctx, object targetObject, string eventName, IPhpCallable eventHandler, 11 | string? eventId = null) 12 | { 13 | if (eventId == null) 14 | { 15 | eventId = $"{eventName}:{eventHandler.GetHashCode()}"; 16 | } 17 | 18 | if (CachedEventAll.TryGetValue(eventId, out _)) 19 | { 20 | throw new ArgumentException($"Event handler '{eventId}' already exists"); 21 | } 22 | 23 | var eventInfo = targetObject.GetType().GetEvent(eventName); 24 | if (eventInfo == null) 25 | { 26 | throw new ArgumentException( 27 | $"Event '{eventName}' not found on object of type '{targetObject?.GetType().Name}'"); 28 | } 29 | 30 | var handler = CreateHandler(ctx, eventHandler); 31 | var newDelegate = CreateDelegate(eventInfo.EventHandlerType, handler); 32 | eventInfo.AddEventHandler(targetObject, newDelegate); 33 | CachedEventAll.Add(eventId, (eventInfo, newDelegate)); 34 | } 35 | 36 | public static void Off(object targetObject, string? eventId) 37 | { 38 | if (targetObject == null) 39 | { 40 | throw new ArgumentException($"Event not found on object of type '{targetObject.GetType().Name}'"); 41 | } 42 | 43 | if (CachedEventAll.TryGetValue(eventId, out var eventHandlerPairAll)) 44 | { 45 | eventHandlerPairAll.Item1?.RemoveEventHandler(targetObject, eventHandlerPairAll.Item2); 46 | CachedEventAll.Remove(eventId); 47 | } 48 | else 49 | { 50 | throw new ArgumentException($"Event handler '{eventId}' not found"); 51 | } 52 | } 53 | 54 | private static EventHandler CreateHandler(Context ctx, IPhpCallable callback) 55 | { 56 | return (sender, e) => callback.Invoke(ctx, PhpValue.FromClass(sender), PhpValue.FromClass(e)); 57 | } 58 | 59 | private static Delegate? CreateDelegate(Type? type, EventHandler handler) 60 | { 61 | return (Delegate)type?.GetConstructor(new[] { typeof(object), typeof(IntPtr) }) 62 | ?.Invoke(new object[] { handler.Target, handler.Method.MethodHandle.GetFunctionPointer() }); 63 | } 64 | 65 | private static readonly Dictionary CachedEventAll = new(); 66 | } 67 | 68 | -------------------------------------------------------------------------------- /Templates/Peachpie.Avalonia.Templates/templates/php/library/.template.config/template.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/template", 3 | "author": "FibonacciFox", 4 | "classifications": [ "Library", "PeachPie" ], 5 | "description": "The Peachpie Library.", 6 | "groupIdentity": "Peachpie.Library", 7 | "identity": "Peachpie.Library", 8 | "name": "PHP Library", 9 | "shortName": "php.lib", 10 | "sourceName": "PeachpieLibraryTemplate", 11 | "defaultName": "PeachpieLibrary", 12 | "preferNameDirectory": true, 13 | 14 | "tags": { 15 | "language": "PHP", 16 | "type": "project" 17 | }, 18 | 19 | "symbols": { 20 | "skipRestore": { 21 | "type": "parameter", 22 | "datatype": "bool", 23 | "description": "If specified, skips the automatic restore of the project on create.", 24 | "defaultValue": "false" 25 | }, 26 | "uiLang": { 27 | "type": "parameter", 28 | "datatype": "choice", 29 | "description": "Choose language for post-create instructions", 30 | "defaultValue": "en", 31 | "choices": [ 32 | { "choice": "en", "description": "English" }, 33 | { "choice": "ru", "description": "Русский" } 34 | ] 35 | } 36 | }, 37 | 38 | "primaryOutputs": [ 39 | { "path": "PeachpieLibraryTemplate.msbuildproj" } 40 | ], 41 | 42 | "postActions": [ 43 | { 44 | "id": "restore", 45 | "condition": "(!skipRestore)", 46 | "description": "Restore NuGet packages required by this project.", 47 | "manualInstructions": [ 48 | { "text": "Run 'dotnet restore'" } 49 | ], 50 | "actionId": "E2F6A4F0-62C0-4A0A-8E24-81D3B5711B0A", 51 | "continueOnError": true 52 | }, 53 | { 54 | "id": "stubs-en", 55 | "condition": "(uiLang == 'en')", 56 | "description": "Generate PHP stubs (NuGet vendor stubs + reflection stubs).", 57 | "manualInstructions": [ 58 | { "text": "Run 'dotnet msbuild -t:PeachpieStubs' to restore vendor stubs and generate PHP stubs into /vendor/Stubs" } 59 | ], 60 | "actionId": "210D431B-A78B-4D2F-B762-4ED3E3EA9025", 61 | "continueOnError": true 62 | }, 63 | { 64 | "id": "stubs-ru", 65 | "condition": "(uiLang == 'ru')", 66 | "description": "Сгенерировать PHP заглушки (vendor из NuGet + рефлексия).", 67 | "manualInstructions": [ 68 | { "text": "Выполните 'dotnet msbuild -t:PeachpieStubs', чтобы восстановить vendor-заглушки и сгенерировать PHP-заглушки в <проект>/vendor/Stubs" } 69 | ], 70 | "actionId": "210D431B-A78B-4D2F-B762-4ED3E3EA9025", 71 | "continueOnError": true 72 | } 73 | ] 74 | } 75 | -------------------------------------------------------------------------------- /Templates/Peachpie.Avalonia.Templates/templates/php/console/.template.config/template.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/template", 3 | "author": "FibonacciFox", 4 | "classifications": [ "Console", "PeachPie" ], 5 | "description": "A Console PHP Application", 6 | "groupIdentity": "Peachpie.Console", 7 | "identity": "Peachpie.Console", 8 | "name": "PHP Console App", 9 | "shortName": "php.console", 10 | "sourceName": "PeachpieConsoleAppTemplate", 11 | "defaultName": "PeachpieConsoleApplication", 12 | "preferNameDirectory": true, 13 | 14 | "tags": { 15 | "language": "PHP", 16 | "type": "project" 17 | }, 18 | 19 | "symbols": { 20 | "skipRestore": { 21 | "type": "parameter", 22 | "datatype": "bool", 23 | "description": "If specified, skips the automatic restore of the project on create.", 24 | "defaultValue": "false" 25 | }, 26 | "uiLang": { 27 | "type": "parameter", 28 | "datatype": "choice", 29 | "description": "Choose language for post-create instructions", 30 | "defaultValue": "en", 31 | "choices": [ 32 | { "choice": "en", "description": "English" }, 33 | { "choice": "ru", "description": "Русский" } 34 | ] 35 | } 36 | }, 37 | 38 | "primaryOutputs": [ 39 | { "path": "PeachpieConsoleAppTemplate.msbuildproj" } 40 | ], 41 | 42 | "postActions": [ 43 | { 44 | "id": "restore", 45 | "condition": "(!skipRestore)", 46 | "description": "Restore NuGet packages required by this project.", 47 | "manualInstructions": [ 48 | { "text": "Run 'dotnet restore'" } 49 | ], 50 | "actionId": "E2F6A4F0-62C0-4A0A-8E24-81D3B5711B0A", 51 | "continueOnError": true 52 | }, 53 | { 54 | "id": "stubs-en", 55 | "condition": "(uiLang == 'en')", 56 | "description": "Generate PHP stubs (NuGet vendor stubs + reflection stubs).", 57 | "manualInstructions": [ 58 | { "text": "Run 'dotnet msbuild -t:PeachpieStubs' to restore vendor stubs and generate PHP stubs into /vendor/Stubs" } 59 | ], 60 | "actionId": "210D431B-A78B-4D2F-B762-4ED3E3EA9025", 61 | "continueOnError": true 62 | }, 63 | { 64 | "id": "stubs-ru", 65 | "condition": "(uiLang == 'ru')", 66 | "description": "Сгенерировать PHP заглушки (vendor из NuGet + рефлексия).", 67 | "manualInstructions": [ 68 | { "text": "Выполните 'dotnet msbuild -t:PeachpieStubs', чтобы восстановить vendor-заглушки и сгенерировать PHP-заглушки в <проект>/vendor/Stubs" } 69 | ], 70 | "actionId": "210D431B-A78B-4D2F-B762-4ED3E3EA9025", 71 | "continueOnError": true 72 | } 73 | ] 74 | } 75 | -------------------------------------------------------------------------------- /Templates/Peachpie.Avalonia.Templates/templates/php/app/.template.config/template.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/template", 3 | "author": "FibonacciFox", 4 | "classifications": [ "Desktop", "PeachPie", "Xaml", "Avalonia", "Windows", "Linux", "macOS" ], 5 | "description": "A cross-platform PeachPie Avalonia UI Application targeting Desktop", 6 | "groupIdentity": "Peachpie.Avalonia.App", 7 | "identity": "Peachpie.Avalonia.App", 8 | "name": "Avalonia PHP App", 9 | "shortName": "php.avalonia.app", 10 | "sourceName": "PeachpieAvaloniaAppTemplate", 11 | "defaultName": "PeachpieAvaloniaApplication", 12 | "preferNameDirectory": true, 13 | 14 | "tags": { 15 | "language": "PHP", 16 | "type": "project" 17 | }, 18 | 19 | "symbols": { 20 | "skipRestore": { 21 | "type": "parameter", 22 | "datatype": "bool", 23 | "description": "If specified, skips the automatic restore of the project on create.", 24 | "defaultValue": "false" 25 | }, 26 | "uiLang": { 27 | "type": "parameter", 28 | "datatype": "choice", 29 | "description": "Choose language for post-create instructions", 30 | "defaultValue": "en", 31 | "choices": [ 32 | { "choice": "en", "description": "English" }, 33 | { "choice": "ru", "description": "Русский" } 34 | ] 35 | } 36 | }, 37 | 38 | "primaryOutputs": [ 39 | { "path": "PeachpieAvaloniaAppTemplate.msbuildproj" } 40 | ], 41 | 42 | "postActions": [ 43 | { 44 | "id": "restore", 45 | "condition": "(!skipRestore)", 46 | "description": "Restore NuGet packages required by this project.", 47 | "manualInstructions": [ 48 | { "text": "Run 'dotnet restore'" } 49 | ], 50 | "actionId": "E2F6A4F0-62C0-4A0A-8E24-81D3B5711B0A", 51 | "continueOnError": true 52 | }, 53 | { 54 | "id": "stubs-en", 55 | "condition": "(uiLang == 'en')", 56 | "description": "Generate PHP stubs (NuGet vendor stubs + reflection stubs).", 57 | "manualInstructions": [ 58 | { "text": "Run 'dotnet msbuild -t:PeachpieStubs' to restore vendor stubs and generate PHP stubs into /vendor/Stubs" } 59 | ], 60 | "actionId": "210D431B-A78B-4D2F-B762-4ED3E3EA9025", 61 | "continueOnError": true 62 | }, 63 | { 64 | "id": "stubs-ru", 65 | "condition": "(uiLang == 'ru')", 66 | "description": "Сгенерировать PHP заглушки (vendor из NuGet + рефлексия).", 67 | "manualInstructions": [ 68 | { "text": "Выполните 'dotnet msbuild -t:PeachpieStubs', чтобы восстановить vendor-заглушки и сгенерировать PHP-заглушки в <проект>/vendor/Stubs" } 69 | ], 70 | "actionId": "210D431B-A78B-4D2F-B762-4ED3E3EA9025", 71 | "continueOnError": true 72 | } 73 | ] 74 | } 75 | -------------------------------------------------------------------------------- /PeachPie Extension Libraries/Peachpie.Community.ToolKit/vendor/Peachpie/Community/Threading/Tasks/ManagedTaskCreationOptions.php: -------------------------------------------------------------------------------- 1 | BuildTfmPreference(string? _) 21 | { 22 | // Без ручного --tfm: дефолтный приоритет 23 | return new[] 24 | { 25 | "net9.0","net8.0","net7.0","net6.0","net5.0", 26 | "netcoreapp3.1","netcoreapp3.0", 27 | "netstandard2.1","netstandard2.0", 28 | "net48","net472","net471","net47","net462","net461","net46", 29 | }; 30 | } 31 | 32 | /// 33 | /// Находит лучший каталог API-ассемблей (сперва lib, затем ref) под указанный пакет. 34 | /// 35 | public static IEnumerable FindBestApiDirs(string nugetRoot, string packageId, string version, IReadOnlyList tfmPreference) 36 | { 37 | var idLower = packageId.ToLowerInvariant(); 38 | var baseDir = Path.Combine(nugetRoot, idLower, version); 39 | 40 | foreach (var apiKind in new[] { "lib", "ref" }) // lib приоритетнее 41 | { 42 | var apiDir = Path.Combine(baseDir, apiKind); 43 | if (!Directory.Exists(apiDir)) 44 | continue; 45 | 46 | var map = Directory.EnumerateDirectories(apiDir) 47 | .ToDictionary(d => Path.GetFileName(d)!, d => d, StringComparer.OrdinalIgnoreCase); 48 | 49 | foreach (var tfm in tfmPreference) 50 | if (map.TryGetValue(tfm, out var path)) 51 | { 52 | yield return path; 53 | yield break; 54 | } 55 | 56 | // Fallback: берём самый «похожий» netstandard 57 | var netstd = map.Keys.Where(k => k.StartsWith("netstandard", StringComparison.OrdinalIgnoreCase)) 58 | .OrderByDescending(k => k, StringComparer.Ordinal) 59 | .FirstOrDefault(); 60 | if (netstd != null) { yield return map[netstd]; yield break; } 61 | 62 | // Последний шанс: самый «длинный» TFM, как правило, самый специфичный 63 | var best = map.Keys.OrderByDescending(k => k.Length).FirstOrDefault(); 64 | if (best != null) { yield return map[best]; yield break; } 65 | } 66 | } 67 | } -------------------------------------------------------------------------------- /Templates/Peachpie.Avalonia.Templates/templates/php/avalonia.library/.template.config/template.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/template", 3 | "author": "FibonacciFox", 4 | "classifications": [ "Library", "PeachPie", "Xaml", "Avalonia", "Windows", "Linux", "macOS" ], 5 | "description": "A library that extends PeachPie capabilities for Avalonia UI.", 6 | "groupIdentity": "Peachpie.Avalonia.Library", 7 | "identity": "Peachpie.Avalonia.Library", 8 | "name": "Avalonia PHP Library", 9 | "shortName": "php.avalonia.lib", 10 | "sourceName": "PeachpieAvaloniaLibraryTemplate", 11 | "defaultName": "PeachpieAvaloniaLibrary", 12 | "preferNameDirectory": true, 13 | 14 | "tags": { 15 | "language": "PHP", 16 | "type": "project" 17 | }, 18 | 19 | "symbols": { 20 | "skipRestore": { 21 | "type": "parameter", 22 | "datatype": "bool", 23 | "description": "If specified, skips the automatic restore of the project on create.", 24 | "defaultValue": "false" 25 | }, 26 | "uiLang": { 27 | "type": "parameter", 28 | "datatype": "choice", 29 | "description": "Choose language for post-create instructions", 30 | "defaultValue": "en", 31 | "choices": [ 32 | { "choice": "en", "description": "English" }, 33 | { "choice": "ru", "description": "Русский" } 34 | ] 35 | } 36 | }, 37 | 38 | "primaryOutputs": [ 39 | { "path": "PeachpieAvaloniaLibraryTemplate.msbuildproj" } 40 | ], 41 | 42 | "postActions": [ 43 | { 44 | "id": "restore", 45 | "condition": "(!skipRestore)", 46 | "description": "Restore NuGet packages required by this project.", 47 | "manualInstructions": [ 48 | { "text": "Run 'dotnet restore'" } 49 | ], 50 | "actionId": "E2F6A4F0-62C0-4A0A-8E24-81D3B5711B0A", 51 | "continueOnError": true 52 | }, 53 | { 54 | "id": "stubs-en", 55 | "condition": "(uiLang == 'en')", 56 | "description": "Generate PHP stubs (NuGet vendor stubs + reflection stubs).", 57 | "manualInstructions": [ 58 | { "text": "Run 'dotnet msbuild -t:PeachpieStubs' to restore vendor stubs and generate PHP stubs into /vendor/Stubs" } 59 | ], 60 | "actionId": "210D431B-A78B-4D2F-B762-4ED3E3EA9025", 61 | "continueOnError": true 62 | }, 63 | { 64 | "id": "stubs-ru", 65 | "condition": "(uiLang == 'ru')", 66 | "description": "Сгенерировать PHP заглушки (vendor из NuGet + рефлексия).", 67 | "manualInstructions": [ 68 | { "text": "Выполните 'dotnet msbuild -t:PeachpieStubs', чтобы восстановить vendor-заглушки и сгенерировать PHP-заглушки в <проект>/vendor/Stubs" } 69 | ], 70 | "actionId": "210D431B-A78B-4D2F-B762-4ED3E3EA9025", 71 | "continueOnError": true 72 | } 73 | ] 74 | } 75 | -------------------------------------------------------------------------------- /Samples/Application/Views/MainWindow.axaml: -------------------------------------------------------------------------------- 1 | 11 | 12 | 13 | PeachPie.Avalonia 14 | 15 | Home 16 | Buttons 17 | Header 18 | Fields 19 | Progress Indicators 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /Samples/Application/Views/MainWindow.php: -------------------------------------------------------------------------------- 1 | InitializeComponent(); 36 | 37 | $this->PageView = Ux::find($this, "PageView"); 38 | $this->ItemMenu = Ux::find($this, "ItemMenu"); 39 | $this->BurgerButton = Ux::find($this, "BurgerButton"); 40 | 41 | 42 | $this->HomePage = new HomePage(); 43 | $this->ButtonsPage = new ButtonsPage(); 44 | $this->ColorZonePage = new ColorZonePage(); 45 | $this->FieldsPage = new FieldsPage(); 46 | $this->ProgressIndicatorsPage = new ProgressIndicatorsPage(); 47 | 48 | $this->PageView->Content = $this->HomePage; 49 | 50 | Logger::Info("Hello Peachpie Avalonia!"); 51 | 52 | } 53 | 54 | //look MainWindow.axaml 55 | public function ItemMenu_OnTapped(object $sender, TappedEventArgs $e) : void { 56 | switch ($this->ItemMenu->SelectedIndex) { 57 | case 0: 58 | $this->PageView->Content = $this->HomePage; 59 | break; 60 | case 1: 61 | $this->PageView->Content = $this->ButtonsPage; 62 | break; 63 | case 2: 64 | $this->PageView->Content = $this->ColorZonePage; 65 | break; 66 | case 3: 67 | $this->PageView->Content = $this->FieldsPage; 68 | break; 69 | case 4: 70 | $this->PageView->Content = $this->ProgressIndicatorsPage; 71 | break; 72 | } 73 | } 74 | 75 | private function InitializeComponent(): void 76 | { 77 | AvaloniaXamlLoader::Load(obj:$this); 78 | 79 | if ( defined('DEBUG') ) { 80 | Logger::Info("Debug Build!"); 81 | } 82 | } 83 | } 84 | 85 | } -------------------------------------------------------------------------------- /Samples/Application/Views/Pages/HomePage.axaml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | Добро пожаловать в Peachpie.Avalonia 9 | Платформа разработки игр и программ на PHP 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | позволит разработчикам создавать кроссплатформенные приложения для Windows, macOS, Linux, iOS, Android и веб-браузеров на языке PHP в среде выполнения .NET с непревзойденной легкостью. 20 | - это современный PHP-компилятор, основанный на платформе компиляции Microsoft Roslyn и Phalanger. Он позволяет запускать PHP в .NET framework, тем самым открывающий разработчикам PHP дверь в мир .NET – и наоборот. 21 | скомпилированные программы выполняются в повторно реализованной среде выполнения PeachPie, полностью совместимой со средой выполнения PHP. 22 | проект допускает гибридные приложения, части которых написаны на C #, а другие - на PHP. Части будут полностью совместимы и смогут беспрепятственно взаимодействовать, все в рамках .NET framework. 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /PeachPie Extension Libraries/Peachpie.Vendor.Stubs/build/Peachpie.Vendor.Stubs.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | $([System.IO.Path]::GetFullPath($([System.IO.Path]::Combine('$(MSBuildThisFileDirectory)','..','lib','net6.0','Peachpie.Vendor.Stubs.dll')))) 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | <_NuGetRoot>$(NuGetPackageRoot) 15 | <_NuGetRoot Condition="'$(_NuGetRoot)'=='' and '$(OS)'=='Windows_NT'">$([System.IO.Path]::Combine('$(UserProfile)', '.nuget', 'packages')) 16 | <_NuGetRoot Condition="'$(_NuGetRoot)'=='' and '$(OS)'!='Windows_NT'">$([System.IO.Path]::Combine('$(HOME)', '.nuget', 'packages')) 17 | 18 | 19 | $([System.IO.Path]::Combine('$(MSBuildProjectDirectory)', 'vendor', 'Stubs')) 20 | 21 | 22 | 23 | 24 | 25 | 26 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /Templates/Peachpie.Avalonia.Templates/templates/php/console/src/Event.php: -------------------------------------------------------------------------------- 1 | title = $title; 40 | $this->date = new DateTime($date); 41 | } 42 | 43 | /** 44 | * Возвращает дату события в формате 'd-m-Y'. 45 | * 46 | * Returns the event date in 'd-m-Y' format. 47 | * 48 | * @return string Дата события / Event date 49 | */ 50 | public function getDate(): string 51 | { 52 | return $this->date->format('d-m-Y'); 53 | } 54 | 55 | /** 56 | * Откладывает событие на указанное количество дней. 57 | * 58 | * Postpones the event by the specified number of days. 59 | * 60 | * @param int $days Количество дней для откладывания / Number of days to postpone 61 | */ 62 | public function postpone(int $days): void 63 | { 64 | $this->date->modify("+$days days"); 65 | } 66 | 67 | /** 68 | * Приближает событие на указанное количество дней. 69 | * 70 | * Advances the event by the specified number of days. 71 | * 72 | * @param int $days Количество дней для приближения / Number of days to advance 73 | */ 74 | public function advance(int $days): void 75 | { 76 | $this->date->modify("-$days days"); 77 | } 78 | 79 | /** 80 | * Возвращает количество дней до события. 81 | * 82 | * Returns the number of days until the event. 83 | * 84 | * @return int Количество дней до события / Number of days until the event 85 | */ 86 | public function daysUntil(): int 87 | { 88 | $now = new DateTime(); 89 | $interval = $now->diff($this->date); 90 | return (int)$interval->format('%a'); 91 | } 92 | 93 | /** 94 | * Возвращает описание события, включающее название и дату. 95 | * 96 | * Returns a description of the event, including the title and date. 97 | * 98 | * @return string Описание события / Event description 99 | */ 100 | public function getDescription(): string 101 | { 102 | return "{$this->title} - {$this->getDate()}"; 103 | } 104 | } -------------------------------------------------------------------------------- /PeachPie Extension Libraries/Peachpie.Avalonia.Core/vendor/Peachpie/Avalonia/Core/AppPhpBuilder.php: -------------------------------------------------------------------------------- 1 | () 13 | * .LogToTrace() 14 | * .SetupWithLifetime(lifetime); 15 | * 16 | * Пример использования в PHP: 17 | * use Peachpie\Avalonia\Core\AppPhpBuilder; 18 | * use Avalonia\Controls\ApplicationLifetimes\ClassicDesktopStyleApplicationLifetime; 19 | * use Avalonia\Controls\ShutdownMode; 20 | * 21 | * $lifetime = new ClassicDesktopStyleApplicationLifetime(); 22 | * $lifetime->ShutdownMode = ShutdownMode::OnMainWindowClose; 23 | * 24 | * AppPhpBuilder::Configure("App", "Application") // быстрее и надёжнее, если известна сборка 25 | * ->LogToTrace() 26 | * ->SetupWithLifetime($lifetime); 27 | * 28 | * $lifetime->Start(null); 29 | */ 30 | class AppPhpBuilder 31 | { 32 | /** 33 | * Внутренний экземпляр Avalonia\AppBuilder, на котором выполняется конфигурация. 34 | * 35 | * @var AppBuilder 36 | */ 37 | public AppBuilder $Builder; 38 | 39 | /** 40 | * Закрытый конструктор. Используйте {@see AppPhpBuilder::Configure()}. 41 | * 42 | * @param AppBuilder $appBuilder Экземпляр AppBuilder. 43 | */ 44 | protected function __construct(AppBuilder $appBuilder) 45 | { 46 | } 47 | 48 | /** 49 | * Создаёт AppPhpBuilder, разрешая тип приложения и вызывая AppBuilder::Configure(). 50 | * 51 | * Можно передать: 52 | * - только имя типа: "App"; 53 | * - полное имя типа с пространством имён: "\My\Namespace\App"; 54 | * - полностью квалифицированное имя с именем сборки: "My.Namespace.App, Application". 55 | * 56 | * Если $assemblyName не указан, поиск идёт в EntryAssembly, затем по всем загруженным сборкам. 57 | * 58 | * @param string $applicationType Имя класса приложения (наследника Avalonia\Application). 59 | * @param string|null $assemblyName (Необязательно) Имя сборки, где расположен класс приложения. 60 | * 61 | * @return AppPhpBuilder Инициализированный билдёр. 62 | * 63 | * @throws \ArgumentException Если тип не найден или не наследуется от Avalonia\Application. 64 | */ 65 | public static function Configure(string $applicationType, ?string $assemblyName = null): AppPhpBuilder 66 | { 67 | } 68 | 69 | /** 70 | * Подключает реализацию времени жизни приложения (Desktop/SingleView и т.п.). 71 | * 72 | * Обычно после вызова этого метода приложение запускают: $lifetime->Start(...). 73 | * 74 | * @param IApplicationLifetime $lifetime Экземпляр lifetime. 75 | * 76 | * @return AppPhpBuilder Текущий билдёр (для чейнинга). 77 | */ 78 | public function SetupWithLifetime(IApplicationLifetime $lifetime): AppPhpBuilder 79 | { 80 | } 81 | 82 | /** 83 | * Включает логирование в системную трассировку (Diagnostic Trace). 84 | * Полезно в отладке; в продакшене настраивайте логирование под свои нужды. 85 | * 86 | * @return AppPhpBuilder Текущий билдёр (для чейнинга). 87 | */ 88 | public function LogToTrace(): AppPhpBuilder 89 | { 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /Samples/Application/Views/Pages/ProgressIndicatorsPage.axaml: -------------------------------------------------------------------------------- 1 | 8 | 9 | Progress Indicators 10 | Horizontal 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | Vertical 19 | 20 | 21 | 22 | 23 | Circular 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | With Progress 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /PeachPie Extension Libraries/Peachpie.Vendor.Stubs/PackageDiscovery.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Linq; 5 | using Newtonsoft.Json.Linq; 6 | 7 | namespace Peachpie.Vendor.Stubs; 8 | 9 | public static class PackageDiscovery 10 | { 11 | public sealed class PackageInfo 12 | { 13 | public string Id { get; } 14 | public string Version { get; } 15 | 16 | public PackageInfo(string id, string version) 17 | { 18 | Id = id; 19 | Version = version; 20 | } 21 | } 22 | 23 | public static List ListPackages(string projectDir) 24 | { 25 | var json = RunDotnetListPackage(projectDir); 26 | if (string.IsNullOrWhiteSpace(json)) 27 | return new List(); 28 | 29 | var root = JObject.Parse(json); 30 | var result = new List(); 31 | 32 | var projects = root["projects"]?.Children() ?? Enumerable.Empty(); 33 | foreach (var project in projects) 34 | { 35 | var frameworks = project["frameworks"]?.Children() ?? Enumerable.Empty(); 36 | foreach (var fw in frameworks) 37 | { 38 | foreach (var pkg in fw["topLevelPackages"]?.Children() ?? Enumerable.Empty()) 39 | Add(pkg, result); 40 | 41 | foreach (var pkg in fw["transitivePackages"]?.Children() ?? Enumerable.Empty()) 42 | Add(pkg, result); 43 | } 44 | } 45 | 46 | // distinct по (Id, Version), регистр не важен 47 | return result 48 | .GroupBy(p => (p.Id, p.Version), PackageIdVersionComparer.Instance) 49 | .Select(g => g.First()) 50 | .ToList(); 51 | 52 | static void Add(JObject pkg, List list) 53 | { 54 | var id = (pkg["id"] ?? "").ToString(); 55 | var v = (pkg["resolvedVersion"] ?? "").ToString(); 56 | if (!string.IsNullOrWhiteSpace(id) && !string.IsNullOrWhiteSpace(v)) 57 | list.Add(new PackageInfo(id, v)); 58 | } 59 | } 60 | 61 | private static string RunDotnetListPackage(string workingDir) 62 | { 63 | var psi = new ProcessStartInfo 64 | { 65 | FileName = "dotnet", 66 | Arguments = "list package --include-transitive --format json", 67 | RedirectStandardOutput = true, 68 | RedirectStandardError = true, 69 | UseShellExecute = false, 70 | CreateNoWindow = true, 71 | WorkingDirectory = workingDir 72 | }; 73 | using var p = new Process { StartInfo = psi }; 74 | p.Start(); 75 | var stdout = p.StandardOutput.ReadToEnd(); 76 | var stderr = p.StandardError.ReadToEnd(); 77 | p.WaitForExit(); 78 | if (!string.IsNullOrWhiteSpace(stderr)) 79 | Console.WriteLine(stderr.Trim()); 80 | return stdout; 81 | } 82 | 83 | private sealed class PackageIdVersionComparer : IEqualityComparer<(string Id, string Version)> 84 | { 85 | public static readonly PackageIdVersionComparer Instance = new PackageIdVersionComparer(); 86 | 87 | public bool Equals((string Id, string Version) x, (string Id, string Version) y) => 88 | StringComparer.OrdinalIgnoreCase.Equals(x.Id, y.Id) && 89 | StringComparer.OrdinalIgnoreCase.Equals(x.Version, y.Version); 90 | 91 | public int GetHashCode((string Id, string Version) obj) => 92 | HashCode.Combine( 93 | StringComparer.OrdinalIgnoreCase.GetHashCode(obj.Id ?? string.Empty), 94 | StringComparer.OrdinalIgnoreCase.GetHashCode(obj.Version ?? string.Empty) 95 | ); 96 | } 97 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ################# 2 | ## Visual Studio 3 | ################# 4 | 5 | ## Ignore Visual Studio temporary files, build results, and 6 | ## files generated by popular Visual Studio add-ons. 7 | 8 | # User-specific files 9 | *.suo 10 | *.user 11 | *.sln.docstates 12 | .vs/ 13 | 14 | # Build results 15 | 16 | *.sln.ide/ 17 | [Dd]ebug/ 18 | [Rr]elease/ 19 | x64/ 20 | [Bb]in/ 21 | [Oo]bj/ 22 | 23 | # MSTest test Results 24 | [Tt]est[Rr]esult*/ 25 | [Bb]uild[Ll]og.* 26 | 27 | *_i.c 28 | *_p.c 29 | *.ilk 30 | *.meta 31 | *.obj 32 | *.pch 33 | *.pdb 34 | *.pgc 35 | *.pgd 36 | *.rsp 37 | *.sbr 38 | *.tlb 39 | *.tli 40 | *.tlh 41 | *.tmp 42 | *.tmp_proj 43 | *.log 44 | *.vspscc 45 | *.vssscc 46 | .builds 47 | *.pidb 48 | *.log 49 | *.scc 50 | 51 | # Visual C++ cache files 52 | ipch/ 53 | *.aps 54 | *.ncb 55 | *.opensdf 56 | *.sdf 57 | *.cachefile 58 | 59 | # Visual Studio profiler 60 | *.psess 61 | *.vsp 62 | *.vspx 63 | 64 | # Guidance Automation Toolkit 65 | *.gpState 66 | 67 | # ReSharper is a .NET coding add-in 68 | _ReSharper*/ 69 | *.[Rr]e[Ss]harper 70 | 71 | # TeamCity is a build add-in 72 | _TeamCity* 73 | 74 | # DotCover is a Code Coverage Tool 75 | *.dotCover 76 | 77 | # Installshield output folder 78 | [Ee]xpress/ 79 | 80 | # DocProject is a documentation generator add-in 81 | DocProject/buildhelp/ 82 | DocProject/Help/*.HxT 83 | DocProject/Help/*.HxC 84 | DocProject/Help/*.hhc 85 | DocProject/Help/*.hhk 86 | DocProject/Help/*.hhp 87 | DocProject/Help/Html2 88 | DocProject/Help/html 89 | 90 | # Click-Once directory 91 | publish/ 92 | 93 | # Publish Web Output 94 | *.Publish.xml 95 | *.pubxml 96 | 97 | # Windows Azure Build Output 98 | csx 99 | *.build.csdef 100 | 101 | # Windows Store app package directory 102 | AppPackages/ 103 | 104 | # NCrunch 105 | _NCrunch_*/ 106 | *.ncrunchsolution.user 107 | nCrunchTemp_* 108 | 109 | # CodeRush 110 | .cr/ 111 | 112 | # Others 113 | sql/ 114 | *.Cache 115 | ClientBin/ 116 | [Ss]tyle[Cc]op.* 117 | ~$* 118 | *~ 119 | *.dbmdl 120 | *.[Pp]ublish.xml 121 | *.pfx 122 | *.publishsettings 123 | Events_Avalonia.cs 124 | 125 | # RIA/Silverlight projects 126 | Generated_Code/ 127 | 128 | # Backup & report files from converting an old project file to a newer 129 | # Visual Studio version. Backup files are not needed, because we have git ;-) 130 | _UpgradeReport_Files/ 131 | Backup*/ 132 | UpgradeLog*.XML 133 | UpgradeLog*.htm 134 | 135 | # SQL Server files 136 | App_Data/*.mdf 137 | App_Data/*.ldf 138 | 139 | ############# 140 | ## Windows detritus 141 | ############# 142 | 143 | # Windows image file caches 144 | Thumbs.db 145 | ehthumbs.db 146 | 147 | # Folder config file 148 | Desktop.ini 149 | 150 | # Recycle Bin used on file shares 151 | $RECYCLE.BIN/ 152 | 153 | # Mac crap 154 | .DS_Store 155 | 156 | ################# 157 | ## Monodevelop 158 | ################# 159 | *.userprefs 160 | *.nugetreferenceswitcher 161 | 162 | 163 | ################# 164 | ## Rider 165 | ################# 166 | .idea 167 | 168 | ################# 169 | ## VS Code 170 | ################# 171 | .vscode/ 172 | 173 | ################# 174 | ## Cake 175 | ################# 176 | tools/* 177 | !tools/packages.config 178 | .nuget 179 | artifacts/ 180 | nuget 181 | Avalonia.XBuild.sln 182 | project.lock.json 183 | .idea/* 184 | 185 | 186 | ################## 187 | ## BenchmarkDotNet 188 | ################## 189 | BenchmarkDotNet.Artifacts/ 190 | 191 | dirs.sln 192 | 193 | 194 | ################## 195 | # XCode 196 | ################## 197 | Index/ 198 | Logs/ 199 | ModuleCache.noindex/ 200 | Build/Intermediates.noindex/ 201 | info.plist 202 | build-intermediate 203 | obj-Direct2D1/ 204 | obj-Skia/ 205 | 206 | ################## 207 | # Vim 208 | ################## 209 | .vim 210 | coc-settings.json 211 | .ccls-cache 212 | .ccls 213 | *.map 214 | src/Web/Avalonia.Web.Blazor/wwwroot/*.js 215 | src/Web/Avalonia.Web.Blazor/Interop/Typescript/*.js 216 | -------------------------------------------------------------------------------- /PeachPie Extension Libraries/Peachpie.Avalonia.Core/src/StyleKeyOverride.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Avalonia.Controls; 3 | using Avalonia.Controls.Primitives; 4 | 5 | namespace Peachpie.Avalonia.Core; 6 | 7 | 8 | public static class StyleKeyOverride 9 | { 10 | //Layout controls 11 | public static readonly Type Border = typeof(Border); 12 | public static readonly Type Canvas = typeof(Canvas); 13 | public static readonly Type DockPanel = typeof(DockPanel); 14 | public static readonly Type Expander = typeof(Expander); 15 | public static readonly Type Grid = typeof(Grid); 16 | //public static readonly Type DataGrid = typeof(DataGrid); 17 | //public static readonly Type DataGridTextColumn = typeof(DataGridTextColumn); 18 | public static readonly Type GridSplitter = typeof(GridSplitter); 19 | public static readonly Type Panel = typeof(Panel); 20 | public static readonly Type RelativePanel = typeof(RelativePanel); 21 | public static readonly Type ScrollViewer = typeof(ScrollViewer); 22 | public static readonly Type SplitView = typeof(SplitView); 23 | public static readonly Type StackPanel = typeof(StackPanel); 24 | public static readonly Type TabControl = typeof(TabControl); 25 | public static readonly Type UniformGrid = typeof(UniformGrid); 26 | public static readonly Type WrapPanel = typeof(WrapPanel); 27 | 28 | //Buttons 29 | public static readonly Type Button = typeof(Button); 30 | public static readonly Type RepeatButton = typeof(RepeatButton); 31 | public static readonly Type RadioButton = typeof(RadioButton); 32 | public static readonly Type ToggleButton = typeof(ToggleButton); 33 | public static readonly Type ButtonSpinner = typeof(ButtonSpinner); 34 | public static readonly Type SplitButton = typeof(SplitButton); 35 | //Стиль ToggleSplitButton наследуется от SplitButton 36 | public static readonly Type ToggleSplitButton = typeof(SplitButton); 37 | 38 | //Repeating Data Controls 39 | //public static readonly Type DataGrid = typeof(DataGrid); 40 | public static readonly Type ItemsControl = typeof(ItemsControl); 41 | //public static readonly Type ItemsRepeater = typeof(ItemsRepeater); 42 | public static readonly Type ListBox = typeof(ListBox); 43 | public static readonly Type ComboBox = typeof(ComboBox); 44 | public static readonly Type Carousel = typeof(Carousel); 45 | 46 | 47 | //Text display and editing 48 | public static readonly Type AutoCompleteBox = typeof(AutoCompleteBox); 49 | public static readonly Type TextBlock = typeof(TextBlock); 50 | public static readonly Type TextBox = typeof(TextBox); 51 | public static readonly Type MaskedTextBox = typeof(MaskedTextBox); 52 | 53 | //Value selection 54 | public static readonly Type CheckBox = typeof(CheckBox); 55 | public static readonly Type Slider = typeof(Slider); 56 | public static readonly Type Calendar = typeof(Calendar); 57 | public static readonly Type CalendarDatePicker = typeof(CalendarDatePicker); 58 | public static readonly Type DatePicker = typeof(DatePicker); 59 | public static readonly Type TimePicker = typeof(TimePicker); 60 | public static readonly Type ProgressBar = typeof(ProgressBar); 61 | public static readonly Type NumericUpDown = typeof(NumericUpDown); 62 | 63 | //Displaying images 64 | public static readonly Type Image = typeof(Image); 65 | public static readonly Type PathIcon = typeof(PathIcon); 66 | 67 | //Menus and Popups 68 | public static readonly Type Menu = typeof(Menu); 69 | public static readonly Type MenuItem = typeof(MenuItem); 70 | public static readonly Type NativeMenu = typeof(NativeMenu); 71 | public static readonly Type NativeMenuItem = typeof(NativeMenuItem); 72 | public static readonly Type Flyout = typeof(Flyout); 73 | public static readonly Type ToolTip = typeof(ToolTip); 74 | 75 | //Windows 76 | public static readonly Type Window = typeof(Window); 77 | 78 | } -------------------------------------------------------------------------------- /PeachPie Extension Libraries/Peachpie.Community.ToolKit/vendor/Peachpie/Community/Collections/ObservableCollection.php: -------------------------------------------------------------------------------- 1 | 10 | 11 | Single Line 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | Filled fields 20 | 21 | 22 | 23 | 24 | 25 | Outline fields 26 | 27 | 28 | 29 | 30 | Solo fields 31 | 32 | 33 | 34 | 35 |