Fixed problem with some popup menus (check ticket #1679)
Moved GetMouse() calls near the check for exit conditions. Reorganized a bit the code, and hopefully simplified it in some places. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23229 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -8,8 +8,38 @@ enum menu_states {
|
||||
MENU_STATE_CLOSED = 5
|
||||
};
|
||||
|
||||
|
||||
extern const char *kEmptyMenuLabel;
|
||||
|
||||
|
||||
// Note: since sqrt is slow, we don't use it and return the square of the distance
|
||||
#define square(x) ((x) * (x))
|
||||
static inline float
|
||||
point_distance(const BPoint &pointA, const BPoint &pointB)
|
||||
{
|
||||
return square(pointA.x - pointB.x) + square(pointA.y - pointB.y);
|
||||
}
|
||||
|
||||
/*
|
||||
static float
|
||||
point_rect_distance(const BPoint &point, const BRect &rect)
|
||||
{
|
||||
float horizontal = 0;
|
||||
float vertical = 0;
|
||||
if (point.x < rect.left)
|
||||
horizontal = rect.left - point.x;
|
||||
else if (point.x > rect.right)
|
||||
horizontal = point.x - rect.right;
|
||||
|
||||
if (point.y < rect.top)
|
||||
vertical = rect.top - point.y;
|
||||
else if (point.y > rect.bottom)
|
||||
vertical = point.y - rect.bottom;
|
||||
|
||||
return square(horizontal) + square(vertical);
|
||||
}
|
||||
*/
|
||||
|
||||
#undef square
|
||||
|
||||
|
||||
#endif // __MENU_PRIVATE_H
|
||||
|
||||
@@ -25,6 +25,8 @@ class BMenuWindow : public BWindow {
|
||||
public:
|
||||
BMenuWindow(const char *name);
|
||||
virtual ~BMenuWindow();
|
||||
|
||||
virtual void DispatchMessage(BMessage *message, BHandler *handler);
|
||||
|
||||
void AttachMenu(BMenu *menu);
|
||||
void DetachMenu();
|
||||
|
||||
Reference in New Issue
Block a user