Instead of creating the Modifiers bitmaps on demand, for every DrawItem invocation,
for every BMenuItem, have them created in _init_interface_kit(), and keep them cached. This required some reorganisation of the code in Menu and MenuItem. Also has the side effect that BMenuItem doesn't have to know about the alt/ctrl/command keys stuff. Added a comment in BMenu::AttachedToWindow(). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31962 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
e9ff085cfe
commit
c3d7cee2d9
@ -16,6 +16,7 @@ enum menu_states {
|
||||
MENU_STATE_CLOSED = 5
|
||||
};
|
||||
|
||||
class BBitmap;
|
||||
class BMenu;
|
||||
class BWindow;
|
||||
|
||||
@ -45,10 +46,22 @@ public:
|
||||
void InvokeItem(BMenuItem *item, bool now = false);
|
||||
void QuitTracking(bool thisMenuOnly = true);
|
||||
|
||||
static status_t CreateBitmaps();
|
||||
static void DeleteBitmaps();
|
||||
|
||||
static const BBitmap *MenuItemCommand();
|
||||
static const BBitmap *MenuItemControl();
|
||||
static const BBitmap *MenuItemOption();
|
||||
static const BBitmap *MenuItemShift();
|
||||
private:
|
||||
BMenu *fMenu;
|
||||
};
|
||||
|
||||
extern BBitmap *gMenuItemAlt;
|
||||
extern BBitmap *gMenuItemControl;
|
||||
extern BBitmap *gMenuItemOption;
|
||||
extern BBitmap *gMenuItemShift;
|
||||
|
||||
};
|
||||
|
||||
extern const char *kEmptyMenuLabel;
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include <DefaultColors.h>
|
||||
#include <InputServerTypes.h>
|
||||
#include <input_globals.h>
|
||||
#include <MenuPrivate.h>
|
||||
#include <pr_server.h>
|
||||
#include <ServerProtocol.h>
|
||||
#include <ServerReadOnlyMemory.h>
|
||||
@ -953,6 +954,7 @@ _init_interface_kit_()
|
||||
_init_global_fonts_();
|
||||
|
||||
BPrivate::gWidthBuffer = new BPrivate::WidthBuffer;
|
||||
BPrivate::MenuPrivate::CreateBitmaps();
|
||||
|
||||
_menu_info_ptr_ = &BMenu::sMenuInfo;
|
||||
|
||||
@ -973,6 +975,8 @@ _init_interface_kit_()
|
||||
extern "C" status_t
|
||||
_fini_interface_kit_()
|
||||
{
|
||||
BPrivate::MenuPrivate::DeleteBitmaps();
|
||||
|
||||
delete BPrivate::gWidthBuffer;
|
||||
BPrivate::gWidthBuffer = NULL;
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <Bitmap.h>
|
||||
#include <ControlLook.h>
|
||||
#include <Debug.h>
|
||||
#include <File.h>
|
||||
@ -76,6 +77,11 @@ public:
|
||||
};
|
||||
|
||||
|
||||
BBitmap *gMenuItemAlt;
|
||||
BBitmap *gMenuItemControl;
|
||||
BBitmap *gMenuItemOption;
|
||||
BBitmap *gMenuItemShift;
|
||||
|
||||
} // namespace BPrivate
|
||||
|
||||
|
||||
@ -83,6 +89,66 @@ menu_info BMenu::sMenuInfo;
|
||||
bool BMenu::sAltAsCommandKey;
|
||||
|
||||
|
||||
const unsigned char kCtrlBits[] = {
|
||||
0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x14,
|
||||
0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x13,0x04,0x04,0x13,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x04,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x04,0x1a,0x1a,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x04,0x1a,0x1a,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x13,0x04,0x04,0x13,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x04,0x04,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x14,
|
||||
0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14
|
||||
};
|
||||
|
||||
|
||||
const unsigned char kAltBits[] = {
|
||||
0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x14,
|
||||
0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x1a,0x13,0x04,0x04,0x13,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x04,0x04,0x04,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x1a,0x04,0x04,0x04,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x04,0x04,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x14,
|
||||
0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14
|
||||
};
|
||||
|
||||
|
||||
const unsigned char kOptBits[] = {
|
||||
0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x14,
|
||||
0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x1a,0x13,0x04,0x04,0x13,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x04,0x1a,0x04,0x04,0x04,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x04,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x1a,0x13,0x04,0x04,0x13,0x1a,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x14,
|
||||
0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14
|
||||
};
|
||||
|
||||
|
||||
const unsigned char kShiftBits[] = {
|
||||
0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x14,
|
||||
0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x1a,0x17,0x04,0x04,0x17,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x1a,0x04,0x17,0x17,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x04,0x04,0x1a,0x04,0x04,0x04,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x1a,0x17,0x04,0x04,0x17,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x04,0x1a,0x04,0x04,0x04,0x1a,0x04,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x1a,0x04,0x17,0x17,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x1a,0x17,0x04,0x04,0x17,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x14,
|
||||
0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14
|
||||
};
|
||||
|
||||
|
||||
static property_info sPropList[] = {
|
||||
{ "Enabled", { B_GET_PROPERTY, 0 },
|
||||
{ B_DIRECT_SPECIFIER, 0 }, "Returns true if menu or menu item is enabled; false "
|
||||
@ -348,13 +414,17 @@ BMenu::AttachedToWindow()
|
||||
{
|
||||
BView::AttachedToWindow();
|
||||
|
||||
sAltAsCommandKey = true;
|
||||
// TODO: Move into init_interface_kit().
|
||||
// Currently we can't do that, as get_key_map() blocks forever
|
||||
// when called there. Probably because the BApplication isn't yet
|
||||
// initialized, or running.
|
||||
BMenu::sAltAsCommandKey = true;
|
||||
key_map *keys = NULL;
|
||||
char *chars = NULL;
|
||||
get_key_map(&keys, &chars);
|
||||
if (keys == NULL || keys->left_command_key != 0x5d
|
||||
|| keys->left_control_key != 0x5c)
|
||||
sAltAsCommandKey = false;
|
||||
BMenu::sAltAsCommandKey = false;
|
||||
free(chars);
|
||||
free(keys);
|
||||
|
||||
@ -2256,12 +2326,14 @@ BMenu::_CalcFrame(BPoint where, bool *scrollOn)
|
||||
void
|
||||
BMenu::_DrawItems(BRect updateRect)
|
||||
{
|
||||
bigtime_t start = system_time();
|
||||
int32 itemCount = fItems.CountItems();
|
||||
for (int32 i = 0; i < itemCount; i++) {
|
||||
BMenuItem *item = ItemAt(i);
|
||||
if (item->Frame().Intersects(updateRect))
|
||||
item->Draw();
|
||||
}
|
||||
printf("BMenu::_DrawItems() took %lld usecs\n", system_time() - start);
|
||||
}
|
||||
|
||||
|
||||
@ -2879,4 +2951,79 @@ MenuPrivate::QuitTracking(bool thisMenuOnly)
|
||||
fMenu->_QuitTracking(thisMenuOnly);
|
||||
}
|
||||
|
||||
|
||||
/* static */
|
||||
status_t
|
||||
MenuPrivate::CreateBitmaps()
|
||||
{
|
||||
BRect smallRect(0, 0, 16, 10);
|
||||
BRect largeRect(0, 0, 21, 10);
|
||||
|
||||
gMenuItemAlt = new BBitmap(smallRect, B_CMAP8);
|
||||
gMenuItemControl = new BBitmap(smallRect, B_CMAP8);
|
||||
gMenuItemOption = new BBitmap(smallRect, B_CMAP8);
|
||||
gMenuItemShift = new BBitmap(largeRect, B_CMAP8);
|
||||
|
||||
gMenuItemAlt->ImportBits(kAltBits, sizeof(kAltBits),
|
||||
17, 0, B_CMAP8);
|
||||
gMenuItemControl->ImportBits(kCtrlBits, sizeof(kCtrlBits),
|
||||
17, 0, B_CMAP8);
|
||||
gMenuItemOption->ImportBits(kOptBits, sizeof(kOptBits),
|
||||
17, 0, B_CMAP8);
|
||||
gMenuItemShift->ImportBits(kShiftBits, sizeof(kShiftBits),
|
||||
22, 0, B_CMAP8);
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
/* static */
|
||||
void
|
||||
MenuPrivate::DeleteBitmaps()
|
||||
{
|
||||
delete gMenuItemAlt;
|
||||
delete gMenuItemControl;
|
||||
delete gMenuItemOption;
|
||||
delete gMenuItemShift;
|
||||
}
|
||||
|
||||
|
||||
/* static */
|
||||
const BBitmap *
|
||||
MenuPrivate::MenuItemCommand()
|
||||
{
|
||||
if (BMenu::sAltAsCommandKey)
|
||||
return gMenuItemAlt;
|
||||
|
||||
return gMenuItemControl;
|
||||
}
|
||||
|
||||
|
||||
/* static */
|
||||
const BBitmap *
|
||||
MenuPrivate::MenuItemControl()
|
||||
{
|
||||
if (BMenu::sAltAsCommandKey)
|
||||
return gMenuItemControl;
|
||||
|
||||
return gMenuItemAlt;
|
||||
}
|
||||
|
||||
|
||||
/* static */
|
||||
const BBitmap *
|
||||
MenuPrivate::MenuItemOption()
|
||||
{
|
||||
return gMenuItemOption;
|
||||
}
|
||||
|
||||
|
||||
/* static */
|
||||
const BBitmap *
|
||||
MenuPrivate::MenuItemShift()
|
||||
{
|
||||
return gMenuItemShift;
|
||||
}
|
||||
|
||||
|
||||
} // namespace BPrivate
|
||||
|
@ -26,64 +26,6 @@
|
||||
|
||||
#include "utf8_functions.h"
|
||||
|
||||
const unsigned char kCtrlBits[] = {
|
||||
0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x14,
|
||||
0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x13,0x04,0x04,0x13,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x04,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x04,0x1a,0x1a,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x04,0x1a,0x1a,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x13,0x04,0x04,0x13,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x04,0x04,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x14,
|
||||
0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14
|
||||
};
|
||||
|
||||
|
||||
const unsigned char kAltBits[] = {
|
||||
0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x14,
|
||||
0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x1a,0x13,0x04,0x04,0x13,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x04,0x04,0x04,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x1a,0x04,0x04,0x04,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x04,0x04,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x14,
|
||||
0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14
|
||||
};
|
||||
|
||||
|
||||
const unsigned char kOptBits[] = {
|
||||
0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x14,
|
||||
0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x1a,0x13,0x04,0x04,0x13,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x04,0x1a,0x04,0x04,0x04,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x04,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x1a,0x13,0x04,0x04,0x13,0x1a,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x14,
|
||||
0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14
|
||||
};
|
||||
|
||||
|
||||
const unsigned char kShiftBits[] = {
|
||||
0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x14,
|
||||
0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x1a,0x17,0x04,0x04,0x17,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x1a,0x04,0x17,0x17,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x04,0x04,0x1a,0x04,0x04,0x04,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x1a,0x17,0x04,0x04,0x17,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x04,0x1a,0x04,0x04,0x04,0x1a,0x04,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x1a,0x04,0x17,0x17,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x1a,0x17,0x04,0x04,0x17,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
||||
0x1d,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x14,
|
||||
0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14
|
||||
};
|
||||
|
||||
const float kLightBGTint = (B_LIGHTEN_1_TINT + B_LIGHTEN_1_TINT + B_NO_TINT) / 3.0;
|
||||
|
||||
@ -790,46 +732,32 @@ BMenuItem::_DrawShortcutSymbol()
|
||||
where.y += (fBounds.Height() - 11) / 2 - 1;
|
||||
where.x -= 4;
|
||||
|
||||
const bool altCommandKey = MenuPrivate(fSuper).IsAltCommandKey();
|
||||
if (fModifiers & B_COMMAND_KEY) {
|
||||
BRect rect(0,0,16,10);
|
||||
BBitmap control(rect, B_CMAP8);
|
||||
|
||||
if (altCommandKey)
|
||||
control.ImportBits(kAltBits, sizeof(kAltBits), 17, 0, B_CMAP8);
|
||||
else
|
||||
control.ImportBits(kCtrlBits, sizeof(kCtrlBits), 17, 0, B_CMAP8);
|
||||
|
||||
const BBitmap *command = MenuPrivate::MenuItemCommand();
|
||||
const BRect &rect = command->Bounds();
|
||||
where.x -= rect.Width() + 1;
|
||||
fSuper->DrawBitmap(&control, where);
|
||||
fSuper->DrawBitmap(command, where);
|
||||
}
|
||||
|
||||
if (fModifiers & B_CONTROL_KEY) {
|
||||
BRect rect(0,0,16,10);
|
||||
BBitmap control(rect, B_CMAP8);
|
||||
|
||||
if (altCommandKey)
|
||||
control.ImportBits(kCtrlBits, sizeof(kCtrlBits), 17, 0, B_CMAP8);
|
||||
else
|
||||
control.ImportBits(kAltBits, sizeof(kAltBits), 17, 0, B_CMAP8);
|
||||
const BBitmap *control = MenuPrivate::MenuItemControl();
|
||||
const BRect &rect = control->Bounds();
|
||||
where.x -= rect.Width() + 1;
|
||||
fSuper->DrawBitmap(&control, where);
|
||||
fSuper->DrawBitmap(control, where);
|
||||
}
|
||||
|
||||
if (fModifiers & B_OPTION_KEY) {
|
||||
BRect rect(0,0,16,10);
|
||||
BBitmap option(rect, B_CMAP8);
|
||||
option.ImportBits(kOptBits, sizeof(kOptBits), 17, 0, B_CMAP8);
|
||||
const BBitmap *option = MenuPrivate::MenuItemOption();
|
||||
const BRect &rect = option->Bounds();
|
||||
where.x -= rect.Width() + 1;
|
||||
fSuper->DrawBitmap(&option, where);
|
||||
fSuper->DrawBitmap(option, where);
|
||||
}
|
||||
|
||||
if (fModifiers & B_SHIFT_KEY) {
|
||||
BRect rect(0,0,21,10);
|
||||
BBitmap shift(rect, B_CMAP8);
|
||||
shift.ImportBits(kShiftBits, sizeof(kShiftBits), 22, 0, B_CMAP8);
|
||||
const BBitmap *shift = MenuPrivate::MenuItemOption();
|
||||
const BRect &rect = shift->Bounds();
|
||||
where.x -= rect.Width() + 1;
|
||||
fSuper->DrawBitmap(&shift, where);
|
||||
fSuper->DrawBitmap(shift, where);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user