Exemplo n.º 1
0
  private void winMenu(MenuManager menuManager) {
    MenuManager fileMenu =
        new MenuManager(XdccBeeMessages.getString("Application_MENU_FILE")); // $NON-NLS-1$
    MenuManager helpMenu =
        new MenuManager(XdccBeeMessages.getString("Application_MENU_HELP")); // $NON-NLS-1$
    menuManager.add(fileMenu);
    menuManager.add(helpMenu);
    fileMenu.add(new ActionPreferences(getShell()));
    fileMenu.add(new ActionQuit(true));

    helpMenu.add(new ActionAbout(getShell()));
  }
Exemplo n.º 2
0
 private void makeTray() {
   Display display = window.getShell().getDisplay();
   final Tray tray = display.getSystemTray();
   if (tray == null) {
     // no tray
   } else {
     final TrayItem item = new TrayItem(tray, SWT.NONE);
     item.setToolTipText(XdccBeeMessages.getString("Application_TITLE"));
     final Menu menu = new Menu(window.getShell(), SWT.POP_UP);
     MenuItem mi = new MenuItem(menu, SWT.PUSH);
     mi.setText(XdccBeeMessages.getString("Application_TRAY_OPEN"));
     mi.addListener(
         SWT.Selection,
         new Listener() {
           public void handleEvent(Event event) {
             window.getShell().setVisible(true);
             window.getShell().setMinimized(false);
           }
         });
     menu.setDefaultItem(mi);
     item.addListener(
         SWT.MenuDetect,
         new Listener() {
           public void handleEvent(Event event) {
             menu.setVisible(true);
           }
         });
     item.addListener(
         SWT.Selection,
         new Listener() {
           public void handleEvent(Event event) {
             menu.setVisible(true);
           }
         });
     item.setImage(Images.WINDOW_ICON_LARGE);
   }
 }
Exemplo n.º 3
0
  @Override
  protected void configureShell(Shell newShell) {
    super.configureShell(newShell);
    /*
     * Provide different resolutions for icons to get high quality rendering
     * wherever the OS needs large icons. For example, the ALT+TAB window on
     * certain systems uses a larger icon.
     */
    newShell.setImages(
        new Image[] {
          Images.WINDOW_ICON_SMALL,
          Images.WINDOW_ICON_LARGE,
          Images.WINDOW_ICON_XLARGE,
          Images.WINDOW_ICON_XXLARGE
        });

    newShell.setText(XdccBeeMessages.getString("Application_TITLE")); // $NON-NLS-1$
    newShell.setSize(getSettings().getMainWindowSize());
    if (getSettings().getMainWindowPosition().x != 0
        || getSettings().getMainWindowPosition().y != 0) {
      newShell.setLocation(getSettings().getMainWindowPosition());
    } else {
      centerShell(newShell);
    }
    newShell.addDisposeListener(
        new DisposeListener() {
          @Override
          public void widgetDisposed(DisposeEvent e) {
            new ActionQuit(false).run();
          }
        });
    if (newShell.getDisplay().getSystemTray() != null && !isMac()) { // TODO:
      // Tray
      // for
      // mac?!
      // shellIconified
      // doesnt
      // work
      // under
      // mac
      newShell.addShellListener(
          new ShellAdapter() {
            public void shellIconified(ShellEvent e) {
              window.getShell().setVisible(false);
            }
          });
    }
  }
Exemplo n.º 4
0
  private void macMenu() {
    try {
      Listener listener =
          new Listener() {
            @Override
            public void handleEvent(Event event) {
              new ActionQuit(false).run();
            }
          };
      CocoaUIEnhancer enhancer =
          new CocoaUIEnhancer(XdccBeeMessages.getString("Application_TITLE")); // $NON-NLS-1$
      enhancer.hookApplicationMenu(
          getShell().getDisplay(),
          listener,
          new ActionAbout(getShell()),
          new ActionPreferences(getShell()));

    } catch (Throwable e) {
      throw new RuntimeException(e);
    }
  }