xref: /haiku/src/tests/kits/interface/menu/menuworld/MenuView.h (revision 3f28966548baf455f231941a6fbc83552119821d)
1 //--------------------------------------------------------------------
2 //
3 //	MenuView.h
4 //
5 //	Written by: Owen Smith
6 //
7 //--------------------------------------------------------------------
8 
9 /*
10 	Copyright 1999, Be Incorporated.   All Rights Reserved.
11 	This file may be used under the terms of the Be Sample Code License.
12 */
13 
14 #ifndef _MenuView_h
15 #define _MenuView_h
16 
17 
18 #include <View.h>
19 
20 class BButton;
21 class BListItem;
22 class BOutlineListView;
23 class BStringView;
24 class BTextControl;
25 //====================================================================
26 //	CLASS: MenuView
27 
28 class MenuView : public BView
29 {
30 	//----------------------------------------------------------------
31 	//	Constructors, destructors, operators
32 
33 public:
34 					MenuView(uint32 resizingMode);
35 
36 
37 	//----------------------------------------------------------------
38 	//	Virtual member function overrides
39 
40 public:
41 	void				MessageReceived(BMessage* message);
42 	void				AllAttached(void);
43 
44 
45 	//----------------------------------------------------------------
46 	//	Operations
47 public:
48 	void				PopulateUserMenu(BMenu* pMenu, int32 index);
49 
50 	//----------------------------------------------------------------
51 	//	Message handlers
52 
53 private:
54 	void				AddMenu(BMessage* message);
55 	void				DeleteMenu(BMessage* message);
56 	void				AddMenuItem(BMessage* message);
57 	void				MenuSelectionChanged(BMessage* message);
58 
59 
60 	//----------------------------------------------------------------
61 	//	Implementation member functions
62 
63 private:
64 	void				BuildMenuItems(BMenu* pMenu, BListItem* superitem,
65 							BOutlineListView* pView);
66 	bool				IsSeparator(const char* text) const;
67 	void				SetButtonState(void);
68 	bool				Valid(void);
69 
70 
71 	//----------------------------------------------------------------
72 	//	Member variables
73 
74 private:
75 	BTextControl*		m_pLabelCtrl;
76 	BCheckBox*			m_pHideUserCheck;
77 	BCheckBox*			m_pLargeTestIconCheck;
78 	BButton*			m_pAddMenuButton;
79 	BButton*			m_pDelButton;
80 	BButton*			m_pAddItemButton;
81 	BOutlineListView*	m_pMenuOutlineView;
82 	BScrollView*		m_pScrollView;
83 };
84 
85 #endif /* _MenuView_h */
86