[comp.sys.mac.programmer] removing the menu bar

pez@vax1.acs.udel.EDU (Daniel J Pezely) (11/29/88)

I only got one suggestion for removing the menu bar, and that gave me 
something to play with but didn't work out.

I functionally removed the menu bar by chopping it off the screen by
changing the menu bar color.  The suggestion was to change the global 
variable MBarHeight to zero.  This is a very good idea; however, I didn't 
have the time to really try it out.  I could set the height to zero okay,
but when I then I couldn't get rid of the menu bar from the screen.  It
couldn't be accessed because there really was no menu bar, just the old 
image.  I tried to play with some of the "low level" routines in the Window
Manager chapter of Inside Macintosh.  (See pages I-295 through I-297.)
I tried to use the SaveOld() + Drawnew() combination, PaintOne(), and others.
The DrawNew routine would crash my system.  It could have just been an obvious
mistake, by I didn't have the time to investigate it.  

I will persue this later, after the semester ends, when I have time and send
mail to all intereseted.  



Here's something that works and still allows full use of the menus on the bar.
To achieve what I've done, there are two ways of going about this.  First, 
you could get the KOLOR control panel program which lets you completely change
the colors of the menus on the screen.  (I have a Mac II and do not know if
it runs on the other Macs, sorry.)

The second way is to code it.  Here's the C code.  I used THINK's C v2.15.

RGBColor color_black = { 0,0,0 };
RGBColor color_white = { 65535,65535,65535 };
MenuHandle apple_menu;
#define APPLE_CLEARMENU 2

/*	NOTE: for this to work correctly, you must not use the color
**	apple symbol in the menu bar.  You can disable it by inserting
**	a space character in front of the appleMark char in your menu
**	title definition.  Or I think that you could use a non-printable
**	char such as 0x00.
*/

void toggle_menu_bar()
{
	static Boolean on = TRUE;
	MCTable entry;
	MCTablePtr entry_table_ptr;

	entry_table_ptr = entry;
	entry[0].mctID = entry[0].mctItem = 0;

	if (on)
	{
		CheckItem(apple_menu, APPLE_CLEAR_MENU, (on = FALSE));
		entry[0].mctRGB1 = color_black;
		entry[0].mctRGB2 = color_white;
		entry[0].mctRGB3 = color_black;
		entry[0].mctRGB4 = color_black;
		/* this will change the color of the menu bar to black
		** but still allow the sub-menus to be see if pulled 
		** down.
		*/
	}
	else
	{
		CheckItem(apple_menu, APPLE_CLEAR_MENU, (on = TRUE));
		entry[0].mctRGB1 = color_black;
		entry[0].mctRGB2 = color_white;
		entry[0].mctRGB3 = color_black;
		entry[0].mctRGB4 = color_white;
		/* This will return the menu bar to normal */
	}
	SetMCEntries(1, entry_table_ptr);
	DrawMenuBar();
}

I'm sorry if you don't have a Mac II to work with because I don't think that
this will work with other Macs.  Although, this does work even if the "old"
Mac colors are used when only you have enough colors for only the color apple
in the menu.

If you have any comments, please send me mail.  Thank you.

			Daniel Pezely
			pez@vax1.acs.udel.edu
			University of Delaware