xref: /haiku/src/kits/interface/MenuItemPrivate.cpp (revision 1e60bdeab63fa7a57bc9a55b032052e95a18bd2c)
1 /*
2  * Copyright 2016 Haiku, Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		John Scipione, jscipione@gmail.com
7  */
8 
9 
10 #include <MenuItemPrivate.h>
11 
12 #include <Menu.h>
13 
14 
15 namespace BPrivate {
16 
17 MenuItemPrivate::MenuItemPrivate(BMenuItem* menuItem)
18 	:
19 	fMenuItem(menuItem)
20 {
21 }
22 
23 
24 void
25 MenuItemPrivate::SetSubmenu(BMenu* submenu)
26 {
27 	delete fMenuItem->fSubmenu;
28 
29 	fMenuItem->_InitMenuData(submenu);
30 
31 	if (fMenuItem->fSuper != NULL) {
32 		fMenuItem->fSuper->InvalidateLayout();
33 
34 		if (fMenuItem->fSuper->LockLooper()) {
35 			fMenuItem->fSuper->Invalidate();
36 			fMenuItem->fSuper->UnlockLooper();
37 		}
38 	}
39 }
40 
41 
42 void
43 MenuItemPrivate::Install(BWindow* window)
44 {
45 	fMenuItem->Install(window);
46 }
47 
48 
49 void
50 MenuItemPrivate::Uninstall()
51 {
52 	fMenuItem->Uninstall();
53 }
54 
55 
56 }	// namespace BPrivate
57