1 /* 2 * Copyright 2007-2009, Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _POP_UP_MENU_H 6 #define _POP_UP_MENU_H 7 8 9 #include <Menu.h> 10 11 12 class BPopUpMenu : public BMenu { 13 public: 14 BPopUpMenu(const char* name, 15 bool radioMode = true, 16 bool labelFromMarked = true, 17 menu_layout layout = B_ITEMS_IN_COLUMN); 18 BPopUpMenu(BMessage* data); 19 virtual ~BPopUpMenu(); 20 21 virtual status_t Archive(BMessage* archive, 22 bool deep = true) const; 23 static BArchivable* Instantiate(BMessage* archive); 24 25 BMenuItem* Go(BPoint where, bool autoInvoke = false, 26 bool keepOpen = false, bool async = false); 27 BMenuItem* Go(BPoint where, bool autoInvoke, 28 bool keepOpen, BRect openRect, 29 bool async = false); 30 31 virtual void MessageReceived(BMessage* message); 32 virtual void MouseDown(BPoint where); 33 virtual void MouseUp(BPoint where); 34 virtual void MouseMoved(BPoint where, uint32 transit, 35 const BMessage* dragMessage); 36 virtual void AttachedToWindow(); 37 virtual void DetachedFromWindow(); 38 virtual void FrameMoved(BPoint newPosition); 39 virtual void FrameResized(float newWidth, float newHeight); 40 41 virtual BHandler* ResolveSpecifier(BMessage* message, 42 int32 index, BMessage* specifier, 43 int32 form, const char* property); 44 virtual status_t GetSupportedSuites(BMessage* data); 45 46 virtual status_t Perform(perform_code code, void* _data); 47 48 virtual void ResizeToPreferred(); 49 virtual void GetPreferredSize(float* _width, 50 float* _height); 51 virtual void MakeFocus(bool state = true); 52 virtual void AllAttached(); 53 virtual void AllDetached(); 54 55 void SetAsyncAutoDestruct(bool on); 56 bool AsyncAutoDestruct() const; 57 58 protected: 59 virtual BPoint ScreenLocation(); 60 61 virtual void _ReservedPopUpMenu1(); 62 virtual void _ReservedPopUpMenu2(); 63 virtual void _ReservedPopUpMenu3(); 64 65 BPopUpMenu& operator=(const BPopUpMenu& other); 66 67 private: 68 BMenuItem* _Go(BPoint where, bool autoInvoke, 69 bool startOpened, BRect* _specialRect, 70 bool async); 71 BMenuItem* _StartTrack(BPoint where, bool autoInvoke, 72 bool startOpened, BRect* _specialRect); 73 BMenuItem* _WaitMenu(void* _data); 74 75 static int32 _thread_entry(void* menuData); 76 77 private: 78 BPoint fWhere; 79 bool fUseWhere; 80 bool fAutoDestruct; 81 82 bool _fUnusedBool1; 83 bool _fUnusedBool2; 84 85 thread_id fTrackThread; 86 87 uint32 _reserved[3]; 88 }; 89 90 #endif // _POP_UP_MENU_H 91