xref: /haiku/headers/os/interface/PopUpMenu.h (revision 6f33360fac01f5ca0a27405219710521a64fbf71)
1795a2888SStefano Ceccherini /*
229c26d1eSStephan Aßmus  * Copyright 2007-2009, 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 
8b6c3ddcfSAxel Dörfler 
9d734a8ceSbeveloper #include <Menu.h>
10d734a8ceSbeveloper 
11b6c3ddcfSAxel Dörfler 
12795a2888SStefano Ceccherini class BPopUpMenu : public BMenu {
13d734a8ceSbeveloper public:
14*6f33360fSJohn Scipione 								BPopUpMenu(const char* name,
1529c26d1eSStephan Aßmus 									bool radioMode = true,
16*6f33360fSJohn Scipione 									bool labelFromMarked = true,
17795a2888SStefano Ceccherini 									menu_layout layout = B_ITEMS_IN_COLUMN);
18d734a8ceSbeveloper 								BPopUpMenu(BMessage* data);
19d734a8ceSbeveloper 	virtual						~BPopUpMenu();
20795a2888SStefano Ceccherini 
2129c26d1eSStephan Aßmus 	virtual	status_t			Archive(BMessage* archive,
2229c26d1eSStephan Aßmus 									bool deep = true) const;
2329c26d1eSStephan Aßmus 	static	BArchivable*		Instantiate(BMessage* archive);
24d734a8ceSbeveloper 
25795a2888SStefano Ceccherini 			BMenuItem*			Go(BPoint where, bool autoInvoke = false,
26b6c3ddcfSAxel Dörfler 									bool keepOpen = false, bool async = false);
2729c26d1eSStephan Aßmus 			BMenuItem*			Go(BPoint where, bool autoInvoke,
2829c26d1eSStephan Aßmus 									bool keepOpen, BRect openRect,
2929c26d1eSStephan Aßmus 									bool async = false);
30d734a8ceSbeveloper 
31795a2888SStefano Ceccherini 	virtual void				MessageReceived(BMessage* message);
3229c26d1eSStephan Aßmus 	virtual	void				MouseDown(BPoint where);
3329c26d1eSStephan Aßmus 	virtual	void				MouseUp(BPoint where);
3429c26d1eSStephan Aßmus 	virtual	void				MouseMoved(BPoint where, uint32 transit,
3529c26d1eSStephan Aßmus 									const BMessage* dragMessage);
36d734a8ceSbeveloper 	virtual	void				AttachedToWindow();
37d734a8ceSbeveloper 	virtual	void				DetachedFromWindow();
38795a2888SStefano Ceccherini 	virtual	void				FrameMoved(BPoint newPosition);
39795a2888SStefano Ceccherini 	virtual	void				FrameResized(float newWidth, float newHeight);
40d734a8ceSbeveloper 
4129c26d1eSStephan Aßmus 	virtual BHandler*			ResolveSpecifier(BMessage* message,
4229c26d1eSStephan Aßmus 									int32 index, BMessage* specifier,
4329c26d1eSStephan Aßmus 									int32 form, const char* property);
44d734a8ceSbeveloper 	virtual status_t			GetSupportedSuites(BMessage* data);
45d734a8ceSbeveloper 
4601b1b8bdSJohn Scipione 	virtual status_t			Perform(perform_code code, void* _data);
47d734a8ceSbeveloper 
48d734a8ceSbeveloper 	virtual void				ResizeToPreferred();
4929c26d1eSStephan Aßmus 	virtual void				GetPreferredSize(float* _width,
5029c26d1eSStephan Aßmus 									float* _height);
51d734a8ceSbeveloper 	virtual void				MakeFocus(bool state = true);
52d734a8ceSbeveloper 	virtual void				AllAttached();
53d734a8ceSbeveloper 	virtual void				AllDetached();
54d734a8ceSbeveloper 
55*6f33360fSJohn Scipione 			void				SetAsyncAutoDestruct(bool on);
56d734a8ceSbeveloper 			bool				AsyncAutoDestruct() const;
57d734a8ceSbeveloper 
58d734a8ceSbeveloper protected:
59d734a8ceSbeveloper 	virtual	BPoint				ScreenLocation();
60d734a8ceSbeveloper 
61d734a8ceSbeveloper 	virtual	void				_ReservedPopUpMenu1();
62d734a8ceSbeveloper 	virtual	void				_ReservedPopUpMenu2();
63d734a8ceSbeveloper 	virtual	void				_ReservedPopUpMenu3();
64d734a8ceSbeveloper 
65b6c3ddcfSAxel Dörfler 			BPopUpMenu&			operator=(const BPopUpMenu& other);
66d734a8ceSbeveloper 
67d734a8ceSbeveloper private:
6829c26d1eSStephan Aßmus 			BMenuItem*			_Go(BPoint where, bool autoInvoke,
6901b1b8bdSJohn Scipione 									bool startOpened, BRect* _specialRect,
7029c26d1eSStephan Aßmus 									bool async);
71795a2888SStefano Ceccherini 			BMenuItem*			_StartTrack(BPoint where, bool autoInvoke,
7201b1b8bdSJohn Scipione 									bool startOpened, BRect* _specialRect);
7301b1b8bdSJohn Scipione 			BMenuItem*			_WaitMenu(void* _data);
74cd1cef8aSStefano Ceccherini 
7501b1b8bdSJohn Scipione 	static	int32				_thread_entry(void* menuData);
76d734a8ceSbeveloper 
7729c26d1eSStephan Aßmus private:
78d734a8ceSbeveloper 			BPoint				fWhere;
79d734a8ceSbeveloper 			bool				fUseWhere;
80d734a8ceSbeveloper 			bool				fAutoDestruct;
8129c26d1eSStephan Aßmus 
82d734a8ceSbeveloper 			bool				_fUnusedBool1;
83d734a8ceSbeveloper 			bool				_fUnusedBool2;
8429c26d1eSStephan Aßmus 
85d734a8ceSbeveloper 			thread_id			fTrackThread;
8629c26d1eSStephan Aßmus 
87d734a8ceSbeveloper 			uint32				_reserved[3];
88d734a8ceSbeveloper };
89d734a8ceSbeveloper 
90b6c3ddcfSAxel Dörfler #endif // _POP_UP_MENU_H
91