Changes the menu key bitmap from CTL to CTRL and SHFT to SHIFT.
This is coming from but does not close #7967 Adds a new (currently unused) Menu key bitmap. Instead of having a single AltAsCommandKey() method the menus now show the correct bitmap when you switch between your control, windows/option, and alt/command keys. This is really not flushed out yet since it only works when you switch those keys and not other combinations like say switching the control and caps lock keys but it is a step in the right direction. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43205 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -243,7 +243,14 @@ private:
|
|||||||
void _SetIgnoreHidden(bool on);
|
void _SetIgnoreHidden(bool on);
|
||||||
void _SetStickyMode(bool on);
|
void _SetStickyMode(bool on);
|
||||||
bool _IsStickyMode() const;
|
bool _IsStickyMode() const;
|
||||||
void _GetIsAltCommandKey(bool &value) const;
|
|
||||||
|
// Methods to get the current modifier keycode
|
||||||
|
void _GetShiftKey(uint32 &value) const;
|
||||||
|
void _GetControlKey(uint32 &value) const;
|
||||||
|
void _GetCommandKey(uint32 &value) const;
|
||||||
|
void _GetOptionKey(uint32 &value) const;
|
||||||
|
void _GetMenuKey(uint32 &value) const;
|
||||||
|
|
||||||
void _CalcTriggers();
|
void _CalcTriggers();
|
||||||
bool _ChooseTrigger(const char* title, int32& index,
|
bool _ChooseTrigger(const char* title, int32& index,
|
||||||
uint32& trigger,
|
uint32& trigger,
|
||||||
@@ -260,7 +267,14 @@ private:
|
|||||||
void _QuitTracking(bool onlyThis = true);
|
void _QuitTracking(bool onlyThis = true);
|
||||||
|
|
||||||
static menu_info sMenuInfo;
|
static menu_info sMenuInfo;
|
||||||
static bool sAltAsCommandKey;
|
|
||||||
|
// Variables to keep track of what code is currently assigned to
|
||||||
|
// each modifier key
|
||||||
|
static uint32 sShiftKey;
|
||||||
|
static uint32 sControlKey;
|
||||||
|
static uint32 sOptionKey;
|
||||||
|
static uint32 sCommandKey;
|
||||||
|
static uint32 sMenuKey;
|
||||||
|
|
||||||
BMenuItem* fChosenItem;
|
BMenuItem* fChosenItem;
|
||||||
BList fItems;
|
BList fItems;
|
||||||
|
|||||||
@@ -42,8 +42,6 @@ public:
|
|||||||
BRect Padding() const;
|
BRect Padding() const;
|
||||||
void GetItemMargins(float *, float *, float *, float *) const;
|
void GetItemMargins(float *, float *, float *, float *) const;
|
||||||
|
|
||||||
static bool IsAltCommandKey();
|
|
||||||
|
|
||||||
int State(BMenuItem **item = NULL) const;
|
int State(BMenuItem **item = NULL) const;
|
||||||
|
|
||||||
void Install(BWindow *window);
|
void Install(BWindow *window);
|
||||||
@@ -56,17 +54,19 @@ public:
|
|||||||
static status_t CreateBitmaps();
|
static status_t CreateBitmaps();
|
||||||
static void DeleteBitmaps();
|
static void DeleteBitmaps();
|
||||||
|
|
||||||
static const BBitmap *MenuItemCommand();
|
static const BBitmap *MenuItemShift();
|
||||||
static const BBitmap *MenuItemControl();
|
static const BBitmap *MenuItemControl();
|
||||||
static const BBitmap *MenuItemOption();
|
static const BBitmap *MenuItemOption();
|
||||||
static const BBitmap *MenuItemShift();
|
static const BBitmap *MenuItemCommand();
|
||||||
|
static const BBitmap *MenuItemMenu();
|
||||||
private:
|
private:
|
||||||
BMenu *fMenu;
|
BMenu *fMenu;
|
||||||
|
|
||||||
static BBitmap *sMenuItemAlt;
|
static BBitmap *sMenuItemShift;
|
||||||
static BBitmap *sMenuItemControl;
|
static BBitmap *sMenuItemControl;
|
||||||
static BBitmap *sMenuItemOption;
|
static BBitmap *sMenuItemOption;
|
||||||
static BBitmap *sMenuItemShift;
|
static BBitmap *sMenuItemAlt;
|
||||||
|
static BBitmap *sMenuItemMenu;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+69
-14
@@ -96,8 +96,12 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
menu_info BMenu::sMenuInfo;
|
menu_info BMenu::sMenuInfo;
|
||||||
bool BMenu::sAltAsCommandKey;
|
|
||||||
|
|
||||||
|
uint32 BMenu::sShiftKey;
|
||||||
|
uint32 BMenu::sControlKey;
|
||||||
|
uint32 BMenu::sOptionKey;
|
||||||
|
uint32 BMenu::sCommandKey;
|
||||||
|
uint32 BMenu::sMenuKey;
|
||||||
|
|
||||||
static property_info sPropList[] = {
|
static property_info sPropList[] = {
|
||||||
{ "Enabled", { B_GET_PROPERTY, 0 },
|
{ "Enabled", { B_GET_PROPERTY, 0 },
|
||||||
@@ -381,7 +385,11 @@ BMenu::AttachedToWindow()
|
|||||||
{
|
{
|
||||||
BView::AttachedToWindow();
|
BView::AttachedToWindow();
|
||||||
|
|
||||||
_GetIsAltCommandKey(sAltAsCommandKey);
|
_GetShiftKey(sShiftKey);
|
||||||
|
_GetControlKey(sControlKey);
|
||||||
|
_GetCommandKey(sCommandKey);
|
||||||
|
_GetOptionKey(sOptionKey);
|
||||||
|
_GetMenuKey(sMenuKey);
|
||||||
|
|
||||||
fAttachAborted = _AddDynamicItems();
|
fAttachAborted = _AddDynamicItems();
|
||||||
|
|
||||||
@@ -2678,25 +2686,72 @@ BMenu::_IsStickyMode() const
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BMenu::_GetIsAltCommandKey(bool &value) const
|
BMenu::_GetShiftKey(uint32 &value) const
|
||||||
{
|
{
|
||||||
// TODO: Move into init_interface_kit().
|
// TODO: Move into init_interface_kit().
|
||||||
// Currently we can't do that, as get_key_map() blocks forever
|
// Currently we can't do that, as get_modifier_key() blocks forever
|
||||||
// when called on input_server initialization, since it tries
|
// when called on input_server initialization, since it tries
|
||||||
// to send a synchronous message to itself (input_server is
|
// to send a synchronous message to itself (input_server is
|
||||||
// a BApplication)
|
// a BApplication)
|
||||||
|
|
||||||
bool altAsCommand = true;
|
if (get_modifier_key(B_LEFT_SHIFT_KEY, &value) != B_OK)
|
||||||
key_map* keys = NULL;
|
value = 0x4b;
|
||||||
char* chars = NULL;
|
}
|
||||||
get_key_map(&keys, &chars);
|
|
||||||
if (keys == NULL || keys->left_command_key != 0x5d
|
|
||||||
|| keys->left_control_key != 0x5c)
|
|
||||||
altAsCommand = false;
|
|
||||||
free(chars);
|
|
||||||
free(keys);
|
|
||||||
|
|
||||||
value = altAsCommand;
|
|
||||||
|
void
|
||||||
|
BMenu::_GetControlKey(uint32 &value) const
|
||||||
|
{
|
||||||
|
// TODO: Move into init_interface_kit().
|
||||||
|
// Currently we can't do that, as get_modifier_key() blocks forever
|
||||||
|
// when called on input_server initialization, since it tries
|
||||||
|
// to send a synchronous message to itself (input_server is
|
||||||
|
// a BApplication)
|
||||||
|
|
||||||
|
if (get_modifier_key(B_LEFT_CONTROL_KEY, &value) != B_OK)
|
||||||
|
value = 0x5c;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BMenu::_GetCommandKey(uint32 &value) const
|
||||||
|
{
|
||||||
|
// TODO: Move into init_interface_kit().
|
||||||
|
// Currently we can't do that, as get_modifier_key() blocks forever
|
||||||
|
// when called on input_server initialization, since it tries
|
||||||
|
// to send a synchronous message to itself (input_server is
|
||||||
|
// a BApplication)
|
||||||
|
|
||||||
|
if (get_modifier_key(B_LEFT_COMMAND_KEY, &value) != B_OK)
|
||||||
|
value = 0x66;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BMenu::_GetOptionKey(uint32 &value) const
|
||||||
|
{
|
||||||
|
// TODO: Move into init_interface_kit().
|
||||||
|
// Currently we can't do that, as get_modifier_key() blocks forever
|
||||||
|
// when called on input_server initialization, since it tries
|
||||||
|
// to send a synchronous message to itself (input_server is
|
||||||
|
// a BApplication)
|
||||||
|
|
||||||
|
if (get_modifier_key(B_LEFT_OPTION_KEY, &value) != B_OK)
|
||||||
|
value = 0x5d;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BMenu::_GetMenuKey(uint32 &value) const
|
||||||
|
{
|
||||||
|
// TODO: Move into init_interface_kit().
|
||||||
|
// Currently we can't do that, as get_modifier_key() blocks forever
|
||||||
|
// when called on input_server initialization, since it tries
|
||||||
|
// to send a synchronous message to itself (input_server is
|
||||||
|
// a BApplication)
|
||||||
|
|
||||||
|
if (get_modifier_key(B_MENU_KEY, &value) != B_OK)
|
||||||
|
value = 0x68;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -11,15 +11,46 @@
|
|||||||
#include <Bitmap.h>
|
#include <Bitmap.h>
|
||||||
#include <Menu.h>
|
#include <Menu.h>
|
||||||
|
|
||||||
|
|
||||||
|
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,0x1d,0x1d,0x14,
|
||||||
|
0x1d,0x1a,0x1a,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,0x1a,0x1a,0x17,0x14,
|
||||||
|
0x1d,0x1a,0x1a,0x04,0x17,0x17,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x04,0x04,0x1a,0x04,0x04,0x04,0x1a,0x17,0x14,
|
||||||
|
0x1d,0x1a,0x1a,0x17,0x04,0x04,0x1a,0x1a,0x04,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,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,0x04,0x1a,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
||||||
|
0x1d,0x1a,0x1a,0x17,0x04,0x04,0x17,0x1a,0x04,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,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,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,0x14,0x14
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
const unsigned char kCtrlBits[] = {
|
const unsigned char kCtrlBits[] = {
|
||||||
|
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,0x13,0x04,0x04,0x13,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
||||||
|
0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x04,0x04,0x1a,0x04,0x04,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x17,0x14,
|
||||||
|
0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x17,0x14,
|
||||||
|
0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x04,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x17,0x14,
|
||||||
|
0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x04,0x1a,0x1a,0x04,0x1a,0x1a,0x1a,0x17,0x14,
|
||||||
|
0x1d,0x1a,0x1a,0x13,0x04,0x04,0x13,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x13,0x04,0x1a,0x04,0x04,0x04,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 unsigned char kOptBits[] = {
|
||||||
0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x14,
|
0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x14,
|
||||||
0x1d,0x1a,0x1a,0x1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0x1a,0x04,0x1a,0x1a,0x04,0x04,0x04,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,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,
|
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
|
0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14
|
||||||
@@ -41,42 +72,29 @@ const unsigned char kAltBits[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const unsigned char kOptBits[] = {
|
const unsigned char kMenuBits[] = {
|
||||||
0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x14,
|
0x1d,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,0x17,0x14,
|
0x1d,0x1a,0x1a,0x1a,0x1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1a,0x04,0x1a,0x04,0x1a,0x17,0x14,
|
||||||
0x1d,0x1a,0x1a,0x13,0x04,0x04,0x13,0x1a,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x04,0x04,0x1a,0x04,0x1a,0x1a,0x04,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,0x1a,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,0x14,
|
0x1d,0x17,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,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
|
|
||||||
};
|
|
||||||
|
|
||||||
namespace BPrivate {
|
namespace BPrivate {
|
||||||
|
|
||||||
|
|
||||||
BBitmap* MenuPrivate::sMenuItemAlt;
|
BBitmap* MenuPrivate::sMenuItemShift;
|
||||||
BBitmap* MenuPrivate::sMenuItemControl;
|
BBitmap* MenuPrivate::sMenuItemControl;
|
||||||
BBitmap* MenuPrivate::sMenuItemOption;
|
BBitmap* MenuPrivate::sMenuItemOption;
|
||||||
BBitmap* MenuPrivate::sMenuItemShift;
|
BBitmap* MenuPrivate::sMenuItemAlt;
|
||||||
|
BBitmap* MenuPrivate::sMenuItemMenu;
|
||||||
|
|
||||||
|
|
||||||
MenuPrivate::MenuPrivate(BMenu *menu)
|
MenuPrivate::MenuPrivate(BMenu *menu)
|
||||||
@@ -136,14 +154,6 @@ MenuPrivate::GetItemMargins(float *left, float *top,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* static */
|
|
||||||
bool
|
|
||||||
MenuPrivate::IsAltCommandKey()
|
|
||||||
{
|
|
||||||
return BMenu::sAltAsCommandKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
MenuPrivate::State(BMenuItem **item) const
|
MenuPrivate::State(BMenuItem **item) const
|
||||||
{
|
{
|
||||||
@@ -198,24 +208,27 @@ status_t
|
|||||||
MenuPrivate::CreateBitmaps()
|
MenuPrivate::CreateBitmaps()
|
||||||
{
|
{
|
||||||
BRect smallRect(0, 0, 16, 10);
|
BRect smallRect(0, 0, 16, 10);
|
||||||
BRect largeRect(0, 0, 21, 10);
|
|
||||||
try {
|
try {
|
||||||
sMenuItemAlt = new BBitmap(smallRect, B_CMAP8);
|
sMenuItemShift = new BBitmap(BRect(0, 0, 23, 10), B_CMAP8);
|
||||||
sMenuItemControl = new BBitmap(smallRect, B_CMAP8);
|
sMenuItemControl = new BBitmap(BRect(0, 0, 21, 10), B_CMAP8);
|
||||||
sMenuItemOption = new BBitmap(smallRect, B_CMAP8);
|
sMenuItemOption = new BBitmap(smallRect, B_CMAP8);
|
||||||
sMenuItemShift = new BBitmap(largeRect, B_CMAP8);
|
sMenuItemAlt = new BBitmap(smallRect, B_CMAP8);
|
||||||
|
sMenuItemMenu = new BBitmap(BRect(0, 0, 22, 10), B_CMAP8);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
sMenuItemAlt->ImportBits(kAltBits, sizeof(kAltBits),
|
sMenuItemShift->ImportBits(kShiftBits, sizeof(kShiftBits),
|
||||||
17, 0, B_CMAP8);
|
24, 0, B_CMAP8);
|
||||||
sMenuItemControl->ImportBits(kCtrlBits, sizeof(kCtrlBits),
|
sMenuItemControl->ImportBits(kCtrlBits, sizeof(kCtrlBits),
|
||||||
17, 0, B_CMAP8);
|
22, 0, B_CMAP8);
|
||||||
sMenuItemOption->ImportBits(kOptBits, sizeof(kOptBits),
|
sMenuItemOption->ImportBits(kOptBits, sizeof(kOptBits),
|
||||||
17, 0, B_CMAP8);
|
17, 0, B_CMAP8);
|
||||||
sMenuItemShift->ImportBits(kShiftBits, sizeof(kShiftBits),
|
sMenuItemAlt->ImportBits(kAltBits, sizeof(kAltBits),
|
||||||
22, 0, B_CMAP8);
|
17, 0, B_CMAP8);
|
||||||
|
sMenuItemMenu->ImportBits(kMenuBits, sizeof(kMenuBits),
|
||||||
|
23, 0, B_CMAP8);
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
@@ -225,40 +238,11 @@ MenuPrivate::CreateBitmaps()
|
|||||||
void
|
void
|
||||||
MenuPrivate::DeleteBitmaps()
|
MenuPrivate::DeleteBitmaps()
|
||||||
{
|
{
|
||||||
delete sMenuItemAlt;
|
delete sMenuItemShift;
|
||||||
delete sMenuItemControl;
|
delete sMenuItemControl;
|
||||||
delete sMenuItemOption;
|
delete sMenuItemOption;
|
||||||
delete sMenuItemShift;
|
delete sMenuItemAlt;
|
||||||
}
|
delete sMenuItemMenu;
|
||||||
|
|
||||||
|
|
||||||
/* static */
|
|
||||||
const BBitmap *
|
|
||||||
MenuPrivate::MenuItemCommand()
|
|
||||||
{
|
|
||||||
if (BMenu::sAltAsCommandKey)
|
|
||||||
return sMenuItemAlt;
|
|
||||||
|
|
||||||
return sMenuItemControl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* static */
|
|
||||||
const BBitmap *
|
|
||||||
MenuPrivate::MenuItemControl()
|
|
||||||
{
|
|
||||||
if (BMenu::sAltAsCommandKey)
|
|
||||||
return sMenuItemControl;
|
|
||||||
|
|
||||||
return sMenuItemAlt;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* static */
|
|
||||||
const BBitmap *
|
|
||||||
MenuPrivate::MenuItemOption()
|
|
||||||
{
|
|
||||||
return sMenuItemOption;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -270,4 +254,63 @@ MenuPrivate::MenuItemShift()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* static */
|
||||||
|
const BBitmap*
|
||||||
|
MenuPrivate::MenuItemControl()
|
||||||
|
{
|
||||||
|
switch (BMenu::sControlKey) {
|
||||||
|
case 0x5d:
|
||||||
|
case 0x5f:
|
||||||
|
return sMenuItemAlt;
|
||||||
|
case 0x66:
|
||||||
|
case 0x67:
|
||||||
|
return sMenuItemOption;
|
||||||
|
}
|
||||||
|
|
||||||
|
return sMenuItemControl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* static */
|
||||||
|
const BBitmap*
|
||||||
|
MenuPrivate::MenuItemOption()
|
||||||
|
{
|
||||||
|
switch (BMenu::sOptionKey) {
|
||||||
|
case 0x5c:
|
||||||
|
case 0x60:
|
||||||
|
return sMenuItemControl;
|
||||||
|
case 0x66:
|
||||||
|
case 0x67:
|
||||||
|
return sMenuItemOption;
|
||||||
|
}
|
||||||
|
|
||||||
|
return sMenuItemAlt;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* static */
|
||||||
|
const BBitmap*
|
||||||
|
MenuPrivate::MenuItemCommand()
|
||||||
|
{
|
||||||
|
switch (BMenu::sCommandKey) {
|
||||||
|
case 0x5c:
|
||||||
|
case 0x60:
|
||||||
|
return sMenuItemControl;
|
||||||
|
case 0x66:
|
||||||
|
case 0x67:
|
||||||
|
return sMenuItemOption;
|
||||||
|
}
|
||||||
|
|
||||||
|
return sMenuItemAlt;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* static */
|
||||||
|
const BBitmap*
|
||||||
|
MenuPrivate::MenuItemMenu()
|
||||||
|
{
|
||||||
|
return sMenuItemMenu;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace BPrivate
|
} // namespace BPrivate
|
||||||
|
|||||||
Reference in New Issue
Block a user