xref: /haiku/headers/os/interface/PopUpMenu.h (revision 1acbe440b8dd798953bec31d18ee589aa3f71b73)
1 /*******************************************************************************
2 /
3 /	File:			PopUpMenu.h
4 /
5 /   Description:    BPopUpMenu represents a menu that pops up when you
6 /                   activate it.
7 /
8 /	Copyright 1994-98, Be Incorporated, All Rights Reserved
9 /
10 *******************************************************************************/
11 
12 #ifndef _POP_UP_MENU_H
13 #define _POP_UP_MENU_H
14 
15 #include <BeBuild.h>
16 #include <Menu.h>
17 
18 /*----------------------------------------------------------------*/
19 /*----- BPopUpMenu class -----------------------------------------*/
20 
21 class BPopUpMenu : public BMenu
22 {
23 public:
24 					BPopUpMenu(	const char *title,
25 								bool radioMode = true,
26 								bool autoRename = true,
27 								menu_layout layout = B_ITEMS_IN_COLUMN
28 								);
29 					BPopUpMenu(BMessage *data);
30 virtual				~BPopUpMenu();
31 virtual status_t	Archive(BMessage *data, bool deep = true) const;
32 static	BArchivable	*Instantiate(BMessage *data);
33 
34 		BMenuItem	*Go(BPoint where,
35 						bool delivers_message = false,
36 						bool open_anyway = false,
37 						bool async = false);
38 		BMenuItem	*Go(BPoint where,
39 						bool delivers_message,
40 						bool open_anyway,
41 						BRect click_to_open,
42 						bool async = false);
43 
44 virtual void		MessageReceived(BMessage *msg);
45 virtual	void		MouseDown(BPoint pt);
46 virtual	void		MouseUp(BPoint pt);
47 virtual	void		MouseMoved(BPoint pt, uint32 code, const BMessage *msg);
48 virtual	void		AttachedToWindow();
49 virtual	void		DetachedFromWindow();
50 virtual	void		FrameMoved(BPoint new_position);
51 virtual	void		FrameResized(float new_width, float new_height);
52 
53 virtual BHandler	*ResolveSpecifier(BMessage *msg,
54 									int32 index,
55 									BMessage *specifier,
56 									int32 form,
57 									const char *property);
58 virtual status_t	GetSupportedSuites(BMessage *data);
59 
60 virtual status_t	Perform(perform_code d, void *arg);
61 
62 virtual void		ResizeToPreferred();
63 virtual void		GetPreferredSize(float *width, float *height);
64 virtual void		MakeFocus(bool state = true);
65 virtual void		AllAttached();
66 virtual void		AllDetached();
67 
68 		void		SetAsyncAutoDestruct(bool state);
69 		bool		AsyncAutoDestruct() const;
70 
71 protected:
72 virtual	BPoint		ScreenLocation();
73 
74 virtual	void		_ReservedPopUpMenu1();
75 virtual	void		_ReservedPopUpMenu2();
76 virtual	void		_ReservedPopUpMenu3();
77 
78 		BPopUpMenu	&operator=(const BPopUpMenu &);
79 
80 /*----- Private or reserved -----------------------------------------*/
81 private:
82 		BMenuItem	*_Go(BPoint where, bool autoInvoke, bool startOpened,
83 							BRect *specialRect, bool async);
84 		BMenuItem	*_StartTrack(BPoint where, bool autoInvoke, bool startOpened, BRect *specialRect);
85 		BMenuItem	*_WaitMenu(void *data);
86 
87 static	int32	_thread_entry(void *);
88 
89 		BPoint		fWhere;
90 		bool		fUseWhere;
91 		bool		fAutoDestruct;
92 		bool		_fUnusedBool1;
93 		bool		_fUnusedBool2;
94 		thread_id	fTrackThread;
95 		uint32		_reserved[3];
96 };
97 
98 /*-------------------------------------------------------------*/
99 /*-------------------------------------------------------------*/
100 
101 #endif /* _POP_UP_MENU_H */
102