* Fixed B_AVOID_FRONT support in the app_server.

* Menu windows now use the kMenuWindowFeel feel (but still need the B_AVOID_FOCUS
  flag set, as that's currently independent from the feel).
* Minor cleanup in MenuWindow.cpp


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16150 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2006-01-30 13:40:22 +00:00
parent 304636cc5e
commit c7023acdc6
2 changed files with 32 additions and 47 deletions
+29 -46
View File
@@ -1,58 +1,39 @@
//------------------------------------------------------------------------------ /*
// Copyright (c) 2001-2005, Haiku, Inc. * Copyright 2001-2006, Haiku, Inc.
// * Distributed under the terms of the MIT License.
// Permission is hereby granted, free of charge, to any person obtaining a *
// copy of this software and associated documentation files (the "Software"), * Authors:
// to deal in the Software without restriction, including without limitation * Marc Flerackers ([email protected])
// the rights to use, copy, modify, merge, publish, distribute, sublicense, * Stefano Ceccherini ([email protected])
// 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:
// //! BMenuWindow is a custom BWindow for BMenus.
// 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: MenuWindow.cpp
// Authors: Marc Flerackers ([email protected])
// Stefano Ceccherini ([email protected])
// Description: BMenuWindow is a custom BWindow for BMenus.
//------------------------------------------------------------------------------
// TODO: Add scrollers // TODO: Add scrollers
#include <Menu.h> #include <Menu.h>
#include <MenuWindow.h> #include <MenuWindow.h>
// TODO: taken from Deskbar's WindowMenu.cpp. #include <WindowPrivate.h>
// this should go to some private header.
const window_feel kMenuWindowFeel = (window_feel)1025;
// This draws the frame around the BMenu // This draws the frame around the BMenu
class BMenuFrame : public BView { class BMenuFrame : public BView {
public: public:
BMenuFrame(BMenu *menu) ; BMenuFrame(BMenu *menu);
virtual void AttachedToWindow();
virtual void Draw(BRect updateRect);
private: virtual void AttachedToWindow();
BMenu *fMenu; virtual void Draw(BRect updateRect);
private:
BMenu *fMenu;
}; };
BMenuWindow::BMenuWindow(const char *name, BMenu *menu) BMenuWindow::BMenuWindow(const char *name, BMenu *menu)
:
// The window will be resized by BMenu, so just pass a dummy rect // The window will be resized by BMenu, so just pass a dummy rect
//BWindow(BRect(0, 0, 0, 0), name, B_BORDERED_WINDOW_LOOK, kMenuWindowFeel, : BWindow(BRect(0, 0, 0, 0), name, B_BORDERED_WINDOW_LOOK, kMenuWindowFeel,
// B_NOT_ZOOMABLE), B_NOT_ZOOMABLE | B_AVOID_FOCUS),
BWindow(BRect(0, 0, 0, 0), name, B_BORDERED_WINDOW_LOOK, B_FLOATING_ALL_WINDOW_FEEL,
B_NOT_ZOOMABLE|B_AVOID_FRONT|B_AVOID_FOCUS),
fUpperScroller(NULL), fUpperScroller(NULL),
fLowerScroller(NULL) fLowerScroller(NULL)
{ {
@@ -75,10 +56,11 @@ BMenuWindow::SetMenu(BMenu *menu)
} }
// BMenuFrame // #pragma mark -
BMenuFrame::BMenuFrame(BMenu *menu) BMenuFrame::BMenuFrame(BMenu *menu)
: : BView(BRect(0, 0, 1, 1), "menu frame", B_FOLLOW_ALL_SIDES, B_WILL_DRAW),
BView(BRect(0, 0, 1, 1), "menu frame", B_FOLLOW_ALL_SIDES, B_WILL_DRAW),
fMenu(menu) fMenu(menu)
{ {
} }
@@ -107,8 +89,9 @@ BMenuFrame::Draw(BRect updateRect)
SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), B_DARKEN_2_TINT)); SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), B_DARKEN_2_TINT));
BRect bounds(Bounds()); BRect bounds(Bounds());
StrokeLine(BPoint(bounds.right, bounds.top), StrokeLine(BPoint(bounds.right, bounds.top),
BPoint(bounds.right, bounds.bottom - 1)); BPoint(bounds.right, bounds.bottom - 1));
StrokeLine(BPoint(bounds.left + 1, bounds.bottom), StrokeLine(BPoint(bounds.left + 1, bounds.bottom),
BPoint(bounds.right, bounds.bottom)); BPoint(bounds.right, bounds.bottom));
} }
+3 -1
View File
@@ -1275,7 +1275,9 @@ WindowLayer::InWorkspace(int32 index) const
bool bool
WindowLayer::SupportsFront() WindowLayer::SupportsFront()
{ {
if (fFeel == kDesktopWindowFeel) if (fFeel == kDesktopWindowFeel
|| fFeel == kMenuWindowFeel
|| (fFlags & B_AVOID_FRONT) != 0)
return false; return false;
return true; return true;