470 openMenu.show();
471 }
472 }
473
474 private void setFocusedMenuIndex(int index) {
475 this.focusedMenuIndex = index;
476 focusedMenu = index == -1 ? null : getSkinnable().getMenus().get(index);
477
478 if (focusedMenu != null && focusedMenuIndex != -1) {
479 openMenuButton = (MenuBarButton)container.getChildren().get(focusedMenuIndex);
480 openMenuButton.setHover();
481 }
482 }
483
484
485
486 /***************************************************************************
487 * *
488 * Static methods *
489 * *
490 **************************************************************************/
491
492 // RT-22480: This is intended as private API for SceneBuilder,
493 // pending fix for RT-19857: Keeping menu in the Mac menu bar when
494 // there is no more stage
495 public static void setDefaultSystemMenuBar(final MenuBar menuBar) {
496 if (Toolkit.getToolkit().getSystemMenu().isSupported()) {
497 wrappedDefaultMenus.clear();
498 for (Menu menu : menuBar.getMenus()) {
499 wrappedDefaultMenus.add(GlobalMenuAdapter.adapt(menu));
500 }
501 menuBar.getMenus().addListener((ListChangeListener<Menu>) c -> {
502 wrappedDefaultMenus.clear();
503 for (Menu menu : menuBar.getMenus()) {
504 wrappedDefaultMenus.add(GlobalMenuAdapter.adapt(menu));
505 }
506 });
507 }
508 }
509
1196 new ArrayList<CssMetaData<? extends Styleable, ?>>(SkinBase.getClassCssMetaData());
1197
1198 // StackPane also has -fx-alignment. Replace it with
1199 // MenuBarSkin's.
1200 // TODO: Really should be able to reference StackPane.StyleableProperties.ALIGNMENT
1201 final String alignmentProperty = ALIGNMENT.getProperty();
1202 for (int n=0, nMax=styleables.size(); n<nMax; n++) {
1203 final CssMetaData<?,?> prop = styleables.get(n);
1204 if (alignmentProperty.equals(prop.getProperty())) styleables.remove(prop);
1205 }
1206
1207 styleables.add(SPACING);
1208 styleables.add(ALIGNMENT);
1209 STYLEABLES = Collections.unmodifiableList(styleables);
1210
1211 }
1212
1213 /**
1214 * Returns the CssMetaData associated with this class, which may include the
1215 * CssMetaData of its superclasses.
1216 */
1217 public static List<CssMetaData<? extends Styleable, ?>> getClassCssMetaData() {
1218 return STYLEABLES;
1219 }
1220
1221 /**
1222 * {@inheritDoc}
1223 */
1224 @Override
1225 public List<CssMetaData<? extends Styleable, ?>> getCssMetaData() {
1226 return getClassCssMetaData();
1227 }
1228
1229 /***************************************************************************
1230 * *
1231 * Accessibility handling *
1232 * *
1233 **************************************************************************/
1234
1235 /** {@inheritDoc} */
|
470 openMenu.show();
471 }
472 }
473
474 private void setFocusedMenuIndex(int index) {
475 this.focusedMenuIndex = index;
476 focusedMenu = index == -1 ? null : getSkinnable().getMenus().get(index);
477
478 if (focusedMenu != null && focusedMenuIndex != -1) {
479 openMenuButton = (MenuBarButton)container.getChildren().get(focusedMenuIndex);
480 openMenuButton.setHover();
481 }
482 }
483
484
485
486 /***************************************************************************
487 * *
488 * Static methods *
489 * *
490 * @param menuBar the menu bar
491 **************************************************************************/
492
493 // RT-22480: This is intended as private API for SceneBuilder,
494 // pending fix for RT-19857: Keeping menu in the Mac menu bar when
495 // there is no more stage
496 public static void setDefaultSystemMenuBar(final MenuBar menuBar) {
497 if (Toolkit.getToolkit().getSystemMenu().isSupported()) {
498 wrappedDefaultMenus.clear();
499 for (Menu menu : menuBar.getMenus()) {
500 wrappedDefaultMenus.add(GlobalMenuAdapter.adapt(menu));
501 }
502 menuBar.getMenus().addListener((ListChangeListener<Menu>) c -> {
503 wrappedDefaultMenus.clear();
504 for (Menu menu : menuBar.getMenus()) {
505 wrappedDefaultMenus.add(GlobalMenuAdapter.adapt(menu));
506 }
507 });
508 }
509 }
510
1197 new ArrayList<CssMetaData<? extends Styleable, ?>>(SkinBase.getClassCssMetaData());
1198
1199 // StackPane also has -fx-alignment. Replace it with
1200 // MenuBarSkin's.
1201 // TODO: Really should be able to reference StackPane.StyleableProperties.ALIGNMENT
1202 final String alignmentProperty = ALIGNMENT.getProperty();
1203 for (int n=0, nMax=styleables.size(); n<nMax; n++) {
1204 final CssMetaData<?,?> prop = styleables.get(n);
1205 if (alignmentProperty.equals(prop.getProperty())) styleables.remove(prop);
1206 }
1207
1208 styleables.add(SPACING);
1209 styleables.add(ALIGNMENT);
1210 STYLEABLES = Collections.unmodifiableList(styleables);
1211
1212 }
1213
1214 /**
1215 * Returns the CssMetaData associated with this class, which may include the
1216 * CssMetaData of its superclasses.
1217 * @return the CssMetaData associated with this class, which may include the
1218 * CssMetaData of its superclasses
1219 */
1220 public static List<CssMetaData<? extends Styleable, ?>> getClassCssMetaData() {
1221 return STYLEABLES;
1222 }
1223
1224 /**
1225 * {@inheritDoc}
1226 */
1227 @Override
1228 public List<CssMetaData<? extends Styleable, ?>> getCssMetaData() {
1229 return getClassCssMetaData();
1230 }
1231
1232 /***************************************************************************
1233 * *
1234 * Accessibility handling *
1235 * *
1236 **************************************************************************/
1237
1238 /** {@inheritDoc} */
|