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 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 11535384ab4SJohn Scipione MenuPrivate::SetLayout(menu_layout layout) 11635384ab4SJohn Scipione { 11735384ab4SJohn Scipione fMenu->fLayout = layout; 11835384ab4SJohn Scipione } 11935384ab4SJohn Scipione 12035384ab4SJohn Scipione 12135384ab4SJohn Scipione void 1227a8567e6SStefano Ceccherini MenuPrivate::ItemMarked(BMenuItem* item) 1237a8567e6SStefano Ceccherini { 1247a8567e6SStefano Ceccherini fMenu->_ItemMarked(item); 1257a8567e6SStefano Ceccherini } 1267a8567e6SStefano Ceccherini 1277a8567e6SStefano Ceccherini 1287a8567e6SStefano Ceccherini void 1297a8567e6SStefano Ceccherini MenuPrivate::CacheFontInfo() 1307a8567e6SStefano Ceccherini { 1317a8567e6SStefano Ceccherini fMenu->_CacheFontInfo(); 1327a8567e6SStefano Ceccherini } 1337a8567e6SStefano Ceccherini 1347a8567e6SStefano Ceccherini 1357a8567e6SStefano Ceccherini float 1367a8567e6SStefano Ceccherini MenuPrivate::FontHeight() const 1377a8567e6SStefano Ceccherini { 1387a8567e6SStefano Ceccherini return fMenu->fFontHeight; 1397a8567e6SStefano Ceccherini } 1407a8567e6SStefano Ceccherini 1417a8567e6SStefano Ceccherini 1427a8567e6SStefano Ceccherini float 1437a8567e6SStefano Ceccherini MenuPrivate::Ascent() const 1447a8567e6SStefano Ceccherini { 1457a8567e6SStefano Ceccherini return fMenu->fAscent; 1467a8567e6SStefano Ceccherini } 1477a8567e6SStefano Ceccherini 1487a8567e6SStefano Ceccherini 1497a8567e6SStefano Ceccherini BRect 1507a8567e6SStefano Ceccherini MenuPrivate::Padding() const 1517a8567e6SStefano Ceccherini { 1527a8567e6SStefano Ceccherini return fMenu->fPad; 1537a8567e6SStefano Ceccherini } 1547a8567e6SStefano Ceccherini 1557a8567e6SStefano Ceccherini 1567a8567e6SStefano Ceccherini void 157d97b4340SJohn 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 1647a8567e6SStefano Ceccherini int 1657a8567e6SStefano Ceccherini MenuPrivate::State(BMenuItem** item) const 1667a8567e6SStefano Ceccherini { 1677a8567e6SStefano Ceccherini return fMenu->_State(item); 1687a8567e6SStefano Ceccherini } 1697a8567e6SStefano Ceccherini 1707a8567e6SStefano Ceccherini 1717a8567e6SStefano Ceccherini void 1727a8567e6SStefano Ceccherini MenuPrivate::Install(BWindow* window) 1737a8567e6SStefano Ceccherini { 1747a8567e6SStefano Ceccherini fMenu->_Install(window); 1757a8567e6SStefano Ceccherini } 1767a8567e6SStefano Ceccherini 1777a8567e6SStefano Ceccherini 1787a8567e6SStefano Ceccherini void 1797a8567e6SStefano Ceccherini MenuPrivate::Uninstall() 1807a8567e6SStefano Ceccherini { 1817a8567e6SStefano Ceccherini fMenu->_Uninstall(); 1827a8567e6SStefano Ceccherini } 1837a8567e6SStefano Ceccherini 1847a8567e6SStefano Ceccherini 1857a8567e6SStefano Ceccherini void 1867a8567e6SStefano Ceccherini MenuPrivate::SetSuper(BMenu* menu) 1877a8567e6SStefano Ceccherini { 1887a8567e6SStefano Ceccherini fMenu->fSuper = menu; 1897a8567e6SStefano Ceccherini } 1907a8567e6SStefano Ceccherini 1917a8567e6SStefano Ceccherini 1927a8567e6SStefano Ceccherini void 1937a8567e6SStefano Ceccherini MenuPrivate::SetSuperItem(BMenuItem* item) 1947a8567e6SStefano Ceccherini { 1957a8567e6SStefano Ceccherini fMenu->fSuperitem = item; 1967a8567e6SStefano Ceccherini } 1977a8567e6SStefano Ceccherini 1987a8567e6SStefano Ceccherini 1997a8567e6SStefano Ceccherini void 2007a8567e6SStefano Ceccherini MenuPrivate::InvokeItem(BMenuItem* item, bool now) 2017a8567e6SStefano Ceccherini { 2027a8567e6SStefano Ceccherini fMenu->_InvokeItem(item, now); 2037a8567e6SStefano Ceccherini } 2047a8567e6SStefano Ceccherini 2057a8567e6SStefano Ceccherini 2067a8567e6SStefano Ceccherini void 2077a8567e6SStefano Ceccherini MenuPrivate::QuitTracking(bool thisMenuOnly) 2087a8567e6SStefano Ceccherini { 2097a8567e6SStefano Ceccherini fMenu->_QuitTracking(thisMenuOnly); 2107a8567e6SStefano Ceccherini } 2117a8567e6SStefano Ceccherini 2127a8567e6SStefano Ceccherini 2137a8567e6SStefano Ceccherini /* static */ 2147a8567e6SStefano Ceccherini status_t 2157a8567e6SStefano Ceccherini MenuPrivate::CreateBitmaps() 2167a8567e6SStefano Ceccherini { 217*61dfdec4SJohn Scipione BRect smallRect(0.0f, 0.0f, 16.0f, 10.0f); 2188abe72fbSJohn Scipione 219eac9c545SStefano Ceccherini try { 220*61dfdec4SJohn Scipione sMenuItemShift = new BBitmap(BRect(0.0f, 0.0f, 23.0f, 10.0f), B_CMAP8); 221*61dfdec4SJohn Scipione sMenuItemControl = new BBitmap(BRect(0.0f, 0.0f, 21.0f, 10.0f), 222*61dfdec4SJohn Scipione B_CMAP8); 223dcc8ae91SStefano Ceccherini sMenuItemOption = new BBitmap(smallRect, B_CMAP8); 2248abe72fbSJohn Scipione sMenuItemAlt = new BBitmap(smallRect, B_CMAP8); 225*61dfdec4SJohn Scipione sMenuItemMenu = new BBitmap(BRect(0.0f, 0.0f, 22.0f, 10.0f), B_CMAP8); 226eac9c545SStefano Ceccherini } catch (...) { 227eac9c545SStefano Ceccherini return B_NO_MEMORY; 228eac9c545SStefano Ceccherini } 2297a8567e6SStefano Ceccherini 2308abe72fbSJohn Scipione sMenuItemShift->ImportBits(kShiftBits, sizeof(kShiftBits), 2318abe72fbSJohn Scipione 24, 0, B_CMAP8); 232dcc8ae91SStefano Ceccherini sMenuItemControl->ImportBits(kCtrlBits, sizeof(kCtrlBits), 2338abe72fbSJohn Scipione 22, 0, B_CMAP8); 234dcc8ae91SStefano Ceccherini sMenuItemOption->ImportBits(kOptBits, sizeof(kOptBits), 2357a8567e6SStefano Ceccherini 17, 0, B_CMAP8); 2368abe72fbSJohn Scipione sMenuItemAlt->ImportBits(kAltBits, sizeof(kAltBits), 2378abe72fbSJohn Scipione 17, 0, B_CMAP8); 2388abe72fbSJohn Scipione sMenuItemMenu->ImportBits(kMenuBits, sizeof(kMenuBits), 2398abe72fbSJohn Scipione 23, 0, B_CMAP8); 2407a8567e6SStefano Ceccherini 2417a8567e6SStefano Ceccherini return B_OK; 2427a8567e6SStefano Ceccherini } 2437a8567e6SStefano Ceccherini 2447a8567e6SStefano Ceccherini 2457a8567e6SStefano Ceccherini /* static */ 2467a8567e6SStefano Ceccherini void 2477a8567e6SStefano Ceccherini MenuPrivate::DeleteBitmaps() 2487a8567e6SStefano Ceccherini { 2498abe72fbSJohn Scipione delete sMenuItemShift; 250dcc8ae91SStefano Ceccherini delete sMenuItemControl; 251dcc8ae91SStefano Ceccherini delete sMenuItemOption; 2528abe72fbSJohn Scipione delete sMenuItemAlt; 2538abe72fbSJohn Scipione delete sMenuItemMenu; 2547a8567e6SStefano Ceccherini } 2557a8567e6SStefano Ceccherini 2567a8567e6SStefano Ceccherini 2577a8567e6SStefano Ceccherini /* static */ 2587a8567e6SStefano Ceccherini const BBitmap* 2597a8567e6SStefano Ceccherini MenuPrivate::MenuItemShift() 2607a8567e6SStefano Ceccherini { 261dcc8ae91SStefano Ceccherini return sMenuItemShift; 2627a8567e6SStefano Ceccherini } 2637a8567e6SStefano Ceccherini 2647a8567e6SStefano Ceccherini 2658abe72fbSJohn Scipione /* static */ 2668abe72fbSJohn Scipione const BBitmap* 2678abe72fbSJohn Scipione MenuPrivate::MenuItemControl() 2688abe72fbSJohn Scipione { 2698abe72fbSJohn Scipione switch (BMenu::sControlKey) { 2708abe72fbSJohn Scipione case 0x5d: 2718abe72fbSJohn Scipione case 0x5f: 2728abe72fbSJohn Scipione return sMenuItemAlt; 273*61dfdec4SJohn Scipione 2748abe72fbSJohn Scipione case 0x66: 2758abe72fbSJohn Scipione case 0x67: 2768abe72fbSJohn Scipione return sMenuItemOption; 2778abe72fbSJohn Scipione } 2788abe72fbSJohn Scipione 2798abe72fbSJohn Scipione return sMenuItemControl; 2808abe72fbSJohn Scipione } 2818abe72fbSJohn Scipione 2828abe72fbSJohn Scipione 2838abe72fbSJohn Scipione /* static */ 2848abe72fbSJohn Scipione const BBitmap* 2858abe72fbSJohn Scipione MenuPrivate::MenuItemOption() 2868abe72fbSJohn Scipione { 2878abe72fbSJohn Scipione switch (BMenu::sOptionKey) { 2888abe72fbSJohn Scipione case 0x5c: 2898abe72fbSJohn Scipione case 0x60: 2908abe72fbSJohn Scipione return sMenuItemControl; 291*61dfdec4SJohn Scipione 2928abe72fbSJohn Scipione case 0x66: 2938abe72fbSJohn Scipione case 0x67: 2948abe72fbSJohn Scipione return sMenuItemOption; 2958abe72fbSJohn Scipione } 2968abe72fbSJohn Scipione 2978abe72fbSJohn Scipione return sMenuItemAlt; 2988abe72fbSJohn Scipione } 2998abe72fbSJohn Scipione 3008abe72fbSJohn Scipione 3018abe72fbSJohn Scipione /* static */ 3028abe72fbSJohn Scipione const BBitmap* 3038abe72fbSJohn Scipione MenuPrivate::MenuItemCommand() 3048abe72fbSJohn Scipione { 3058abe72fbSJohn Scipione switch (BMenu::sCommandKey) { 3068abe72fbSJohn Scipione case 0x5c: 3078abe72fbSJohn Scipione case 0x60: 3088abe72fbSJohn Scipione return sMenuItemControl; 309*61dfdec4SJohn Scipione 3108abe72fbSJohn Scipione case 0x66: 3118abe72fbSJohn Scipione case 0x67: 3128abe72fbSJohn Scipione return sMenuItemOption; 3138abe72fbSJohn Scipione } 3148abe72fbSJohn Scipione 3158abe72fbSJohn Scipione return sMenuItemAlt; 3168abe72fbSJohn Scipione } 3178abe72fbSJohn Scipione 3188abe72fbSJohn Scipione 3198abe72fbSJohn Scipione /* static */ 3208abe72fbSJohn Scipione const BBitmap* 3218abe72fbSJohn Scipione MenuPrivate::MenuItemMenu() 3228abe72fbSJohn Scipione { 3238abe72fbSJohn Scipione return sMenuItemMenu; 3248abe72fbSJohn Scipione } 3258abe72fbSJohn Scipione 3268abe72fbSJohn Scipione 3277a8567e6SStefano Ceccherini } // namespace BPrivate 328