* Simply check if fTrashContextMenu->Window() is non NULL. This should be the definitive

solution :)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28152 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Alexandre Deckner
2008-10-15 21:14:16 +00:00
parent 1cbca49a83
commit 404bf9d1ab
5 changed files with 4 additions and 82 deletions
+2 -3
View File
@@ -54,7 +54,6 @@ All rights reserved.
#include "IconMenuItem.h"
#include "MountMenu.h"
#include "PoseView.h"
#include "ShowingAwarePopUpMenu.h"
#include "Tracker.h"
#include "TemplatesMenu.h"
@@ -329,7 +328,7 @@ void
BDeskWindow::AddTrashContextMenu()
{
// setup special trash context menu
fTrashContextMenu = new BShowingAwarePopUpMenu("TrashContext");
fTrashContextMenu = new BPopUpMenu("TrashContext");
fTrashContextMenu->SetFont(be_plain_font);
fTrashContextMenu->AddItem(new BMenuItem("Empty Trash",
new BMessage(kEmptyTrash)));
@@ -351,7 +350,7 @@ BDeskWindow::ShowContextMenu(BPoint loc, const entry_ref *ref, BView *view)
if (ref && entry.SetTo(ref) == B_OK && FSIsTrashDir(&entry)) {
if (fTrashContextMenu->IsShowing() || Dragging())
if (fTrashContextMenu->Window() || Dragging())
return;
// selected item was trash, show the trash context menu instead
+2 -3
View File
@@ -41,10 +41,9 @@ All rights reserved.
#include "ContainerWindow.h"
#include "DesktopPoseView.h"
class BPopUpMenu;
namespace BPrivate {
class BShowingAwarePopUpMenu;
class BDeskWindow : public BContainerWindow {
public:
@@ -83,7 +82,7 @@ protected:
private:
BShelf *fDeskShelf;
// shelf for replicant support
BShowingAwarePopUpMenu *fTrashContextMenu;
BPopUpMenu *fTrashContextMenu;
BRect fOldFrame;
-1
View File
@@ -72,7 +72,6 @@ SharedLibrary libtracker.so :
Settings.cpp
SettingsHandler.cpp
SettingsViews.cpp
ShowingAwarePopUpMenu.cpp
SlowContextPopup.cpp
SlowMenu.cpp
StatusWindow.cpp
@@ -1,37 +0,0 @@
/*
* Copyright 2008, Haiku Inc.
* Distributed under the terms of the MIT License.
*
* Authors:
* Alexandre Deckner, [email protected]
*/
#include "ShowingAwarePopUpMenu.h"
BShowingAwarePopUpMenu::BShowingAwarePopUpMenu(const char *title, bool radioMode,
bool autoRename, menu_layout layout)
: BPopUpMenu(title, radioMode, autoRename, layout),
fIsShowing(false)
{
}
BShowingAwarePopUpMenu::~BShowingAwarePopUpMenu()
{
}
void
BShowingAwarePopUpMenu::AttachedToWindow()
{
fIsShowing = true;
BPopUpMenu::AttachedToWindow();
}
void
BShowingAwarePopUpMenu::DetachedFromWindow()
{
fIsShowing = false;
}
-38
View File
@@ -1,38 +0,0 @@
/*
* Copyright 2008, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _SHOWING_AWARE_POPUP_MENU_H
#define _SHOWING_AWARE_POPUP_MENU_H
#include <PopUpMenu.h>
namespace BPrivate {
class BShowingAwarePopUpMenu : public BPopUpMenu {
public:
BShowingAwarePopUpMenu(const char *title, bool radioMode = true,
bool autoRename = true, menu_layout layout = B_ITEMS_IN_COLUMN);
virtual ~BShowingAwarePopUpMenu();
virtual void AttachedToWindow();
virtual void DetachedFromWindow();
const bool IsShowing() const;
private:
bool fIsShowing;
};
} // namespace BPrivate
using namespace BPrivate;
inline const bool
BShowingAwarePopUpMenu::IsShowing() const
{
return fIsShowing;
}
#endif