diff --git a/src/apps/showimage/ShowImageStatusView.cpp b/src/apps/showimage/ShowImageStatusView.cpp index 1b2713714f..ea43fb70cc 100644 --- a/src/apps/showimage/ShowImageStatusView.cpp +++ b/src/apps/showimage/ShowImageStatusView.cpp @@ -27,6 +27,14 @@ /*****************************************************************************/ #include "ShowImageStatusView.h" +#include "ShowImageView.h" +#include "ShowImageWindow.h" + +#include +#include +#include +#include + ShowImageStatusView::ShowImageStatusView(BRect rect, const char* name, uint32 resizingMode, uint32 flags) @@ -42,6 +50,7 @@ ShowImageStatusView::ShowImageStatusView(BRect rect, const char* name, SetFont(&font); } + void ShowImageStatusView::Draw(BRect updateRect) { @@ -82,9 +91,51 @@ ShowImageStatusView::Draw(BRect updateRect) + fh.ascent / 2.0))); } + +void +ShowImageStatusView::MouseDown(BPoint where) +{ + ShowImageWindow *window = dynamic_cast(Window()); + if (!window || window->GetShowImageView() == NULL) + return; + + BPath path; + path.SetTo(window->GetShowImageView()->Image()); + + BPopUpMenu popup("no title"); + popup.SetFont(be_plain_font); + + while (path.GetParent(&path) == B_OK && path != "/") { + popup.AddItem(new BMenuItem(path.Leaf(), NULL)); + } + + BRect bounds(Bounds()); + ConvertToScreen(&bounds); + where = bounds.LeftBottom(); + + BMenuItem *item; + item = popup.Go(where, true, false, ConvertToScreen(Bounds())); + + if (item) { + path.SetTo(window->GetShowImageView()->Image()); + path.GetParent(&path); + int index = popup.IndexOf(item); + while (index--) + path.GetParent(&path); + BMessenger tracker("application/x-vnd.Be-TRAK"); + BMessage msg(B_REFS_RECEIVED); + entry_ref ref; + get_ref_for_path(path.Path(), &ref); + msg.AddRef("refs", &ref); + tracker.SendMessage(msg); + } +} + + void ShowImageStatusView::SetText(BString &text) { fText = text; Invalidate(); } + diff --git a/src/apps/showimage/ShowImageStatusView.h b/src/apps/showimage/ShowImageStatusView.h index faac45e1a2..4dfa87424a 100644 --- a/src/apps/showimage/ShowImageStatusView.h +++ b/src/apps/showimage/ShowImageStatusView.h @@ -38,6 +38,8 @@ public: uint32 flags); virtual void Draw(BRect updateRect); + + virtual void MouseDown(BPoint where); void SetText(BString &text);