Implemented BMenu::OkToProceed() and used it correctly in BMenu::AttachedToWindow(). For some reason, though, I had to comment it out partially as something is wrong. I haven't debugged, though

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16899 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2006-03-27 19:43:05 +00:00
parent 1e7392d78b
commit f356aedc02

View File

@ -7,6 +7,7 @@
* Stefano Ceccherini (burton666@libero.it)
*/
#include <stdio.h>
#include <string.h>
#include <Debug.h>
@ -264,9 +265,11 @@ BMenu::AttachedToWindow()
free(chars);
free(keys);
BMenuItem *superItem = Superitem();
BMenu *superMenu = Supermenu();
if (AddDynamicItem(B_INITIAL_ADD)) {
do {
if (!OkToProceed(NULL)) {
if (superMenu != NULL && !superMenu->OkToProceed(superItem)) {
AddDynamicItem(B_ABORT);
fAttachAborted = true;
break;
@ -1873,10 +1876,19 @@ BMenu::RedrawAfterSticky(BRect bounds)
bool
BMenu::OkToProceed(BMenuItem* item)
{
// ToDo: test if the window could be closed again already
// ToDo: for now
return true;
bool proceed = true;
BPoint where;
ulong buttons;
GetMouse(&where, &buttons, false);
ConvertToScreen(&where);
// Quit if user releases the mouse button or moves
// the pointer over another item
// TODO: For some reason, this doesn't work
if (buttons == 0 /*|| HitTestItems(where) != item*/)
proceed = false;
return proceed;
}