FLTK logo

Re: [fltk.general] Re: Use native parent window with fltk widgets to retain Mac menubar of parent application

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.general  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: Re: Use native parent window with fltk widgets to retain Mac menubar of parent application Albrecht Schlosser Sep 25, 2021  
 
On 9/24/21 7:45 PM Bill Spitzak wrote:
I think we are talking about the same thing. Basically, if the FLTK program does not make any calls to Fl_Sys_Menu_Bar, then the menu bar on the top of the mac is left absolutely unchanged (either as whatever another toolkit set it to, or whatever the default behavior of Mac is when you don't do anything). It sounds like the current FLTK messes with the top menu when the programmer does nothing, which I don't think is correct behavior.

I'm not sure about this. For instance, the test/demo app seems to add 'about demo' and 'Print Front Window' items which I think are generally useful.

I'm not a regular Mac user and didn't explore the Sys_Menu_Bar features yet, so my observations may not be helpful.

For avoiding having to change your code depending on the platform, I think a window subclass (MainWindow?) would work. If a Sys_Menu_Bar is set up on a system that does not have such a menubar, these windows move all the widgets down sufficiently and add a regular MenuBar. This would allow the programmer to select what window(s) get menu bars, rather than a single one or all of them.

+1 ... basically ...

This sounds sensible. However I would rather use an Fl_Window method - maybe main_window() or menu_bar_window() - since we have more than one window class that needs this (Fl_Window, Fl_Double_Window, ...). Hard to tell which one to derive the 'MainWindow' class from.

I'm also not sure what would be "sufficient" to add a regular MenuBar. This should likely be a user option as well. I know from my own experience that I had a program where the menubar contained icons which made it taller than a "normal" menubar.

OTOH I could also imagine an option that does "the opposite": think of a "standard" (i.e. non-macOS) program that includes a standard menubar. An option to "convert" this Fl_Menu_Bar to a system menubar *and* move all the other widgets up by the height of the given menubar *and* decrease the window height by the same amount would make this application cross-platform w/o changing any code.

Again, I'm not sure if this would be feasible for a "real" program because I don't know much about the different menu bar approaches on macOS and other platforms.

There are maybe more (better?) options to make a "standard" application macOS (ie. system menubar) aware w/o having to use platform specific code, different widget positions, and window sizes. At least I hope so.

--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/6d9f1495-b36c-2e12-49fb-ddd7647d3cd2%40online.de.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.