use of org.apache.pivot.wtk.MenuPopup in project pivot by apache.
the class TerraMenuPopupSkin method install.
@Override
public void install(Component component) {
super.install(component);
MenuPopup menuPopup = (MenuPopup) component;
menuPopup.getMenuPopupListeners().add(this);
menuPopup.getMenuPopupStateListeners().add(this);
Menu menu = menuPopup.getMenu();
if (menu != null) {
menu.getMenuItemSelectionListeners().add(menuItemSelectionListener);
}
panorama.setView(menu);
menuPopup.setContent(border);
// Attach the drop-shadow decorator
if (!themeIsFlat()) {
dropShadowDecorator = new DropShadowDecorator();
menuPopup.getDecorators().add(dropShadowDecorator);
}
}
use of org.apache.pivot.wtk.MenuPopup in project pivot by apache.
the class TerraMenuPopupSkin method windowOpened.
@Override
public void windowOpened(Window window) {
super.windowOpened(window);
Display display = window.getDisplay();
display.getContainerMouseListeners().add(displayMouseListener);
MenuPopup menuPopup = (MenuPopup) window;
Menu menu = menuPopup.getMenu();
if (menu != null) {
Menu.Item activeItem = menu.getActiveItem();
if (activeItem != null) {
activeItem.setActive(false);
}
menu.requestFocus();
}
panorama.setScrollTop(0);
// Always ensure that the menu popup fits on the display.
ApplicationContext.queueCallback(repositionCallback);
}
use of org.apache.pivot.wtk.MenuPopup in project pivot by apache.
the class TerraMenuPopupSkin method keyPressed.
/**
* {@link KeyCode#ESCAPE ESCAPE} Close the menu popup.
*/
@Override
public boolean keyPressed(Component component, int keyCode, Keyboard.KeyLocation keyLocation) {
boolean consumed = super.keyPressed(component, keyCode, keyLocation);
if (keyCode == Keyboard.KeyCode.ESCAPE) {
MenuPopup menuPopup = (MenuPopup) getComponent();
menuPopup.close();
}
return consumed;
}
Aggregations