279 int y = (maxHeight + dim.height) / 2 - metrics.getTextBaseline();
280 Point textOrigin = new Point(nextOffset + BAR_ITEM_MARGIN_LEFT, BAR_SPACING_TOP + BAR_ITEM_MARGIN_TOP + y);
281 nextOffset += itemWidth + BAR_ITEM_SPACING;
282 item.map(bounds, textOrigin);
283 } else {
284 Rectangle bounds = new Rectangle(nextOffset, BAR_SPACING_TOP, 0, 0);
285 Point textOrigin = new Point(nextOffset + BAR_ITEM_MARGIN_LEFT, BAR_SPACING_TOP + BAR_ITEM_MARGIN_TOP);
286 }
287 }
288 XMenuItemPeer mappedVector[] = new XMenuItemPeer[mappedCnt];
289 System.arraycopy(itemVector, 0, mappedVector, 0, mappedCnt);
290 MappingData mappingData = new MappingData(mappedVector, BAR_SPACING_TOP + itemHeight + BAR_SPACING_BOTTOM);
291 return mappingData;
292 }
293
294 /**
295 * @see XBaseMenuWindow#getSubmenuBounds
296 */
297 protected Rectangle getSubmenuBounds(Rectangle itemBounds, Dimension windowSize) {
298 Rectangle globalBounds = toGlobal(itemBounds);
299 Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
300 Rectangle res;
301 res = fitWindowBelow(globalBounds, windowSize, screenSize);
302 if (res != null) {
303 return res;
304 }
305 res = fitWindowAbove(globalBounds, windowSize, screenSize);
306 if (res != null) {
307 return res;
308 }
309 res = fitWindowRight(globalBounds, windowSize, screenSize);
310 if (res != null) {
311 return res;
312 }
313 res = fitWindowLeft(globalBounds, windowSize, screenSize);
314 if (res != null) {
315 return res;
316 }
317 return fitWindowToScreen(windowSize, screenSize);
318 }
319
|
279 int y = (maxHeight + dim.height) / 2 - metrics.getTextBaseline();
280 Point textOrigin = new Point(nextOffset + BAR_ITEM_MARGIN_LEFT, BAR_SPACING_TOP + BAR_ITEM_MARGIN_TOP + y);
281 nextOffset += itemWidth + BAR_ITEM_SPACING;
282 item.map(bounds, textOrigin);
283 } else {
284 Rectangle bounds = new Rectangle(nextOffset, BAR_SPACING_TOP, 0, 0);
285 Point textOrigin = new Point(nextOffset + BAR_ITEM_MARGIN_LEFT, BAR_SPACING_TOP + BAR_ITEM_MARGIN_TOP);
286 }
287 }
288 XMenuItemPeer mappedVector[] = new XMenuItemPeer[mappedCnt];
289 System.arraycopy(itemVector, 0, mappedVector, 0, mappedCnt);
290 MappingData mappingData = new MappingData(mappedVector, BAR_SPACING_TOP + itemHeight + BAR_SPACING_BOTTOM);
291 return mappingData;
292 }
293
294 /**
295 * @see XBaseMenuWindow#getSubmenuBounds
296 */
297 protected Rectangle getSubmenuBounds(Rectangle itemBounds, Dimension windowSize) {
298 Rectangle globalBounds = toGlobal(itemBounds);
299 Dimension screenSize = graphicsConfig.getBounds().getSize();
300 Rectangle res;
301 res = fitWindowBelow(globalBounds, windowSize, screenSize);
302 if (res != null) {
303 return res;
304 }
305 res = fitWindowAbove(globalBounds, windowSize, screenSize);
306 if (res != null) {
307 return res;
308 }
309 res = fitWindowRight(globalBounds, windowSize, screenSize);
310 if (res != null) {
311 return res;
312 }
313 res = fitWindowLeft(globalBounds, windowSize, screenSize);
314 if (res != null) {
315 return res;
316 }
317 return fitWindowToScreen(windowSize, screenSize);
318 }
319
|