On Sunday, Nov 30, 2003, at 16:47 US/Central, Michael D. Crawford wrote:
> Should ZMenuInstall::GetAppleMenu return a non-null value (or rather a
> ZRef with a non-null pointer in it) on Windows?
>
> I do this:
>
> ZRef< ZMenu > appleMenu( inMenuInstall.GetAppleMenu() );
>
> if ( appleMenu )
> {
> appleMenu->RemoveAll();
> appleMenu->Append( mcAbout, "About ", + GetAppName() + "..." );
> }
>
> The code inside the if is executed on Win32.
>
> This isn't really a problem, but I was also testing the value to see
> if I should put my "About" item in the Help menu, which is how Windows
> applications usually do it.
>
> It's not really a problem because I can use #if to see what platform
> I'm on.
It has been different in the past, although with a different menu API.
Now checking for the target platform is probably the best solution.
Given that GetAppleMenu is always available I'd recommend doing:
if (ZCONFIG(OS, MacOS7) || ZCONFIG(OS, Carbon)))
rather than
#if (ZCONFIG(OS, MacOS7) || ZCONFIG(OS, Carbon)))
so that the code is compiled-but-stripped rather than simply ignored,
helping to ensure the code always compiles regardless of which platform
you're happening to test against.
Another possibility would be to use ZApp::HasGlobalMenuBar(), which
returns true only on MacOS.
A+
--
Andrew Green mailto:ag...@em...
Electric Magic Co. Vox/Fax: +1 (408) 907 2101
|