correct menu color scheme title, thx Diver(ru), change from Draw to DrawContent simplifies BitmapMenuItem implementation, call to parent to draw string content enables shortcut on the menu item, fix always show triggers behavior (should be enabled when click to open is marked, disabled otherwise)

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6058 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
shatty 2004-01-13 01:01:13 +00:00
parent 158c46331a
commit c2d66a0f49
4 changed files with 6 additions and 26 deletions

View File

@ -18,7 +18,7 @@ BitmapMenuItem::BitmapMenuItem(const char* name, BMessage* message,
fCheckBmp = BTranslationUtils::GetBitmap(B_RAW_TYPE, "CHECK");
}
void BitmapMenuItem::Draw(void)
void BitmapMenuItem::DrawContent(void)
{
BRect dr;
@ -29,32 +29,12 @@ void BitmapMenuItem::Draw(void)
BRect itemFrame = Frame();
if (IsSelected()) {
menu->SetHighColor(160, 160, 160);
menu->SetLowColor(160, 160, 160);
menu->FillRect(itemFrame);
} else {
menu->SetHighColor(219, 219, 219);
menu->SetLowColor(219, 219, 219);
}
menu->SetHighColor(0, 0, 0);
if (IsMarked()) {
menu->MovePenTo(itemFrame.left + 2, itemFrame.bottom - 4);
BRect checkFrame(0, 0, 12, 12);
dr.Set(itemFrame.left, itemFrame.top + 2, itemFrame.left + 12, itemFrame.top + 14);
menu->SetDrawingMode(B_OP_OVER);
menu->DrawBitmap(fCheckBmp, checkFrame, dr);
menu->SetDrawingMode(B_OP_COPY);
}
menu->MovePenTo(itemFrame.left + 38, itemFrame.bottom - 5);
menu->DrawString(fName.String());
menu->MovePenTo(itemFrame.left + 38, itemFrame.top + 2);
BMenuItem::DrawContent();
BRect bitmapFrame = fBmp->Bounds();
dr.Set(itemFrame.left + 14, itemFrame.top + 2, itemFrame.left + 14 + bitmapFrame.right, itemFrame.top + 17);
menu->SetDrawingMode(B_OP_OVER);
menu->DrawBitmap(fBmp, bitmapFrame, dr);
menu->SetDrawingMode(B_OP_COPY);
}

View File

@ -16,7 +16,7 @@ class BitmapMenuItem : public BMenuItem
public:
BitmapMenuItem(const char* name, BMessage* message, BBitmap* bmp,
char shortcut = 0, uint32 modifiers = 0);
virtual void Draw(void);
virtual void DrawContent(void);
private:
BBitmap *fBmp;

View File

@ -2,7 +2,7 @@
#include "MenuApp.h"
ColorWindow::ColorWindow()
: BWindow(BRect(150,150,350,200), "Menu Color Schene", B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_NOT_RESIZABLE)
: BWindow(BRect(150,150,350,200), "Menu Color Scheme", B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_NOT_RESIZABLE)
{
// Set and collect the variables for revert
get_menu_info(&info);

View File

@ -90,7 +90,7 @@
alwaysShowTriggersItem->SetMarked(info.triggers_always_shown);
clickToOpenItem->SetMarked(info.click_to_open);
alwaysShowTriggersItem->SetEnabled(!info.click_to_open);
alwaysShowTriggersItem->SetEnabled(info.click_to_open);
get_key_map(&keys, &chars);