xref: /haiku/headers/os/interface/PopUpMenu.h (revision 4f00613311d0bd6b70fa82ce19931c41f071ea4e)
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,
83 							bool autoInvoke,
84 							bool start_opened,
85 							BRect *special_rect,
86 							bool async);
87 static	int32		entry(void *);
88 		BMenuItem	*start_track(BPoint where,
89 								bool autoInvoke,
90 								bool start_opened,
91 								BRect *special_rect);
92 
93 		BPoint		fWhere;
94 		bool		fUseWhere;
95 		bool		fAutoDestruct;
96 		bool		_fUnusedBool1;
97 		bool		_fUnusedBool2;
98 		thread_id	fTrackThread;
99 		uint32		_reserved[3];
100 };
101 
102 /*-------------------------------------------------------------*/
103 /*-------------------------------------------------------------*/
104 
105 #endif /* _POP_UP_MENU_H */
106