- SFG_MenuEntry* menuEntry;
- int x, y;
-
- /*
- * First of all check any of the active sub menus...
- */
- for( menuEntry = (SFG_MenuEntry *)menu->Entries.First; menuEntry;
- menuEntry = (SFG_MenuEntry *)menuEntry->Node.Next )
- {
- /*
- * Is that an active sub menu by any case?
- */
- if( menuEntry->SubMenu != NULL && menuEntry->IsActive == TRUE )
- {
- /*
- * OK, have the sub-menu checked, too. If it returns TRUE, it will mean
- * that it caught the mouse cursor and we do not need to regenerate
- * the activity list, and so our parents do...
- */
- GLboolean return_status = fghCheckMenuStatus( window, menuEntry->SubMenu ) ;
-
- /*
- * Reactivate the submenu as the checkMenuStatus may have turned it off if the mouse
- * is in its parent menu entry.
- */
- menuEntry->SubMenu->IsActive = TRUE ;
- if ( return_status == TRUE )
- return( TRUE );
- }
- }
-
- /*
- * That much about our sub menus, let's get to checking the current menu:
- */
- x = window->State.MouseX;
- y = window->State.MouseY;
-
- /*
- * Mark all menu entries inactive...
- */
- for( menuEntry = (SFG_MenuEntry *)menu->Entries.First; menuEntry;
- menuEntry = (SFG_MenuEntry *)menuEntry->Node.Next )
- {
- menuEntry->IsActive = FALSE;
- }
-
-
- menu->IsActive = FALSE;
-
- /*
- * Check if the mouse cursor is contained within the current menu box
- */
- if ( ( x >= FREEGLUT_MENU_BORDER ) && ( x < menu->Width - FREEGLUT_MENU_BORDER ) &&
- ( y >= FREEGLUT_MENU_BORDER ) && ( y < menu->Height - FREEGLUT_MENU_BORDER ) &&
- ( window == menu->Window ) )
- {
- /*
- * Calculation of the highlighted menu item is easy enough now:
- */
- int menuID = ( y - FREEGLUT_MENU_BORDER ) / FREEGLUT_MENU_HEIGHT ;
-
- /*
- * The mouse cursor is somewhere over our box, check it out.
- */
- menuEntry = fghFindMenuEntry( menu, menuID + 1 );
- assert( menuEntry != NULL );
-
- /*
- * Mark the menu as active...
- */
- menuEntry->IsActive = TRUE;
- menuEntry->Ordinal = menuID;