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:
@@ -7,6 +7,7 @@
|
|||||||
* Stefano Ceccherini ([email protected])
|
* Stefano Ceccherini ([email protected])
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <Debug.h>
|
#include <Debug.h>
|
||||||
@@ -264,9 +265,11 @@ BMenu::AttachedToWindow()
|
|||||||
free(chars);
|
free(chars);
|
||||||
free(keys);
|
free(keys);
|
||||||
|
|
||||||
|
BMenuItem *superItem = Superitem();
|
||||||
|
BMenu *superMenu = Supermenu();
|
||||||
if (AddDynamicItem(B_INITIAL_ADD)) {
|
if (AddDynamicItem(B_INITIAL_ADD)) {
|
||||||
do {
|
do {
|
||||||
if (!OkToProceed(NULL)) {
|
if (superMenu != NULL && !superMenu->OkToProceed(superItem)) {
|
||||||
AddDynamicItem(B_ABORT);
|
AddDynamicItem(B_ABORT);
|
||||||
fAttachAborted = true;
|
fAttachAborted = true;
|
||||||
break;
|
break;
|
||||||
@@ -1873,10 +1876,19 @@ BMenu::RedrawAfterSticky(BRect bounds)
|
|||||||
bool
|
bool
|
||||||
BMenu::OkToProceed(BMenuItem* item)
|
BMenu::OkToProceed(BMenuItem* item)
|
||||||
{
|
{
|
||||||
// ToDo: test if the window could be closed again already
|
bool proceed = true;
|
||||||
|
BPoint where;
|
||||||
// ToDo: for now
|
ulong buttons;
|
||||||
return true;
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user