Make UEFI boot-platform build again
[haiku.git] / headers / private / interface / MenuPrivate.h
blobced35555b20047ad535647411e97ff8935c98085
1 /*
2 * Copyright 2006-2015 Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Stefano Ceccherini (stefano.ceccherini@gmail.com)
7 */
9 #ifndef __MENU_PRIVATE_H
10 #define __MENU_PRIVATE_H
13 #include <Menu.h>
16 enum menu_states {
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,
21 MENU_STATE_CLOSED = 5
25 class BBitmap;
26 class BMenu;
27 class BWindow;
30 namespace BPrivate {
32 extern const char* kEmptyMenuLabel;
34 class MenuPrivate {
35 public:
36 MenuPrivate(BMenu* menu);
38 menu_layout Layout() const;
39 void SetLayout(menu_layout layout);
41 void ItemMarked(BMenuItem* item);
42 void CacheFontInfo();
44 float FontHeight() const;
45 float Ascent() const;
46 BRect Padding() const;
47 void GetItemMargins(float*, float*, float*, float*)
48 const;
49 void SetItemMargins(float, float, float, float);
51 int State(BMenuItem** item = NULL) const;
53 void Install(BWindow* window);
54 void Uninstall();
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();
69 private:
70 BMenu* fMenu;
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
84 // distance
85 #define square(x) ((x) * (x))
86 static inline float
87 point_distance(const BPoint &pointA, const BPoint &pointB)
89 return square(pointA.x - pointB.x) + square(pointA.y - pointB.y);
91 #undef square
94 #endif // __MENU_PRIVATE_H