reorganize
This commit is contained in:
parent
2a25e02514
commit
57316e3557
48
desktop-framework-dotnet/src/lib/MBS.Desktop/CommandBar.cs
Normal file
48
desktop-framework-dotnet/src/lib/MBS.Desktop/CommandBar.cs
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
// Copyright (C) 2024 Michael Becker <alcexhim@gmail.com>
|
||||||
|
//
|
||||||
|
// This file is part of editor-dotnet.
|
||||||
|
//
|
||||||
|
// editor-dotnet is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// editor-dotnet is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with editor-dotnet. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Collections.Specialized;
|
||||||
|
using MBS.Core;
|
||||||
|
|
||||||
|
namespace MBS.Desktop;
|
||||||
|
|
||||||
|
public class CommandBar
|
||||||
|
{
|
||||||
|
public Union<Guid, string> ID { get; }
|
||||||
|
public string Title { get; set; }
|
||||||
|
public ICollection<CommandItem> Items { get; }
|
||||||
|
|
||||||
|
public CommandBar(Union<Guid, string> id, string title)
|
||||||
|
{
|
||||||
|
ID = id;
|
||||||
|
Title = title;
|
||||||
|
|
||||||
|
ObservableCollection<CommandItem> coll = new ObservableCollection<CommandItem>();
|
||||||
|
coll.CollectionChanged += coll_CollectionChanged;
|
||||||
|
|
||||||
|
Items = coll;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void coll_CollectionChanged(object? sender, NotifyCollectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Action == NotifyCollectionChangedAction.Add)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,4 +1,5 @@
|
|||||||
using MBS.Desktop.Controls;
|
using MBS.Core;
|
||||||
|
using MBS.Desktop.Controls;
|
||||||
|
|
||||||
namespace MBS.Desktop;
|
namespace MBS.Desktop;
|
||||||
|
|
||||||
@ -35,4 +36,20 @@ public class DesktopApplication : MBS.Core.Application
|
|||||||
{
|
{
|
||||||
base.StopInternal(exitCode);
|
base.StopInternal(exitCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnStartup(EventArgs e)
|
||||||
|
{
|
||||||
|
base.OnStartup(e);
|
||||||
|
|
||||||
|
Console.WriteLine("creating menu bars");
|
||||||
|
|
||||||
|
CommandBar menubar = new CommandBar(new Guid("{9a67ff4f-7532-4c5e-a2e8-772940863748}"), "Menu Bar");
|
||||||
|
// ((DesktopApplication)Instance).CommandBars.Add(menubar);
|
||||||
|
|
||||||
|
menubar.Items.Add(new CommandReferenceCommandItem("File"));
|
||||||
|
menubar.Items.Add(new CommandReferenceCommandItem("Edit"));
|
||||||
|
menubar.Items.Add(new CommandReferenceCommandItem("View"));
|
||||||
|
menubar.Items.Add(new CommandReferenceCommandItem("Window"));
|
||||||
|
menubar.Items.Add(new CommandReferenceCommandItem("Help"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,8 @@
|
|||||||
using MBS.Core;
|
using MBS.Core;
|
||||||
using MBS.Desktop.Layouts;
|
using MBS.Desktop.Layouts;
|
||||||
|
using MBS.Desktop.Controls;
|
||||||
|
|
||||||
namespace MBS.Desktop.Controls;
|
namespace MBS.Desktop;
|
||||||
|
|
||||||
public class MainWindow : Window
|
public class MainWindow : Window
|
||||||
{
|
{
|
||||||
@ -1,6 +1,8 @@
|
|||||||
using MBS.Core.Drawing;
|
using MBS.Core.Drawing;
|
||||||
|
|
||||||
namespace MBS.Desktop.Controls;
|
namespace MBS.Desktop;
|
||||||
|
|
||||||
|
using MBS.Desktop.Controls;
|
||||||
|
|
||||||
public class Window : Container
|
public class Window : Container
|
||||||
{
|
{
|
||||||
Loading…
x
Reference in New Issue
Block a user