xref: /haiku/headers/os/interface/PopUpMenu.h (revision e6b30aee0fd7a23d6a6baab9f3718945a0cd838a)
1 /*
2  * Copyright 2007, 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 #include <BeBuild.h>
9 #include <Menu.h>
10 
11 class BPopUpMenu : public BMenu {
12 	public:
13 		BPopUpMenu(const char *title, bool radioMode = true,
14 					bool autoRename = true,
15 					menu_layout layout = B_ITEMS_IN_COLUMN);
16 		BPopUpMenu(BMessage *data);
17 		virtual	~BPopUpMenu();
18 
19 		virtual status_t	Archive(BMessage *data, bool deep = true) const;
20 		static BArchivable*	Instantiate(BMessage *data);
21 
22 		BMenuItem*		Go(BPoint where, bool autoInvoke = false,
23 						bool keepOpen = false,
24 						bool async = false);
25 		BMenuItem*		Go(BPoint where, bool autoInvoke,
26 						bool keepOpen,
27 						BRect openRect,
28 						bool async = false);
29 
30 		virtual void		MessageReceived(BMessage *message);
31 		virtual	void		MouseDown(BPoint point);
32 		virtual	void		MouseUp(BPoint point);
33 		virtual	void		MouseMoved(BPoint point, uint32 code,
34 							const BMessage *message);
35 		virtual	void		AttachedToWindow();
36 		virtual	void		DetachedFromWindow();
37 		virtual	void		FrameMoved(BPoint newPosition);
38 		virtual	void		FrameResized(float newWidth, float newHeight);
39 
40 		virtual BHandler*	ResolveSpecifier(BMessage *message, int32 index,
41 							BMessage *specifier, int32 form,
42 							const char *property);
43 		virtual status_t	GetSupportedSuites(BMessage *data);
44 
45 		virtual status_t	Perform(perform_code code, void *arg);
46 
47 		virtual void		ResizeToPreferred();
48 		virtual void		GetPreferredSize(float *width, float *height);
49 		virtual void		MakeFocus(bool state = true);
50 		virtual void		AllAttached();
51 		virtual void		AllDetached();
52 
53 		void			SetAsyncAutoDestruct(bool state);
54 		bool			AsyncAutoDestruct() const;
55 
56 	protected:
57 		virtual	BPoint		ScreenLocation();
58 
59 		virtual	void		_ReservedPopUpMenu1();
60 		virtual	void		_ReservedPopUpMenu2();
61 		virtual	void		_ReservedPopUpMenu3();
62 
63 		BPopUpMenu	&operator=(const BPopUpMenu &);
64 
65 	private:
66 		BMenuItem	*_Go(BPoint where, bool autoInvoke, bool startOpened,
67 							BRect *specialRect, bool async);
68 		BMenuItem	*_StartTrack(BPoint where, bool autoInvoke,
69 						bool startOpened, BRect *specialRect);
70 		BMenuItem	*_WaitMenu(void *data);
71 
72 		static	int32	_thread_entry(void *);
73 
74 		BPoint		fWhere;
75 		bool		fUseWhere;
76 		bool		fAutoDestruct;
77 		bool		_fUnusedBool1;
78 		bool		_fUnusedBool2;
79 		thread_id	fTrackThread;
80 		uint32		_reserved[3];
81 };
82 
83 
84 #endif /* _POP_UP_MENU_H */
85