xref: /haiku/headers/private/interface/BMCPrivate.h (revision 040a81419dda83d1014e9dc94936a4cb3f027303)
1 /*
2  * Copyright 2001-2013 Haiku, Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Stephan Aßmus, superstippi@gmx.de
7  *		Marc Flerackers, mflerackers@androme.be
8  *		John Scipione, jscipione@gmail.com
9  */
10 #ifndef _BMC_PRIVATE_H
11 #define _BMC_PRIVATE_H
12 
13 
14 #include <BeBuild.h>
15 #include <MenuBar.h>
16 #include <MessageFilter.h>
17 
18 
19 static const float kVMargin = 2.0f;
20 
21 
22 class BMessageRunner;
23 
24 
25 class _BMCFilter_ : public BMessageFilter {
26 public:
27 								_BMCFilter_(BMenuField* menuField, uint32 what);
28 	virtual						~_BMCFilter_();
29 
30 	virtual	filter_result		Filter(BMessage* message, BHandler** handler);
31 
32 private:
33 			_BMCFilter_&		operator=(const _BMCFilter_&);
34 
35 			BMenuField*			fMenuField;
36 };
37 
38 
39 class _BMCMenuBar_ : public BMenuBar {
40 public:
41 								_BMCMenuBar_(BRect frame, bool fixedSize,
42 									BMenuField* menuField);
43 								_BMCMenuBar_(BMenuField* menuField);
44 								_BMCMenuBar_(BMessage* data);
45 	virtual						~_BMCMenuBar_();
46 
47 	static	BArchivable*		Instantiate(BMessage* data);
48 
49 	virtual	void				AttachedToWindow();
50 	virtual	void				Draw(BRect updateRect);
51 	virtual	void				FrameResized(float width, float height);
52 	virtual	void				MessageReceived(BMessage* msg);
53 	virtual	void				MakeFocus(bool focused = true);
54 	virtual	void				SetMaxContentWidth(float width);
55 
56 			void				TogglePopUpMarker(bool show)
57 									{ fShowPopUpMarker = show; }
58 			bool				IsPopUpMarkerShown() const
59 									{ return fShowPopUpMarker; }
60 
61 	virtual	BSize				MinSize();
62 	virtual	BSize				MaxSize();
63 
64 private:
65 								_BMCMenuBar_&operator=(const _BMCMenuBar_&);
66 
67 			void				_Init();
68 
69 			BMenuField*			fMenuField;
70 			bool				fFixedSize;
71 			BMessageRunner*		fRunner;
72 			bool				fShowPopUpMarker;
73 			float				fPreviousWidth;
74 };
75 
76 #endif // _BMC_PRIVATE_H
77