From db937cbed939ba65e8378f269c4bad644377dbfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Mon, 27 Feb 2006 14:02:50 +0000 Subject: [PATCH] Fix for shortcut drawing in the test environment. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16531 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/MenuItem.cpp | 53 +++++++++++++-------------------- 1 file changed, 20 insertions(+), 33 deletions(-) diff --git a/src/kits/interface/MenuItem.cpp b/src/kits/interface/MenuItem.cpp index bbd883b172..b62ffb3a9d 100644 --- a/src/kits/interface/MenuItem.cpp +++ b/src/kits/interface/MenuItem.cpp @@ -1,41 +1,25 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2001-2005, Haiku -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, -// and/or sell copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. -// -// File Name: MenuItem.cpp -// Authors Marc Flerackers (mflerackers@androme.be) -// Bill Hayden (haydentech@users.sourceforge.net) -// Stefano Ceccherini (burton666@libero.it) -// Olivier Milla -// Description: Display item for BMenu class -// -//------------------------------------------------------------------------------ +/* + * Copyright 2001-2006, Haiku, Inc. + * Distributed under the terms of the MIT License. + * + * Authors: + * Marc Flerackers (mflerackers@androme.be) + * Bill Hayden (haydentech@users.sourceforge.net) + * Stefano Ceccherini (burton666@libero.it) + * Olivier Milla + */ -#include -#include +//! Display item for BMenu class #include #include #include #include +#include +#include + + const uint32 kCtrlLength = 20*11; const unsigned char kCtrlBits [] = { 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x14,0xff,0xff,0xff, @@ -726,12 +710,15 @@ BMenuItem::DrawShortcutSymbol() get_key_map(&keys, &chars); BRect rect(0,0,16,10); BBitmap control(rect, B_COLOR_8_BIT); - if ((keys->left_command_key == 0x5d) && (keys->right_command_key == 0x5f)) + + // TODO: isn't there a better way to do this? + if (keys != NULL + && keys->left_command_key == 0x5d && keys->right_command_key == 0x5f) control.SetBits(kAltBits, kAltLength, 0, B_COLOR_8_BIT); else control.SetBits(kCtrlBits, kCtrlLength, 0, B_COLOR_8_BIT); fSuper->DrawBitmap(&control, where); - + where.x -= rect.Width(); free(chars);