diff --git a/src/kits/tracker/DeskWindow.cpp b/src/kits/tracker/DeskWindow.cpp index 54ccaa7a12..f2ecdb4d76 100644 --- a/src/kits/tracker/DeskWindow.cpp +++ b/src/kits/tracker/DeskWindow.cpp @@ -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))); diff --git a/src/kits/tracker/DeskWindow.h b/src/kits/tracker/DeskWindow.h index 43ab1b5120..a057ab2795 100644 --- a/src/kits/tracker/DeskWindow.h +++ b/src/kits/tracker/DeskWindow.h @@ -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; diff --git a/src/kits/tracker/ShowingAwarePopUpMenu.cpp b/src/kits/tracker/ShowingAwarePopUpMenu.cpp new file mode 100644 index 0000000000..671aa2ea00 --- /dev/null +++ b/src/kits/tracker/ShowingAwarePopUpMenu.cpp @@ -0,0 +1,37 @@ +/* + * Copyright 2008, Haiku Inc. + * Distributed under the terms of the MIT License. + * + * Authors: + * Alexandre Deckner, alex@zappotek.com + */ + +#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; +} diff --git a/src/kits/tracker/ShowingAwarePopUpMenu.h b/src/kits/tracker/ShowingAwarePopUpMenu.h new file mode 100644 index 0000000000..ebd50c1d78 --- /dev/null +++ b/src/kits/tracker/ShowingAwarePopUpMenu.h @@ -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 + + +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