* There was indeed a problem with my previous attempt at fixing #353. This should be much
better! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28139 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -54,7 +54,7 @@ All rights reserved.
|
||||
#include "IconMenuItem.h"
|
||||
#include "MountMenu.h"
|
||||
#include "PoseView.h"
|
||||
#include "SlowContextPopup.h"
|
||||
#include "ShowingAwarePopUpMenu.h"
|
||||
#include "Tracker.h"
|
||||
#include "TemplatesMenu.h"
|
||||
|
||||
@@ -329,7 +329,7 @@ void
|
||||
BDeskWindow::AddTrashContextMenu()
|
||||
{
|
||||
// setup special trash context menu
|
||||
fTrashContextMenu = new BSlowContextMenu("TrashContext");
|
||||
fTrashContextMenu = new BShowingAwarePopUpMenu("TrashContext");
|
||||
fTrashContextMenu->SetFont(be_plain_font);
|
||||
fTrashContextMenu->AddItem(new BMenuItem("Empty Trash",
|
||||
new BMessage(kEmptyTrash)));
|
||||
|
||||
@@ -41,9 +41,10 @@ All rights reserved.
|
||||
#include "ContainerWindow.h"
|
||||
#include "DesktopPoseView.h"
|
||||
|
||||
class BSlowContextMenu;
|
||||
|
||||
namespace BPrivate {
|
||||
|
||||
class BShowingAwarePopUpMenu;
|
||||
|
||||
class BDeskWindow : public BContainerWindow {
|
||||
public:
|
||||
@@ -82,7 +83,7 @@ protected:
|
||||
private:
|
||||
BShelf *fDeskShelf;
|
||||
// shelf for replicant support
|
||||
BSlowContextMenu *fTrashContextMenu;
|
||||
BShowingAwarePopUpMenu *fTrashContextMenu;
|
||||
|
||||
BRect fOldFrame;
|
||||
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* 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
|
||||
Reference in New Issue
Block a user