From c2d66a0f4962b39e4e856f5ef2da89445f83f640 Mon Sep 17 00:00:00 2001 From: shatty Date: Tue, 13 Jan 2004 01:01:13 +0000 Subject: [PATCH] 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 --- src/prefs/menu/BitmapMenuItem.cpp | 26 +++----------------------- src/prefs/menu/BitmapMenuItem.h | 2 +- src/prefs/menu/ColorWindow.cpp | 2 +- src/prefs/menu/MenuBar.cpp | 2 +- 4 files changed, 6 insertions(+), 26 deletions(-) diff --git a/src/prefs/menu/BitmapMenuItem.cpp b/src/prefs/menu/BitmapMenuItem.cpp index c5bf8e356d..6287d7f34e 100644 --- a/src/prefs/menu/BitmapMenuItem.cpp +++ b/src/prefs/menu/BitmapMenuItem.cpp @@ -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); - } diff --git a/src/prefs/menu/BitmapMenuItem.h b/src/prefs/menu/BitmapMenuItem.h index b3bb700af0..c7abcc01e4 100644 --- a/src/prefs/menu/BitmapMenuItem.h +++ b/src/prefs/menu/BitmapMenuItem.h @@ -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; diff --git a/src/prefs/menu/ColorWindow.cpp b/src/prefs/menu/ColorWindow.cpp index 0e5390eb5c..dd4d2beac4 100644 --- a/src/prefs/menu/ColorWindow.cpp +++ b/src/prefs/menu/ColorWindow.cpp @@ -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); diff --git a/src/prefs/menu/MenuBar.cpp b/src/prefs/menu/MenuBar.cpp index 31d3e760e7..43b7448b6f 100644 --- a/src/prefs/menu/MenuBar.cpp +++ b/src/prefs/menu/MenuBar.cpp @@ -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);