xref: /haiku/src/kits/interface/MenuPrivate.cpp (revision 8abe72fb66b36e98eedc463c85cf752651280386)
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 
14*8abe72fbSJohn Scipione 
15*8abe72fbSJohn Scipione const unsigned char kShiftBits[] = {
16*8abe72fbSJohn 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,
17*8abe72fbSJohn 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,
18*8abe72fbSJohn 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,
19*8abe72fbSJohn 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,
20*8abe72fbSJohn 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,
21*8abe72fbSJohn 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,
22*8abe72fbSJohn 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,
23*8abe72fbSJohn 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,
24*8abe72fbSJohn 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,
25*8abe72fbSJohn 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,
26*8abe72fbSJohn 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
27*8abe72fbSJohn Scipione };
28*8abe72fbSJohn Scipione 
29*8abe72fbSJohn Scipione 
307a8567e6SStefano Ceccherini const unsigned char kCtrlBits[] = {
31*8abe72fbSJohn Scipione 	0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x14,
32*8abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
33*8abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x13,0x04,0x04,0x13,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
34*8abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x04,0x04,0x1a,0x04,0x04,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x17,0x14,
35*8abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x17,0x14,
36*8abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x04,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x17,0x14,
37*8abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x04,0x1a,0x1a,0x04,0x1a,0x1a,0x1a,0x17,0x14,
38*8abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x13,0x04,0x04,0x13,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x13,0x04,0x1a,0x04,0x04,0x04,0x1a,0x17,0x14,
39*8abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
40*8abe72fbSJohn Scipione 	0x1d,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x14,
41*8abe72fbSJohn Scipione 	0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14
42*8abe72fbSJohn Scipione };
43*8abe72fbSJohn Scipione 
44*8abe72fbSJohn Scipione 
45*8abe72fbSJohn 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,
48*8abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x13,0x04,0x04,0x13,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
49*8abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x04,0x1a,0x04,0x04,0x04,0x1a,0x17,0x14,
50*8abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x17,0x14,
51*8abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x04,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
52*8abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
53*8abe72fbSJohn 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 
75*8abe72fbSJohn Scipione const unsigned char kMenuBits[] = {
76*8abe72fbSJohn Scipione 	0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x14,
77*8abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
78*8abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x04,0x04,0x1a,0x04,0x04,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
79*8abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x04,0x04,0x04,0x04,0x04,0x1a,0x04,0x04,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x17,0x14,
80*8abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x04,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x17,0x14,
81*8abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x04,0x04,0x1a,0x04,0x04,0x04,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x17,0x14,
82*8abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x17,0x14,
83*8abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x04,0x04,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x04,0x04,0x1a,0x17,0x14,
84*8abe72fbSJohn Scipione 	0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
85*8abe72fbSJohn Scipione 	0x1d,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x14,
86*8abe72fbSJohn 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 
93*8abe72fbSJohn Scipione BBitmap* MenuPrivate::sMenuItemShift;
94dcc8ae91SStefano Ceccherini BBitmap* MenuPrivate::sMenuItemControl;
95dcc8ae91SStefano Ceccherini BBitmap* MenuPrivate::sMenuItemOption;
96*8abe72fbSJohn Scipione BBitmap* MenuPrivate::sMenuItemAlt;
97*8abe72fbSJohn Scipione BBitmap* MenuPrivate::sMenuItemMenu;
98dcc8ae91SStefano Ceccherini 
997a8567e6SStefano Ceccherini 
1007a8567e6SStefano Ceccherini MenuPrivate::MenuPrivate(BMenu *menu)
1017a8567e6SStefano Ceccherini 	:
1027a8567e6SStefano Ceccherini 	fMenu(menu)
1037a8567e6SStefano Ceccherini {
1047a8567e6SStefano Ceccherini }
1057a8567e6SStefano Ceccherini 
1067a8567e6SStefano Ceccherini 
1077a8567e6SStefano Ceccherini menu_layout
1087a8567e6SStefano Ceccherini MenuPrivate::Layout() const
1097a8567e6SStefano Ceccherini {
1107a8567e6SStefano Ceccherini 	return fMenu->Layout();
1117a8567e6SStefano Ceccherini }
1127a8567e6SStefano Ceccherini 
1137a8567e6SStefano Ceccherini 
1147a8567e6SStefano Ceccherini void
1157a8567e6SStefano Ceccherini MenuPrivate::ItemMarked(BMenuItem *item)
1167a8567e6SStefano Ceccherini {
1177a8567e6SStefano Ceccherini 	fMenu->_ItemMarked(item);
1187a8567e6SStefano Ceccherini }
1197a8567e6SStefano Ceccherini 
1207a8567e6SStefano Ceccherini 
1217a8567e6SStefano Ceccherini void
1227a8567e6SStefano Ceccherini MenuPrivate::CacheFontInfo()
1237a8567e6SStefano Ceccherini {
1247a8567e6SStefano Ceccherini 	fMenu->_CacheFontInfo();
1257a8567e6SStefano Ceccherini }
1267a8567e6SStefano Ceccherini 
1277a8567e6SStefano Ceccherini 
1287a8567e6SStefano Ceccherini float
1297a8567e6SStefano Ceccherini MenuPrivate::FontHeight() const
1307a8567e6SStefano Ceccherini {
1317a8567e6SStefano Ceccherini 	return fMenu->fFontHeight;
1327a8567e6SStefano Ceccherini }
1337a8567e6SStefano Ceccherini 
1347a8567e6SStefano Ceccherini 
1357a8567e6SStefano Ceccherini float
1367a8567e6SStefano Ceccherini MenuPrivate::Ascent() const
1377a8567e6SStefano Ceccherini {
1387a8567e6SStefano Ceccherini 	return fMenu->fAscent;
1397a8567e6SStefano Ceccherini }
1407a8567e6SStefano Ceccherini 
1417a8567e6SStefano Ceccherini 
1427a8567e6SStefano Ceccherini BRect
1437a8567e6SStefano Ceccherini MenuPrivate::Padding() const
1447a8567e6SStefano Ceccherini {
1457a8567e6SStefano Ceccherini 	return fMenu->fPad;
1467a8567e6SStefano Ceccherini }
1477a8567e6SStefano Ceccherini 
1487a8567e6SStefano Ceccherini 
1497a8567e6SStefano Ceccherini void
1507a8567e6SStefano Ceccherini MenuPrivate::GetItemMargins(float *left, float *top,
1517a8567e6SStefano Ceccherini 					float *right, float *bottom) const
1527a8567e6SStefano Ceccherini {
1537a8567e6SStefano Ceccherini 	fMenu->GetItemMargins(left, top, right, bottom);
1547a8567e6SStefano Ceccherini }
1557a8567e6SStefano Ceccherini 
1567a8567e6SStefano Ceccherini 
1577a8567e6SStefano Ceccherini int
1587a8567e6SStefano Ceccherini MenuPrivate::State(BMenuItem **item) const
1597a8567e6SStefano Ceccherini {
1607a8567e6SStefano Ceccherini 	return fMenu->_State(item);
1617a8567e6SStefano Ceccherini }
1627a8567e6SStefano Ceccherini 
1637a8567e6SStefano Ceccherini 
1647a8567e6SStefano Ceccherini void
1657a8567e6SStefano Ceccherini MenuPrivate::Install(BWindow *window)
1667a8567e6SStefano Ceccherini {
1677a8567e6SStefano Ceccherini 	fMenu->_Install(window);
1687a8567e6SStefano Ceccherini }
1697a8567e6SStefano Ceccherini 
1707a8567e6SStefano Ceccherini 
1717a8567e6SStefano Ceccherini void
1727a8567e6SStefano Ceccherini MenuPrivate::Uninstall()
1737a8567e6SStefano Ceccherini {
1747a8567e6SStefano Ceccherini 	fMenu->_Uninstall();
1757a8567e6SStefano Ceccherini }
1767a8567e6SStefano Ceccherini 
1777a8567e6SStefano Ceccherini 
1787a8567e6SStefano Ceccherini void
1797a8567e6SStefano Ceccherini MenuPrivate::SetSuper(BMenu *menu)
1807a8567e6SStefano Ceccherini {
1817a8567e6SStefano Ceccherini 	fMenu->fSuper = menu;
1827a8567e6SStefano Ceccherini }
1837a8567e6SStefano Ceccherini 
1847a8567e6SStefano Ceccherini 
1857a8567e6SStefano Ceccherini void
1867a8567e6SStefano Ceccherini MenuPrivate::SetSuperItem(BMenuItem *item)
1877a8567e6SStefano Ceccherini {
1887a8567e6SStefano Ceccherini 	fMenu->fSuperitem = item;
1897a8567e6SStefano Ceccherini }
1907a8567e6SStefano Ceccherini 
1917a8567e6SStefano Ceccherini 
1927a8567e6SStefano Ceccherini void
1937a8567e6SStefano Ceccherini MenuPrivate::InvokeItem(BMenuItem *item, bool now)
1947a8567e6SStefano Ceccherini {
1957a8567e6SStefano Ceccherini 	fMenu->_InvokeItem(item, now);
1967a8567e6SStefano Ceccherini }
1977a8567e6SStefano Ceccherini 
1987a8567e6SStefano Ceccherini 
1997a8567e6SStefano Ceccherini void
2007a8567e6SStefano Ceccherini MenuPrivate::QuitTracking(bool thisMenuOnly)
2017a8567e6SStefano Ceccherini {
2027a8567e6SStefano Ceccherini 	fMenu->_QuitTracking(thisMenuOnly);
2037a8567e6SStefano Ceccherini }
2047a8567e6SStefano Ceccherini 
2057a8567e6SStefano Ceccherini 
2067a8567e6SStefano Ceccherini /* static */
2077a8567e6SStefano Ceccherini status_t
2087a8567e6SStefano Ceccherini MenuPrivate::CreateBitmaps()
2097a8567e6SStefano Ceccherini {
2107a8567e6SStefano Ceccherini 	BRect smallRect(0, 0, 16, 10);
211*8abe72fbSJohn Scipione 
212eac9c545SStefano Ceccherini 	try {
213*8abe72fbSJohn Scipione 		sMenuItemShift = new BBitmap(BRect(0, 0, 23, 10), B_CMAP8);
214*8abe72fbSJohn Scipione 		sMenuItemControl = new BBitmap(BRect(0, 0, 21, 10), B_CMAP8);
215dcc8ae91SStefano Ceccherini 		sMenuItemOption = new BBitmap(smallRect, B_CMAP8);
216*8abe72fbSJohn Scipione 		sMenuItemAlt = new BBitmap(smallRect, B_CMAP8);
217*8abe72fbSJohn Scipione 		sMenuItemMenu = new BBitmap(BRect(0, 0, 22, 10), B_CMAP8);
218eac9c545SStefano Ceccherini 	} catch (...) {
219eac9c545SStefano Ceccherini 		return B_NO_MEMORY;
220eac9c545SStefano Ceccherini 	}
2217a8567e6SStefano Ceccherini 
222*8abe72fbSJohn Scipione 	sMenuItemShift->ImportBits(kShiftBits, sizeof(kShiftBits),
223*8abe72fbSJohn Scipione 		24, 0, B_CMAP8);
224dcc8ae91SStefano Ceccherini 	sMenuItemControl->ImportBits(kCtrlBits, sizeof(kCtrlBits),
225*8abe72fbSJohn Scipione 		22, 0, B_CMAP8);
226dcc8ae91SStefano Ceccherini 	sMenuItemOption->ImportBits(kOptBits, sizeof(kOptBits),
2277a8567e6SStefano Ceccherini 		17, 0, B_CMAP8);
228*8abe72fbSJohn Scipione 	sMenuItemAlt->ImportBits(kAltBits, sizeof(kAltBits),
229*8abe72fbSJohn Scipione 		17, 0, B_CMAP8);
230*8abe72fbSJohn Scipione 	sMenuItemMenu->ImportBits(kMenuBits, sizeof(kMenuBits),
231*8abe72fbSJohn Scipione 		23, 0, B_CMAP8);
2327a8567e6SStefano Ceccherini 
2337a8567e6SStefano Ceccherini 	return B_OK;
2347a8567e6SStefano Ceccherini }
2357a8567e6SStefano Ceccherini 
2367a8567e6SStefano Ceccherini 
2377a8567e6SStefano Ceccherini /* static */
2387a8567e6SStefano Ceccherini void
2397a8567e6SStefano Ceccherini MenuPrivate::DeleteBitmaps()
2407a8567e6SStefano Ceccherini {
241*8abe72fbSJohn Scipione 	delete sMenuItemShift;
242dcc8ae91SStefano Ceccherini 	delete sMenuItemControl;
243dcc8ae91SStefano Ceccherini 	delete sMenuItemOption;
244*8abe72fbSJohn Scipione 	delete sMenuItemAlt;
245*8abe72fbSJohn Scipione 	delete sMenuItemMenu;
2467a8567e6SStefano Ceccherini }
2477a8567e6SStefano Ceccherini 
2487a8567e6SStefano Ceccherini 
2497a8567e6SStefano Ceccherini /* static */
2507a8567e6SStefano Ceccherini const BBitmap*
2517a8567e6SStefano Ceccherini MenuPrivate::MenuItemShift()
2527a8567e6SStefano Ceccherini {
253dcc8ae91SStefano Ceccherini 	return sMenuItemShift;
2547a8567e6SStefano Ceccherini }
2557a8567e6SStefano Ceccherini 
2567a8567e6SStefano Ceccherini 
257*8abe72fbSJohn Scipione /* static */
258*8abe72fbSJohn Scipione const BBitmap*
259*8abe72fbSJohn Scipione MenuPrivate::MenuItemControl()
260*8abe72fbSJohn Scipione {
261*8abe72fbSJohn Scipione 	switch (BMenu::sControlKey) {
262*8abe72fbSJohn Scipione 		case 0x5d:
263*8abe72fbSJohn Scipione 		case 0x5f:
264*8abe72fbSJohn Scipione 			return sMenuItemAlt;
265*8abe72fbSJohn Scipione 		case 0x66:
266*8abe72fbSJohn Scipione 		case 0x67:
267*8abe72fbSJohn Scipione 			return sMenuItemOption;
268*8abe72fbSJohn Scipione 	}
269*8abe72fbSJohn Scipione 
270*8abe72fbSJohn Scipione 	return sMenuItemControl;
271*8abe72fbSJohn Scipione }
272*8abe72fbSJohn Scipione 
273*8abe72fbSJohn Scipione 
274*8abe72fbSJohn Scipione /* static */
275*8abe72fbSJohn Scipione const BBitmap*
276*8abe72fbSJohn Scipione MenuPrivate::MenuItemOption()
277*8abe72fbSJohn Scipione {
278*8abe72fbSJohn Scipione 	switch (BMenu::sOptionKey) {
279*8abe72fbSJohn Scipione 		case 0x5c:
280*8abe72fbSJohn Scipione 		case 0x60:
281*8abe72fbSJohn Scipione 			return sMenuItemControl;
282*8abe72fbSJohn Scipione 		case 0x66:
283*8abe72fbSJohn Scipione 		case 0x67:
284*8abe72fbSJohn Scipione 			return sMenuItemOption;
285*8abe72fbSJohn Scipione 	}
286*8abe72fbSJohn Scipione 
287*8abe72fbSJohn Scipione 	return sMenuItemAlt;
288*8abe72fbSJohn Scipione }
289*8abe72fbSJohn Scipione 
290*8abe72fbSJohn Scipione 
291*8abe72fbSJohn Scipione /* static */
292*8abe72fbSJohn Scipione const BBitmap*
293*8abe72fbSJohn Scipione MenuPrivate::MenuItemCommand()
294*8abe72fbSJohn Scipione {
295*8abe72fbSJohn Scipione 	switch (BMenu::sCommandKey) {
296*8abe72fbSJohn Scipione 		case 0x5c:
297*8abe72fbSJohn Scipione 		case 0x60:
298*8abe72fbSJohn Scipione 			return sMenuItemControl;
299*8abe72fbSJohn Scipione 		case 0x66:
300*8abe72fbSJohn Scipione 		case 0x67:
301*8abe72fbSJohn Scipione 			return sMenuItemOption;
302*8abe72fbSJohn Scipione 	}
303*8abe72fbSJohn Scipione 
304*8abe72fbSJohn Scipione 	return sMenuItemAlt;
305*8abe72fbSJohn Scipione }
306*8abe72fbSJohn Scipione 
307*8abe72fbSJohn Scipione 
308*8abe72fbSJohn Scipione /* static */
309*8abe72fbSJohn Scipione const BBitmap*
310*8abe72fbSJohn Scipione MenuPrivate::MenuItemMenu()
311*8abe72fbSJohn Scipione {
312*8abe72fbSJohn Scipione 	return sMenuItemMenu;
313*8abe72fbSJohn Scipione }
314*8abe72fbSJohn Scipione 
315*8abe72fbSJohn Scipione 
3167a8567e6SStefano Ceccherini }	// namespace BPrivate
317