< prev index next >

src/java.desktop/unix/classes/sun/awt/X11/XMenuWindow.java

Print this page




 261                 nextOffset += itemHeight;
 262                 item.map(bounds, textOrigin);
 263             } else {
 264                 //Text metrics could not be determined because of errors
 265                 //Map item with empty rectangle
 266                 Rectangle bounds = new Rectangle(WINDOW_SPACING_LEFT, nextOffset, 0, 0);
 267                 Point textOrigin = new Point(WINDOW_SPACING_LEFT + WINDOW_ITEM_MARGIN_LEFT + maxLeftIndent, nextOffset);
 268                 item.map(bounds, textOrigin);
 269             }
 270         }
 271         int height = nextOffset + WINDOW_SPACING_BOTTOM;
 272         MappingData mappingData = new MappingData(itemVector, captionRect, new Dimension(width, height), maxLeftIndent, shortcutOrigin, rightMarkOrigin);
 273         return mappingData;
 274     }
 275 
 276     /**
 277      * @see XBaseMenuWindow#getSubmenuBounds
 278      */
 279     protected Rectangle getSubmenuBounds(Rectangle itemBounds, Dimension windowSize) {
 280         Rectangle globalBounds = toGlobal(itemBounds);
 281         Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
 282         Rectangle res;
 283         res = fitWindowRight(globalBounds, windowSize, screenSize);
 284         if (res != null) {
 285             return res;
 286         }
 287         res = fitWindowBelow(globalBounds, windowSize, screenSize);
 288         if (res != null) {
 289             return res;
 290         }
 291         res = fitWindowAbove(globalBounds, windowSize, screenSize);
 292         if (res != null) {
 293             return res;
 294         }
 295         res = fitWindowLeft(globalBounds, windowSize, screenSize);
 296         if (res != null) {
 297             return res;
 298         }
 299         return fitWindowToScreen(windowSize, screenSize);
 300    }
 301 




 261                 nextOffset += itemHeight;
 262                 item.map(bounds, textOrigin);
 263             } else {
 264                 //Text metrics could not be determined because of errors
 265                 //Map item with empty rectangle
 266                 Rectangle bounds = new Rectangle(WINDOW_SPACING_LEFT, nextOffset, 0, 0);
 267                 Point textOrigin = new Point(WINDOW_SPACING_LEFT + WINDOW_ITEM_MARGIN_LEFT + maxLeftIndent, nextOffset);
 268                 item.map(bounds, textOrigin);
 269             }
 270         }
 271         int height = nextOffset + WINDOW_SPACING_BOTTOM;
 272         MappingData mappingData = new MappingData(itemVector, captionRect, new Dimension(width, height), maxLeftIndent, shortcutOrigin, rightMarkOrigin);
 273         return mappingData;
 274     }
 275 
 276     /**
 277      * @see XBaseMenuWindow#getSubmenuBounds
 278      */
 279     protected Rectangle getSubmenuBounds(Rectangle itemBounds, Dimension windowSize) {
 280         Rectangle globalBounds = toGlobal(itemBounds);
 281         Dimension screenSize = graphicsConfig.getBounds().getSize();        
 282         Rectangle res;
 283         res = fitWindowRight(globalBounds, windowSize, screenSize);
 284         if (res != null) {
 285             return res;
 286         }
 287         res = fitWindowBelow(globalBounds, windowSize, screenSize);
 288         if (res != null) {
 289             return res;
 290         }
 291         res = fitWindowAbove(globalBounds, windowSize, screenSize);
 292         if (res != null) {
 293             return res;
 294         }
 295         res = fitWindowLeft(globalBounds, windowSize, screenSize);
 296         if (res != null) {
 297             return res;
 298         }
 299         return fitWindowToScreen(windowSize, screenSize);
 300    }
 301 


< prev index next >