1795a2888SStefano Ceccherini /* 2*b6c3ddcfSAxel Dörfler * Copyright 2007-2008, Haiku, Inc. All Rights Reserved. 3795a2888SStefano Ceccherini * Distributed under the terms of the MIT License. 4795a2888SStefano Ceccherini */ 5d734a8ceSbeveloper #ifndef _POP_UP_MENU_H 6d734a8ceSbeveloper #define _POP_UP_MENU_H 7d734a8ceSbeveloper 8*b6c3ddcfSAxel Dörfler 9d734a8ceSbeveloper #include <BeBuild.h> 10d734a8ceSbeveloper #include <Menu.h> 11d734a8ceSbeveloper 12*b6c3ddcfSAxel Dörfler 13795a2888SStefano Ceccherini class BPopUpMenu : public BMenu { 14d734a8ceSbeveloper public: 15795a2888SStefano Ceccherini BPopUpMenu(const char* title, bool radioMode = true, 16d734a8ceSbeveloper bool autoRename = true, 17795a2888SStefano Ceccherini menu_layout layout = B_ITEMS_IN_COLUMN); 18d734a8ceSbeveloper BPopUpMenu(BMessage* data); 19d734a8ceSbeveloper virtual ~BPopUpMenu(); 20795a2888SStefano Ceccherini 21d734a8ceSbeveloper virtual status_t Archive(BMessage* data, bool deep = true) const; 22d734a8ceSbeveloper static BArchivable* Instantiate(BMessage* data); 23d734a8ceSbeveloper 24795a2888SStefano Ceccherini BMenuItem* Go(BPoint where, bool autoInvoke = false, 25*b6c3ddcfSAxel Dörfler bool keepOpen = false, bool async = false); 26*b6c3ddcfSAxel Dörfler BMenuItem* Go(BPoint where, bool autoInvoke, bool keepOpen, 27*b6c3ddcfSAxel Dörfler BRect openRect, bool async = false); 28d734a8ceSbeveloper 29795a2888SStefano Ceccherini virtual void MessageReceived(BMessage* message); 30795a2888SStefano Ceccherini virtual void MouseDown(BPoint point); 31795a2888SStefano Ceccherini virtual void MouseUp(BPoint point); 32795a2888SStefano Ceccherini virtual void MouseMoved(BPoint point, uint32 code, 33795a2888SStefano Ceccherini const BMessage* message); 34d734a8ceSbeveloper virtual void AttachedToWindow(); 35d734a8ceSbeveloper virtual void DetachedFromWindow(); 36795a2888SStefano Ceccherini virtual void FrameMoved(BPoint newPosition); 37795a2888SStefano Ceccherini virtual void FrameResized(float newWidth, float newHeight); 38d734a8ceSbeveloper 39795a2888SStefano Ceccherini virtual BHandler* ResolveSpecifier(BMessage* message, int32 index, 40795a2888SStefano Ceccherini BMessage* specifier, int32 form, 41d734a8ceSbeveloper const char* property); 42d734a8ceSbeveloper virtual status_t GetSupportedSuites(BMessage* data); 43d734a8ceSbeveloper 44795a2888SStefano Ceccherini virtual status_t Perform(perform_code code, void* arg); 45d734a8ceSbeveloper 46d734a8ceSbeveloper virtual void ResizeToPreferred(); 47*b6c3ddcfSAxel Dörfler virtual void GetPreferredSize(float* _width, float* _height); 48d734a8ceSbeveloper virtual void MakeFocus(bool state = true); 49d734a8ceSbeveloper virtual void AllAttached(); 50d734a8ceSbeveloper virtual void AllDetached(); 51d734a8ceSbeveloper 52d734a8ceSbeveloper void SetAsyncAutoDestruct(bool state); 53d734a8ceSbeveloper bool AsyncAutoDestruct() const; 54d734a8ceSbeveloper 55d734a8ceSbeveloper protected: 56d734a8ceSbeveloper virtual BPoint ScreenLocation(); 57d734a8ceSbeveloper 58d734a8ceSbeveloper virtual void _ReservedPopUpMenu1(); 59d734a8ceSbeveloper virtual void _ReservedPopUpMenu2(); 60d734a8ceSbeveloper virtual void _ReservedPopUpMenu3(); 61d734a8ceSbeveloper 62*b6c3ddcfSAxel Dörfler BPopUpMenu& operator=(const BPopUpMenu& other); 63d734a8ceSbeveloper 64d734a8ceSbeveloper private: 65cd1cef8aSStefano Ceccherini BMenuItem* _Go(BPoint where, bool autoInvoke, bool startOpened, 66cd1cef8aSStefano Ceccherini BRect* specialRect, bool async); 67795a2888SStefano Ceccherini BMenuItem* _StartTrack(BPoint where, bool autoInvoke, 68795a2888SStefano Ceccherini bool startOpened, BRect* specialRect); 69cd1cef8aSStefano Ceccherini BMenuItem* _WaitMenu(void* data); 70cd1cef8aSStefano Ceccherini 71*b6c3ddcfSAxel Dörfler static int32 _thread_entry(void* data); 72d734a8ceSbeveloper 73d734a8ceSbeveloper BPoint fWhere; 74d734a8ceSbeveloper bool fUseWhere; 75d734a8ceSbeveloper bool fAutoDestruct; 76d734a8ceSbeveloper bool _fUnusedBool1; 77d734a8ceSbeveloper bool _fUnusedBool2; 78d734a8ceSbeveloper thread_id fTrackThread; 79d734a8ceSbeveloper uint32 _reserved[3]; 80d734a8ceSbeveloper }; 81d734a8ceSbeveloper 82*b6c3ddcfSAxel Dörfler #endif // _POP_UP_MENU_H 83