xref: /haiku/src/kits/interface/MenuPrivate.cpp (revision e8d4db8e0ba3f1a01f34a11ab5e6fd25d83596ab)
17a8567e6SStefano Ceccherini /*
27a8567e6SStefano Ceccherini  * Copyright 2001-2009, Haiku, Inc.
37a8567e6SStefano Ceccherini  * Distributed under the terms of the MIT License.
47a8567e6SStefano Ceccherini  *
57a8567e6SStefano Ceccherini  * Authors:
67a8567e6SStefano Ceccherini  *		Stefano Ceccherini (stefano.ceccherini@gmail.com)
77a8567e6SStefano Ceccherini  */
87a8567e6SStefano Ceccherini 
97a8567e6SStefano Ceccherini #include <MenuPrivate.h>
107a8567e6SStefano Ceccherini 
117a8567e6SStefano Ceccherini #include <Bitmap.h>
127a8567e6SStefano Ceccherini #include <Menu.h>
137a8567e6SStefano Ceccherini 
148abe72fbSJohn Scipione 
158abe72fbSJohn Scipione const unsigned char kShiftBits[] = {
168abe72fbSJohn Scipione 	0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x14,
178abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
188abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x17,0x04,0x04,0x17,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
198abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x04,0x17,0x17,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x04,0x04,0x1a,0x04,0x04,0x04,0x1a,0x17,0x14,
208abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x17,0x04,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
218abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x04,0x1a,0x04,0x04,0x04,0x1a,0x04,0x1a,0x04,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
228abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x04,0x17,0x17,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
238abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x17,0x04,0x04,0x17,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
248abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
258abe72fbSJohn Scipione 	0x1d,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x14,
268abe72fbSJohn Scipione 	0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14
278abe72fbSJohn Scipione };
288abe72fbSJohn Scipione 
298abe72fbSJohn Scipione 
307a8567e6SStefano Ceccherini const unsigned char kCtrlBits[] = {
318abe72fbSJohn Scipione 	0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x14,
328abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
338abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x13,0x04,0x04,0x13,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
348abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x04,0x04,0x1a,0x04,0x04,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x17,0x14,
358abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x17,0x14,
368abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x04,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x17,0x14,
378abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x04,0x1a,0x1a,0x04,0x1a,0x1a,0x1a,0x17,0x14,
388abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x13,0x04,0x04,0x13,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x13,0x04,0x1a,0x04,0x04,0x04,0x1a,0x17,0x14,
398abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
408abe72fbSJohn Scipione 	0x1d,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x14,
418abe72fbSJohn Scipione 	0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14
428abe72fbSJohn Scipione };
438abe72fbSJohn Scipione 
448abe72fbSJohn Scipione 
458abe72fbSJohn Scipione const unsigned char kOptBits[] = {
467a8567e6SStefano Ceccherini 	0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x14,
477a8567e6SStefano Ceccherini 	0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
488abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x13,0x04,0x04,0x13,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
498abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x04,0x1a,0x04,0x04,0x04,0x1a,0x17,0x14,
508abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x17,0x14,
518abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x04,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
528abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
538abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x13,0x04,0x04,0x13,0x1a,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
547a8567e6SStefano Ceccherini 	0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
557a8567e6SStefano Ceccherini 	0x1d,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x14,
567a8567e6SStefano Ceccherini 	0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14
577a8567e6SStefano Ceccherini };
587a8567e6SStefano Ceccherini 
597a8567e6SStefano Ceccherini 
607a8567e6SStefano Ceccherini const unsigned char kAltBits[] = {
617a8567e6SStefano Ceccherini 	0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x14,
627a8567e6SStefano Ceccherini 	0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
637a8567e6SStefano Ceccherini 	0x1d,0x1a,0x1a,0x13,0x04,0x04,0x13,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
647a8567e6SStefano Ceccherini 	0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x04,0x04,0x04,0x1a,0x17,0x14,
657a8567e6SStefano Ceccherini 	0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
667a8567e6SStefano Ceccherini 	0x1d,0x1a,0x1a,0x04,0x04,0x04,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
677a8567e6SStefano Ceccherini 	0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
687a8567e6SStefano Ceccherini 	0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x04,0x04,0x1a,0x04,0x1a,0x1a,0x17,0x14,
697a8567e6SStefano Ceccherini 	0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
707a8567e6SStefano Ceccherini 	0x1d,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x14,
717a8567e6SStefano Ceccherini 	0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14
727a8567e6SStefano Ceccherini };
737a8567e6SStefano Ceccherini 
747a8567e6SStefano Ceccherini 
758abe72fbSJohn Scipione const unsigned char kMenuBits[] = {
768abe72fbSJohn Scipione 	0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x14,
778abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
788abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x04,0x04,0x1a,0x04,0x04,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
798abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x04,0x04,0x04,0x04,0x04,0x1a,0x04,0x04,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x17,0x14,
808abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x04,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x17,0x14,
818abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x04,0x04,0x1a,0x04,0x04,0x04,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x17,0x14,
828abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x17,0x14,
838abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x04,0x04,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x04,0x04,0x1a,0x17,0x14,
848abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
858abe72fbSJohn Scipione 	0x1d,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x14,
868abe72fbSJohn Scipione 	0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14
877a8567e6SStefano Ceccherini };
887a8567e6SStefano Ceccherini 
897a8567e6SStefano Ceccherini 
907a8567e6SStefano Ceccherini namespace BPrivate {
917a8567e6SStefano Ceccherini 
92dcc8ae91SStefano Ceccherini 
938abe72fbSJohn Scipione BBitmap* MenuPrivate::sMenuItemShift;
94dcc8ae91SStefano Ceccherini BBitmap* MenuPrivate::sMenuItemControl;
95dcc8ae91SStefano Ceccherini BBitmap* MenuPrivate::sMenuItemOption;
968abe72fbSJohn Scipione BBitmap* MenuPrivate::sMenuItemAlt;
978abe72fbSJohn Scipione BBitmap* MenuPrivate::sMenuItemMenu;
98dcc8ae91SStefano Ceccherini 
997a8567e6SStefano Ceccherini 
MenuPrivate(BMenu * menu)1007a8567e6SStefano Ceccherini MenuPrivate::MenuPrivate(BMenu* menu)
1017a8567e6SStefano Ceccherini 	:
1027a8567e6SStefano Ceccherini 	fMenu(menu)
1037a8567e6SStefano Ceccherini {
1047a8567e6SStefano Ceccherini }
1057a8567e6SStefano Ceccherini 
1067a8567e6SStefano Ceccherini 
1077a8567e6SStefano Ceccherini menu_layout
Layout() const1087a8567e6SStefano Ceccherini MenuPrivate::Layout() const
1097a8567e6SStefano Ceccherini {
1107a8567e6SStefano Ceccherini 	return fMenu->Layout();
1117a8567e6SStefano Ceccherini }
1127a8567e6SStefano Ceccherini 
1137a8567e6SStefano Ceccherini 
1147a8567e6SStefano Ceccherini void
SetLayout(menu_layout layout)11535384ab4SJohn Scipione MenuPrivate::SetLayout(menu_layout layout)
11635384ab4SJohn Scipione {
11735384ab4SJohn Scipione 	fMenu->fLayout = layout;
11835384ab4SJohn Scipione }
11935384ab4SJohn Scipione 
12035384ab4SJohn Scipione 
12135384ab4SJohn Scipione void
ItemMarked(BMenuItem * item)1227a8567e6SStefano Ceccherini MenuPrivate::ItemMarked(BMenuItem* item)
1237a8567e6SStefano Ceccherini {
1247a8567e6SStefano Ceccherini 	fMenu->_ItemMarked(item);
1257a8567e6SStefano Ceccherini }
1267a8567e6SStefano Ceccherini 
1277a8567e6SStefano Ceccherini 
1287a8567e6SStefano Ceccherini void
CacheFontInfo()1297a8567e6SStefano Ceccherini MenuPrivate::CacheFontInfo()
1307a8567e6SStefano Ceccherini {
1317a8567e6SStefano Ceccherini 	fMenu->_CacheFontInfo();
1327a8567e6SStefano Ceccherini }
1337a8567e6SStefano Ceccherini 
1347a8567e6SStefano Ceccherini 
1357a8567e6SStefano Ceccherini float
FontHeight() const1367a8567e6SStefano Ceccherini MenuPrivate::FontHeight() const
1377a8567e6SStefano Ceccherini {
1387a8567e6SStefano Ceccherini 	return fMenu->fFontHeight;
1397a8567e6SStefano Ceccherini }
1407a8567e6SStefano Ceccherini 
1417a8567e6SStefano Ceccherini 
1427a8567e6SStefano Ceccherini float
Ascent() const1437a8567e6SStefano Ceccherini MenuPrivate::Ascent() const
1447a8567e6SStefano Ceccherini {
1457a8567e6SStefano Ceccherini 	return fMenu->fAscent;
1467a8567e6SStefano Ceccherini }
1477a8567e6SStefano Ceccherini 
1487a8567e6SStefano Ceccherini 
1497a8567e6SStefano Ceccherini BRect
Padding() const1507a8567e6SStefano Ceccherini MenuPrivate::Padding() const
1517a8567e6SStefano Ceccherini {
1527a8567e6SStefano Ceccherini 	return fMenu->fPad;
1537a8567e6SStefano Ceccherini }
1547a8567e6SStefano Ceccherini 
1557a8567e6SStefano Ceccherini 
1567a8567e6SStefano Ceccherini void
GetItemMargins(float * left,float * top,float * right,float * bottom) const157d97b4340SJohn Scipione MenuPrivate::GetItemMargins(float* left, float* top, float* right,
158d97b4340SJohn Scipione 	float* bottom) const
1597a8567e6SStefano Ceccherini {
1607a8567e6SStefano Ceccherini 	fMenu->GetItemMargins(left, top, right, bottom);
1617a8567e6SStefano Ceccherini }
1627a8567e6SStefano Ceccherini 
1637a8567e6SStefano Ceccherini 
164*e8d4db8eSJohn Scipione void
SetItemMargins(float left,float top,float right,float bottom)165*e8d4db8eSJohn Scipione MenuPrivate::SetItemMargins(float left, float top, float right, float bottom)
166*e8d4db8eSJohn Scipione {
167*e8d4db8eSJohn Scipione 	fMenu->SetItemMargins(left, top, right, bottom);
168*e8d4db8eSJohn Scipione }
169*e8d4db8eSJohn Scipione 
170*e8d4db8eSJohn Scipione 
1717a8567e6SStefano Ceccherini int
State(BMenuItem ** item) const1727a8567e6SStefano Ceccherini MenuPrivate::State(BMenuItem** item) const
1737a8567e6SStefano Ceccherini {
1747a8567e6SStefano Ceccherini 	return fMenu->_State(item);
1757a8567e6SStefano Ceccherini }
1767a8567e6SStefano Ceccherini 
1777a8567e6SStefano Ceccherini 
1787a8567e6SStefano Ceccherini void
Install(BWindow * window)1797a8567e6SStefano Ceccherini MenuPrivate::Install(BWindow* window)
1807a8567e6SStefano Ceccherini {
1817a8567e6SStefano Ceccherini 	fMenu->_Install(window);
1827a8567e6SStefano Ceccherini }
1837a8567e6SStefano Ceccherini 
1847a8567e6SStefano Ceccherini 
1857a8567e6SStefano Ceccherini void
Uninstall()1867a8567e6SStefano Ceccherini MenuPrivate::Uninstall()
1877a8567e6SStefano Ceccherini {
1887a8567e6SStefano Ceccherini 	fMenu->_Uninstall();
1897a8567e6SStefano Ceccherini }
1907a8567e6SStefano Ceccherini 
1917a8567e6SStefano Ceccherini 
1927a8567e6SStefano Ceccherini void
SetSuper(BMenu * menu)1937a8567e6SStefano Ceccherini MenuPrivate::SetSuper(BMenu* menu)
1947a8567e6SStefano Ceccherini {
1957a8567e6SStefano Ceccherini 	fMenu->fSuper = menu;
1967a8567e6SStefano Ceccherini }
1977a8567e6SStefano Ceccherini 
1987a8567e6SStefano Ceccherini 
1997a8567e6SStefano Ceccherini void
SetSuperItem(BMenuItem * item)2007a8567e6SStefano Ceccherini MenuPrivate::SetSuperItem(BMenuItem* item)
2017a8567e6SStefano Ceccherini {
2027a8567e6SStefano Ceccherini 	fMenu->fSuperitem = item;
2037a8567e6SStefano Ceccherini }
2047a8567e6SStefano Ceccherini 
2057a8567e6SStefano Ceccherini 
2067a8567e6SStefano Ceccherini void
InvokeItem(BMenuItem * item,bool now)2077a8567e6SStefano Ceccherini MenuPrivate::InvokeItem(BMenuItem* item, bool now)
2087a8567e6SStefano Ceccherini {
2097a8567e6SStefano Ceccherini 	fMenu->_InvokeItem(item, now);
2107a8567e6SStefano Ceccherini }
2117a8567e6SStefano Ceccherini 
2127a8567e6SStefano Ceccherini 
2137a8567e6SStefano Ceccherini void
QuitTracking(bool thisMenuOnly)2147a8567e6SStefano Ceccherini MenuPrivate::QuitTracking(bool thisMenuOnly)
2157a8567e6SStefano Ceccherini {
2167a8567e6SStefano Ceccherini 	fMenu->_QuitTracking(thisMenuOnly);
2177a8567e6SStefano Ceccherini }
2187a8567e6SStefano Ceccherini 
2197a8567e6SStefano Ceccherini 
2207a8567e6SStefano Ceccherini /* static */
2217a8567e6SStefano Ceccherini status_t
CreateBitmaps()2227a8567e6SStefano Ceccherini MenuPrivate::CreateBitmaps()
2237a8567e6SStefano Ceccherini {
22461dfdec4SJohn Scipione 	BRect smallRect(0.0f, 0.0f, 16.0f, 10.0f);
2258abe72fbSJohn Scipione 
226eac9c545SStefano Ceccherini 	try {
22761dfdec4SJohn Scipione 		sMenuItemShift = new BBitmap(BRect(0.0f, 0.0f, 23.0f, 10.0f), B_CMAP8);
22861dfdec4SJohn Scipione 		sMenuItemControl = new BBitmap(BRect(0.0f, 0.0f, 21.0f, 10.0f),
22961dfdec4SJohn Scipione 			B_CMAP8);
230dcc8ae91SStefano Ceccherini 		sMenuItemOption = new BBitmap(smallRect, B_CMAP8);
2318abe72fbSJohn Scipione 		sMenuItemAlt = new BBitmap(smallRect, B_CMAP8);
23261dfdec4SJohn Scipione 		sMenuItemMenu = new BBitmap(BRect(0.0f, 0.0f, 22.0f, 10.0f), B_CMAP8);
233eac9c545SStefano Ceccherini 	} catch (...) {
234eac9c545SStefano Ceccherini 		return B_NO_MEMORY;
235eac9c545SStefano Ceccherini 	}
2367a8567e6SStefano Ceccherini 
2378abe72fbSJohn Scipione 	sMenuItemShift->ImportBits(kShiftBits, sizeof(kShiftBits),
2388abe72fbSJohn Scipione 		24, 0, B_CMAP8);
239dcc8ae91SStefano Ceccherini 	sMenuItemControl->ImportBits(kCtrlBits, sizeof(kCtrlBits),
2408abe72fbSJohn Scipione 		22, 0, B_CMAP8);
241dcc8ae91SStefano Ceccherini 	sMenuItemOption->ImportBits(kOptBits, sizeof(kOptBits),
2427a8567e6SStefano Ceccherini 		17, 0, B_CMAP8);
2438abe72fbSJohn Scipione 	sMenuItemAlt->ImportBits(kAltBits, sizeof(kAltBits),
2448abe72fbSJohn Scipione 		17, 0, B_CMAP8);
2458abe72fbSJohn Scipione 	sMenuItemMenu->ImportBits(kMenuBits, sizeof(kMenuBits),
2468abe72fbSJohn Scipione 		23, 0, B_CMAP8);
2477a8567e6SStefano Ceccherini 
2487a8567e6SStefano Ceccherini 	return B_OK;
2497a8567e6SStefano Ceccherini }
2507a8567e6SStefano Ceccherini 
2517a8567e6SStefano Ceccherini 
2527a8567e6SStefano Ceccherini /* static */
2537a8567e6SStefano Ceccherini void
DeleteBitmaps()2547a8567e6SStefano Ceccherini MenuPrivate::DeleteBitmaps()
2557a8567e6SStefano Ceccherini {
2568abe72fbSJohn Scipione 	delete sMenuItemShift;
257dcc8ae91SStefano Ceccherini 	delete sMenuItemControl;
258dcc8ae91SStefano Ceccherini 	delete sMenuItemOption;
2598abe72fbSJohn Scipione 	delete sMenuItemAlt;
2608abe72fbSJohn Scipione 	delete sMenuItemMenu;
2617a8567e6SStefano Ceccherini }
2627a8567e6SStefano Ceccherini 
2637a8567e6SStefano Ceccherini 
2647a8567e6SStefano Ceccherini /* static */
2657a8567e6SStefano Ceccherini const BBitmap*
MenuItemShift()2667a8567e6SStefano Ceccherini MenuPrivate::MenuItemShift()
2677a8567e6SStefano Ceccherini {
268dcc8ae91SStefano Ceccherini 	return sMenuItemShift;
2697a8567e6SStefano Ceccherini }
2707a8567e6SStefano Ceccherini 
2717a8567e6SStefano Ceccherini 
2728abe72fbSJohn Scipione /* static */
2738abe72fbSJohn Scipione const BBitmap*
MenuItemControl()2748abe72fbSJohn Scipione MenuPrivate::MenuItemControl()
2758abe72fbSJohn Scipione {
2768abe72fbSJohn Scipione 	switch (BMenu::sControlKey) {
2778abe72fbSJohn Scipione 		case 0x5d:
2788abe72fbSJohn Scipione 		case 0x5f:
2798abe72fbSJohn Scipione 			return sMenuItemAlt;
28061dfdec4SJohn Scipione 
2818abe72fbSJohn Scipione 		case 0x66:
2828abe72fbSJohn Scipione 		case 0x67:
2838abe72fbSJohn Scipione 			return sMenuItemOption;
2848abe72fbSJohn Scipione 	}
2858abe72fbSJohn Scipione 
2868abe72fbSJohn Scipione 	return sMenuItemControl;
2878abe72fbSJohn Scipione }
2888abe72fbSJohn Scipione 
2898abe72fbSJohn Scipione 
2908abe72fbSJohn Scipione /* static */
2918abe72fbSJohn Scipione const BBitmap*
MenuItemOption()2928abe72fbSJohn Scipione MenuPrivate::MenuItemOption()
2938abe72fbSJohn Scipione {
2948abe72fbSJohn Scipione 	switch (BMenu::sOptionKey) {
2958abe72fbSJohn Scipione 		case 0x5c:
2968abe72fbSJohn Scipione 		case 0x60:
2978abe72fbSJohn Scipione 			return sMenuItemControl;
29861dfdec4SJohn Scipione 
2998abe72fbSJohn Scipione 		case 0x66:
3008abe72fbSJohn Scipione 		case 0x67:
3018abe72fbSJohn Scipione 			return sMenuItemOption;
3028abe72fbSJohn Scipione 	}
3038abe72fbSJohn Scipione 
3048abe72fbSJohn Scipione 	return sMenuItemAlt;
3058abe72fbSJohn Scipione }
3068abe72fbSJohn Scipione 
3078abe72fbSJohn Scipione 
3088abe72fbSJohn Scipione /* static */
3098abe72fbSJohn Scipione const BBitmap*
MenuItemCommand()3108abe72fbSJohn Scipione MenuPrivate::MenuItemCommand()
3118abe72fbSJohn Scipione {
3128abe72fbSJohn Scipione 	switch (BMenu::sCommandKey) {
3138abe72fbSJohn Scipione 		case 0x5c:
3148abe72fbSJohn Scipione 		case 0x60:
3158abe72fbSJohn Scipione 			return sMenuItemControl;
31661dfdec4SJohn Scipione 
3178abe72fbSJohn Scipione 		case 0x66:
3188abe72fbSJohn Scipione 		case 0x67:
3198abe72fbSJohn Scipione 			return sMenuItemOption;
3208abe72fbSJohn Scipione 	}
3218abe72fbSJohn Scipione 
3228abe72fbSJohn Scipione 	return sMenuItemAlt;
3238abe72fbSJohn Scipione }
3248abe72fbSJohn Scipione 
3258abe72fbSJohn Scipione 
3268abe72fbSJohn Scipione /* static */
3278abe72fbSJohn Scipione const BBitmap*
MenuItemMenu()3288abe72fbSJohn Scipione MenuPrivate::MenuItemMenu()
3298abe72fbSJohn Scipione {
3308abe72fbSJohn Scipione 	return sMenuItemMenu;
3318abe72fbSJohn Scipione }
3328abe72fbSJohn Scipione 
3338abe72fbSJohn Scipione 
3347a8567e6SStefano Ceccherini }	// namespace BPrivate
335