-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Native Menu Support #43
Comments
I'd like to work on this, and systray/notification area integration on all three platforms. I may need some help figuring out what changes I need to make to both Photino.Net and Photino.Native. |
@stevesobol That's fantastic. Thank you. I believe the notifications are already implemented in the latest builds, so it's just the native menus remaining. |
There were some other comments here - what happened to them? |
@stevesobol We don't delete anything from issues (except profanity, etc.) I think only you as the author can delete. I don't recall what the comments were. This particular one is for macOS, there are also issues for Windows and Linux. Perhaps the comments are in one of those? |
What is the current status of this task? In mac, this system menu is necessary for copy-paste keyboard shortcut functionality. if @stevesobol do other platform first, I might help some for Mac part. |
If you want to do the work for Mac, that's fine. I haven't touched any Objective-C code in a while, and you're probably better qualified than I am. We need to talk about an API, though. The same set of functions need to work on all three platforms, and the way I see it, there are going to be a couple (dealing with the Preferences and About menu items, specifically) that will actually do something on Mac but will need to be NOPs on the other platforms. I haven't even had the chance to start on the Windows side yet. |
Thanks for sharing. I'm not sure I will have spare time when you complete some common parts done. But please keep sharing progress here or #44. Thank you! |
I would be prepared to work on this as well IFF the native .NET implementation of it can be rolled out ahead of Mac and Linux. I was once a C++ Dev (these days C# and Python). At the moment I only need Windows Menus and can go back to using WebView2 directly with PostMessge for communications. Your project appears to be stalling and I suspect progress on this will be slow. You need a bigger team and more developers. There is even an alternative approach which would be using C#.NET aka Xamarin and XAML whilst similarly integrating with the alternative native web view controls but just for Mac and Linux platforms and that would be the only Native C++ bit. There does need to be enabled and disabled (greyed out) menus. Nested menus, left (e.g. Help) as well as right and menus using graphics (e.g. hamburger) menus, along with he ability to add and remove them dynamically. When you add all of this up it becomes a lot of work. If all of this doesn't eventuate or isnt forthcoming then I would be better off continuing with my own control built around just WebView2+PostMessage for Windows which is all I need at the moment.. If the Windows component used pure C#.NET and didnt unnecesarily rely on the Native component in C++ (as I have been doing) then progress on the Windows side at least would be a lot quicker and more of the guts of the PhotoWindow control would be exposed and available for use on the Windows platform. That said I like it and its simplicity and dont take this as criticism but my own rumination of my own development choices. I started with CefSharp while WebView2 was in beta flux and am now dropping the fromer so I'll pickup Photino again once I see the Menus that meet my needs. Theming also is an open question with a closed Native control: with a pure C#.NET codebase I can switch to something like MahApps with little difficulty even if I have to fork the codebase and make global changes. |
Wow. You do realize that I'm a volunteer, as are other contributors, and we (and the maintainers) are doing this in our spare time, right? It's OSS. If you want to fork the project, great. If you want to go in a different direction, just as great. Waltzing in here and dictating what happens, like you just did... not so great. I'm trying to find time to work on Photino.Native. Native menus are a feature I want to see, and I want to work on that feature. If you want to work on that feature as well, that's wonderful. But the nasty comment isn't necessary. (Note: my opinion is my own and may or may not represent the opinions of other volunteers or MikeYeager.) |
My apologies as maybe I was blunt. Wasn't meant to be nasty. I know you need all the volunteers you can get. But we have an architectural difference as even with menus I can't see how to theme. A pure C#.NET implementation just for the Windows platform would probably be a better way to go for me otherwise I would most certainly pitch in. Please don't take it personally. I was probably pissed myself that I can't find a component that fits my needs - for the moment anyway - even though Photino looks very promising indeed and the only real second choice. Just as an FYI I am looking to use it as a mixed language Web Map Control: Leaflet, OpenLayers or ArcGIS API for JS: as I can't find a Native Map Control that I am happy with either! So again please don't take it personally as I meant no offence. |
This is tricky to implement. No question. Photino's function is to provide platform-specific feature implementations for Windows, Linux and macOS and to make a common, unifying interface. We try to cover every feature common to all platforms and not focus on things that are not available on all platforms, though we'll take them. I started preliminary work to come up with a generic way to define and implement native menus as well as a format for storing and retrieving menus, but didn't get very far before shifting to something else. Those definitions might be a good first step. Then we can get feedback on the plan before implementing on any specific platform. Thoughts? |
@matthewsheeran all good, apology accepted. |
@MikeYeager I think the path you described is the right one. Where native menus are concerned, we will need to make an exception, though: we need to allow people to create event handlers for the Preferences and About items on the Mac application menu - and maybe also Quit. The function or method calls that add those event handlers would exist on the other platforms, but they'd do nothing there. Unless I'm missing something, this doesn't have to be complicated. @matthewsheeran Looking for a clarification. What do you mean by "theme"? In my vision for a typical Photino-powered app, you'd get a window, maybe some menus, maybe a tray/notification item, and theming/styling would be done entirely in CSS/HTML. Are you referring to a Windows theme? |
Yeah, XAML-like theming of the items associated with the containung window
itself: borders, menus, ticked menu styles (one could change ticks to
checkboxes say) and the fonts etc., even just the coloring. I have used say
a MahApps blue. Google for MahApps, Metro Apps and Modern Design and you'll
see how the underlying look and feel can be changed.
Your Photino window will simply stay white or simply always adopt the
user's default Windows theme colors and fonts just like WinForms which was
one of many reasons for WPF.
I think theming the non-JS native parts of Photino will always be too much
trouble and effort certainly cross-platform so will always be one
limitation of it. Just saying. That will be one of the constraints of your
platform, and indeed likely all of the others like Electron etc. I guess
just like docked and other kinds of embedded windows will also be out.
…On Wed., 23 Mar. 2022, 6:20 am Steve Sobol, ***@***.***> wrote:
@MikeYeager <https://github.com/MikeYeager> I think the path you
described is the right one. Where native menus are concerned, we will need
to make an exception, though: we need to allow people to create event
handlers for the Preferences and About items on the Mac application menu -
and maybe also Quit. The function or method calls that add those event
handlers would exist on the other platforms, but they'd do nothing there.
Unless I'm missing something, this doesn't have to be complicated.
@matthewsheeran <https://github.com/matthewsheeran> Looking for a
clarification. What do you mean by "theme"? In my vision for a typical
Photino-powered app, you'd get a window, maybe some menus, maybe a
tray/notification item, and theming/styling would be done entirely in
CSS/HTML.
Are you referring to a Windows theme?
—
Reply to this email directly, view it on GitHub
<#43 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAVF56WZ2BAHL4N2CBEOH2LVBIMQXANCNFSM4ZAWGCVA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Even using XAML, what would you be able to style besides the window frame/chrome? I think that Avalonia might be a far better solution for your use case. Avalonia is cross-platform and uses XAML to declaratively describe your UI. Not sure if it handles Windows visual styles. |
Nah, I don't need any framework just XAML be it WPF or something else in a
pure C#.NET codebase which I will get with WebView2 and .NET 5+ for Desktop.
…On Thu., 24 Mar. 2022, 9:36 am Steve Sobol, ***@***.***> wrote:
@matthewsheeran <https://github.com/matthewsheeran> -
Even using XAML, what would you be able to style besides the window
frame/chrome?
I think that Avalonia might be a far better solution for your use case.
Avalonia is cross-platform *and* uses XAML to declaratively describe your
UI. Not sure if it handles Windows visual styles.
https://avaloniaui.net/
https://github.com/AvaloniaUI/Avalonia
—
Reply to this email directly, view it on GitHub
<#43 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAVF56W4DC72O5GKFRXFOH3VBOMGLANCNFSM4ZAWGCVA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
You could, for example, make the Window chrome look seeamlessly identical
to whichever UI framework Widgets are used inside the JS and there is your
answer as to why someone might want this: so the Browser Web Control Menus
do not look and feel dissimilar and out of place to the rest of the
Application.
On Thu., 24 Mar. 2022, 8:10 pm Matthew Sheeran, ***@***.***>
wrote:
… Nah, I don't need any framework just XAML be it WPF or something else in a
pure C#.NET codebase which I will get with WebView2 and .NET 5+ for Desktop.
On Thu., 24 Mar. 2022, 9:36 am Steve Sobol, ***@***.***>
wrote:
> @matthewsheeran <https://github.com/matthewsheeran> -
>
> Even using XAML, what would you be able to style besides the window
> frame/chrome?
>
> I think that Avalonia might be a far better solution for your use case.
> Avalonia is cross-platform *and* uses XAML to declaratively describe
> your UI. Not sure if it handles Windows visual styles.
>
> https://avaloniaui.net/
>
> https://github.com/AvaloniaUI/Avalonia
>
> —
> Reply to this email directly, view it on GitHub
> <#43 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAVF56W4DC72O5GKFRXFOH3VBOMGLANCNFSM4ZAWGCVA>
> .
> You are receiving this because you were mentioned.Message ID:
> ***@***.***>
>
|
You could just hide the chrome and do your menus and styling in JavaScript. |
Thank you for your suggestion as you are right of course: but I am coming from C#, wanted to get up and running quickly as I already have, need to do some canonicalization of the data next and probably in C# initially, also might eventually want to use some geospatial library or other from C#.NET. My nephew as a novice JavaScript devloper has put me on to react and there is a react leaflet. If I go down the pure JS path later with it then I could go with react native also and ditch any WebView control entirely. I also found some vanila JS code for diff-ing with CSS which I need to do too probably in its own window at least initially which along with your comment got me thinking.. JavaScript with the HTML DOM is definitely the "in thing" like react so time for me to go and read SyncFusion's react(JS) Succinctly!.. (I am hoping it's a clean modular JS made simple as well (and with a reliable build process as well (although that has never really been true of node!).) |
Hey @MikeYeager I'm getting started on implementing native menus - first in Windows, then on other platforms if I have time. I'm using Visual Studio Community 2019 and I am not sure how best to set up my development environment. I'll need to work on the .NET side and the native side at the same time. Is it best to create a new solution containing all of the .NET projects, and the Native project? |
I would go the new .NET 6 with MAUI XAML myself..
…On Sun., 31 Jul. 2022, 5:35 am Steve Sobol, ***@***.***> wrote:
Hey @MikeYeager <https://github.com/MikeYeager>
I'm getting started on implementing native menus - first in Windows, then
on other platforms if I have time. I'm using Visual Studio Community 2019
and I am not sure how best to set up my development environment. I'll need
to work on the .NET side and the native side at the same time. Is it best
to create a new solution containing all of the .NET projects, *and* the
Native project?
—
Reply to this email directly, view it on GitHub
<#43 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAVF56XPQ3RCMKG4FZXLDSDVWV7XRANCNFSM4ZAWGCVA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
For some reason, the reply I emailed a few minutes ago did not make it to Github. I'll just reproduce it here (now watch, I'll finish making my comment here on the site, and two minutes later, my emailed comment will arrive) @matthewsheeran - I actually prefer the idea of using HTML/CSS/JS and creating an attractive UI in React. XAML is great, but it's not my first choice. It feels clunky to me. This comment isn't intended to be derogatory to XAML, which is more than capable of handling lots of different scenarios. Nor is it intended to be derogatory to MAUI, which I haven't even played with yet. HTML/CSS/JS/React/Bootstrap is a personal preference. Besides... I want to contribute to this project. I see a lot of potential for it to become very popular, if we build it into a useful product. The current feature set is nice, but I would like to help take the project from "that's nice" to "OMG WHY AM I NOT USING THIS?!" Anyhow... my goal is to extend Photino, so recommending XAML to me is completely pointless. If I wanted to use MAUI, I probably would not be volunteering to add features to Photino in the first place. |
I actually prefer the idea of using HTML/CSS/JS and creating an attractive UI in React. XAML is great, but it's not my first choice. It feels clunky to me.
Anyhow... my goal is to extend Photino, so recommending XAML to me is completely pointless. If I wanted to use MAUI, I probably would _not_ be volunteering to add features to Photino in the first place.
Saturday, July 30, 2022, 10:15:17 PM, you wrote:
… I would go the new .NET 6 with MAUI XAML myself..
On Sun., 31 Jul. 2022, 5:35 am Steve Sobol, ***@***.***>
wrote:
> Hey @MikeYeager <https://github.com/MikeYeager>
>
> I'm getting started on implementing native menus - first in Windows, then
> on other platforms if I have time. I'm using Visual Studio Community 2019
> and I am not sure how best to set up my development environment. I'll need
> to work on the .NET side and the native side at the same time. Is it best
> to create a new solution containing all of the .NET projects, *and* the
> Native project?
>
> —
> Reply to this email directly, view it on GitHub
> <#43 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAVF56XPQ3RCMKG4FZXLDSDVWV7XRANCNFSM4ZAWGCVA>
> .
> You are receiving this because you were mentioned.Message ID:
> ***@***.***>
>
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.
|
My apologies as maybe I was blunt. Wasn't meant to be nasty. I know you
need all the volunteers you can get. But we have an architectural
difference as even with menus I can't see how to theme. A pure C#.NET
implementation just for the Windows platform would probably be a better way
to go for me otherwise I would most certainly pitch in. Please don't take
it personally. I was probably pissed myself that I can't find a component
that fits my needs - for the moment anyway - even though Photino looks very
promising indeed and the only real second choice.
Just as an FYI I am looking to use it as a mixed language Web Map Control:
Leaflet, OpenLayers or ArcGIS API for JS: as I can't find a Native Map
Control that I am happy with either! So again please don't take it
personally as I meant no offence.
…On Tue., 22 Mar. 2022, 6:40 am Steve Sobol, ***@***.***> wrote:
Wow. You do realize that I'm a volunteer, as are other contributors, and
we (and the maintainers) are doing this in our spare time, right?
It's OSS. If you want to fork the project, great. If you want to go in a
different direction, just as great. Waltzing in here and dictating what
happens, like you just did... not so great.
I'm trying to find time to work on Photino.Native. Native menus are a
feature I want to see, and I want to work on that feature. If you want to
work on that feature as well, that's wonderful. But the nasty comment isn't
necessary.
(Note: my opinion is my own and may or may not represent the opinions of
other volunteers or MikeYeager.)
—
Reply to this email directly, view it on GitHub
<#43 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAVF56V62DJP7HQEYRQUYHTVBDGEFANCNFSM4ZAWGCVA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Ok, what's going on? @matthewsheeran - this latest reply from you isn't 15 hours old, it's at least a month or two old, as is the message that you replied to. I haven't posted anything anywhere on Github in the past 24 hours. |
I am actually now after experimentation with WebView2 learning towards JS
Menus rather then native C# XAML MAUI etc framework Menus solution myself
now. Multi-language Interop is always a pain. And the JS can be changed
more easily dynamically at runtime without Interop. There is less dynamism
in C# and if the functionality is only calling JS anyways well theb that's
your answer. The reverse is straight forwards and can be catered for
relatively easily but should definitately catered for in a hopefully
somewhat cross-platform way (i.e. messaging).
There you go: you can close the thread now and drop me off the responders
list.
Thanks
Matthew.
…On Wed., 12 Oct. 2022, 9:48 am Steve Sobol, ***@***.***> wrote:
Ok, what's going on? @matthewsheeran <https://github.com/matthewsheeran>
- this latest reply from you isn't 15 hours old, it's at least a month or
two old, as is the message that you replied to. I haven't posted anything
anywhere on Github in the past 24 hours.
—
Reply to this email directly, view it on GitHub
<#43 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAVF56QT2MEAQHJNVUXHE4TWCXVDRANCNFSM4ZAWGCVA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Wow, ok. I can't do either of those things. I can't close the thread because I didn't open it. I can't unsubscribe you from responses to this thread because I'm not you. You can unsubscribe from the Notifications page. |
No worries I have unsubscribed and all best with it.
Can't remeber how easy or complex photo Interop backwards to C# was from JS
in photino but its pretty straight forward in WebView2.
You can pick and choose whatever framework and style you want for any
custom JS Menus (I prefer popups) and make them even look native. And yes I
have to tell you that XAML styling of native C# Menus was and still is a
pain in the arse compared to CSS. Hence the reason for my change of heart
on this especially if you have the bulk of your code and functionality in
JS. I wasn't sure if I will use more C# Libraries and started off that way
anyway and like I said the JS can be the View Controller and call backwards
if needs be.
In this case you dont need to add or bake in any JS Menus at all except as
useful styled examples for users of the library to reuse and save them
reinventing the wheel whilst making sure it is stylable and will work with
whatever frameworks they choose: react, angular, polymer whatever whatever..
Best Regards.
…On Fri., 14 Oct. 2022, 1:07 pm Steve Sobol, ***@***.***> wrote:
Wow, ok.
I can't do either of those things.
I can't close the thread because I didn't open it.
I can't unsubscribe you from responses to this thread because I'm not you.
You can unsubscribe from the Notifications page.
—
Reply to this email directly, view it on GitHub
<#43 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAVF56ULYISLFOWSRSA2WUDWDC56JANCNFSM4ZAWGCVA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@MikeYeager So yeah, I know I'm a little behind with work I want to get done on several OSS projects including this one... But tonight, I'm sitting here actually trying to figure out how to move forward with this work I've promised to do. And on the native end, getting menus working means we are going to need to interact with
I think this is going to require a lot of P/Invoke calls, which I'm hoping work the same way on Mac and Linux that they do on Windows. This will not be pretty. 🤣 |
@stevesobol Agreed! (That's why this one has been postponed for so long :-)) I think the initial conversation has to be how to define and interface that unifies all platforms. For very basic menu items and sub-menus it's pretty straightforward, but it gets complex quickly with things like separator lines, icons, hot keys, multi-line items, support for OS themes, multi-level sub-menus, fonts, etc., etc. This is going to be fun! Also, there should probably be some way to define and save/recall an entire menu structure. (JSON maybe?) |
Saving/recalling (importing/exporting) menus seems like it'd be simple. C# and Javascript objects can be serialized to JSON. Let me think about the API - I'll get back to you. |
What do you think about adding methods to
And (macOS specific) |
window.external.photino
…On Fri, 1 Dec 2023, 7:52 am Steve Sobol, ***@***.***> wrote:
What do you think about adding methods to window.external?
window.external.addMenuItem()
window.external.deleteMenuItem()
window.external.modifyMenuItem()
And (macOS specific)
window.external.macosAddAboutMenutItem()
window.external.macosAddPreferencesMenuItem()
—
Reply to this email directly, view it on GitHub
<#43 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAVF56SA4ZBLTFEUDHW4DLDYHDWZ3AVCNFSM4ZAWGCVKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBTGQ2TIMZXGE2Q>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Allow user to manipulate OS menu
By passing in JSON for initialization
Still need an API to add, remove, disable, etc.
The text was updated successfully, but these errors were encountered: