2 * Copyright 2006-2015 Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
6 * Stefano Ceccherini (stefano.ceccherini@gmail.com)
9 #ifndef __MENU_PRIVATE_H
10 #define __MENU_PRIVATE_H
17 MENU_STATE_TRACKING
= 0,
18 MENU_STATE_TRACKING_SUBMENU
= 1,
19 MENU_STATE_KEY_TO_SUBMENU
= 2,
20 MENU_STATE_KEY_LEAVE_SUBMENU
= 3,
32 extern const char* kEmptyMenuLabel
;
36 MenuPrivate(BMenu
* menu
);
38 menu_layout
Layout() const;
39 void SetLayout(menu_layout layout
);
41 void ItemMarked(BMenuItem
* item
);
44 float FontHeight() const;
46 BRect
Padding() const;
47 void GetItemMargins(float*, float*, float*, float*)
49 void SetItemMargins(float, float, float, float);
51 int State(BMenuItem
** item
= NULL
) const;
53 void Install(BWindow
* window
);
55 void SetSuper(BMenu
* menu
);
56 void SetSuperItem(BMenuItem
* item
);
57 void InvokeItem(BMenuItem
* item
, bool now
= false);
58 void QuitTracking(bool thisMenuOnly
= true);
60 static status_t
CreateBitmaps();
61 static void DeleteBitmaps();
63 static const BBitmap
* MenuItemShift();
64 static const BBitmap
* MenuItemControl();
65 static const BBitmap
* MenuItemOption();
66 static const BBitmap
* MenuItemCommand();
67 static const BBitmap
* MenuItemMenu();
72 static BBitmap
* sMenuItemShift
;
73 static BBitmap
* sMenuItemControl
;
74 static BBitmap
* sMenuItemOption
;
75 static BBitmap
* sMenuItemAlt
;
76 static BBitmap
* sMenuItemMenu
;
80 }; // namespace BPrivate
83 // Note: since sqrt is slow, we don't use it and return the square of the
85 #define square(x) ((x) * (x))
87 point_distance(const BPoint
&pointA
, const BPoint
&pointB
)
89 return square(pointA
.x
- pointB
.x
) + square(pointA
.y
- pointB
.y
);
94 #endif // __MENU_PRIVATE_H