private static boolean isModal( Shell shell ) { return ( shell.getStyle() & SWT.APPLICATION_MODAL ) != 0; }
protected int[] getPolygon(boolean border) { Point e = getExtent(); int b = border ? 1 : 0; boolean isRTL = (popup.getStyle() & SWT.RIGHT_TO_LEFT) != 0; int ha1 = isRTL ? e.x - HAO : HAO + HAW; int ha2 = isRTL ? e.x - HAO - HAW / 2 : HAO + HAW / 2; int ha3 = isRTL ? e.x - HAO - HAW : HAO; int[] poly; poly = new int[] { 0, HAH, ha3 + b, HAH, ha2, b, ha1 - b, HAH, e.x - b, HAH, e.x - b, e.y + HAH - b, 0, e.y + HAH - b, 0, HAH }; return poly; }
@Override public String toString() { String style= (getShell().getStyle() & SWT.RESIZE) == 0 ? "fixed" : "resizeable"; //$NON-NLS-1$ //$NON-NLS-2$ return super.toString() + " - style: " + style; //$NON-NLS-1$ }
@Override public String toString() { String style= (getShell().getStyle() & SWT.RESIZE) == 0 ? "fixed" : "resizeable"; //$NON-NLS-1$ //$NON-NLS-2$ return super.toString() + " - style: " + style; //$NON-NLS-1$ }
public int getTitleBarHeight( Shell shell ) { int result = 0; if( ( shell.getStyle() & SWT.TITLE ) != 0 ) { result = getCssDimension( "Shell-Titlebar", "height", shell ); } return result; }
public BoxDimensions getTitleBarMargin( Shell shell ) { if( ( shell.getStyle() & SWT.TITLE ) != 0 ) { return getCssBoxDimensions( "Shell-Titlebar", "margin", shell ).dimensions; } return CssBoxDimensions.ZERO.dimensions; }
public static boolean isDisplayModal(Shell activeShell) { while (activeShell != null) { if ((activeShell.getStyle() & (SWT.APPLICATION_MODAL | SWT.PRIMARY_MODAL | SWT.SYSTEM_MODAL)) > 0) return true; activeShell = (Shell) activeShell.getParent(); } return false; }
/** * Returns a modal dialog currently open on the given shell or <code>null</code> if none. * * @param shell shell to check * @return a modal dialog currently open on the given shell or <code>null</code> if none */ private Shell getModalDialogOpen(Shell shell) { Shell[] shells = shell.getShells(); for (int i = 0; i < shells.length; i++) { Shell dialog = shells[i]; if ((dialog.getStyle() & (SWT.APPLICATION_MODAL | SWT.PRIMARY_MODAL | SWT.SYSTEM_MODAL)) > 0) { return dialog; } } return null; }
public static Shell findFirstShellWithStyle(int styles) { Display display = Display.getCurrent(); if (display != null) { Shell[] shells = display.getShells(); for (int i = 0; i < shells.length; i++) { Shell shell = shells[i]; int style = shell.getStyle(); if ((style & styles) == styles && !shell.isDisposed()) { return shell; } } } return null; }
void handleMouseDown () { int shellStyle = browser.getShell ().getStyle (); if ((shellStyle & SWT.ON_TOP) != 0 && (((shellStyle & SWT.NO_FOCUS) == 0) || ((browser.getStyle () & SWT.NO_FOCUS) == 0))) { browser.getDisplay ().asyncExec (new Runnable () { @Override public void run () { if (browser == null || browser.isDisposed ()) return; ((Mozilla)browser.webBrowser).Activate (); } }); } }
void handleMouseDown () { int shellStyle = browser.getShell ().getStyle (); if ((shellStyle & SWT.ON_TOP) != 0 && (((shellStyle & SWT.NO_FOCUS) == 0) || ((browser.getStyle () & SWT.NO_FOCUS) == 0))) { browser.getDisplay ().asyncExec (new Runnable () { @Override public void run () { if (browser == null || browser.isDisposed ()) return; ((Mozilla)browser.webBrowser).Activate (); } }); } }
void handleMouseDown () { int shellStyle = browser.getShell ().getStyle (); if ((shellStyle & SWT.ON_TOP) != 0 && (((shellStyle & SWT.NO_FOCUS) == 0) || ((browser.getStyle () & SWT.NO_FOCUS) == 0))) { browser.getDisplay ().asyncExec (new Runnable () { @Override public void run () { if (browser == null || browser.isDisposed ()) return; ((Mozilla)browser.webBrowser).Activate (); } }); } }
/** * {@inheritDoc} */ public void refresh() { String text= getInputText(fDescriptor); if (text != null && text.length() > 0) { if ((fBrowser.getShell().getStyle() & SWT.RIGHT_TO_LEFT) != 0) { final StringBuffer buffer= new StringBuffer(text); HTMLPrinter.insertStyles(buffer, new String[] { "direction:rtl", "overflow:hidden"}); //$NON-NLS-1$ //$NON-NLS-2$ text= buffer.toString(); } } fBrowser.setText(text); }
/** * @return * * @since 3.0.3.5 */ public static boolean anyShellHaveStyle(int styles) { Display display = Display.getCurrent(); if (display != null) { Shell[] shells = display.getShells(); for (int i = 0; i < shells.length; i++) { Shell shell = shells[i]; int style = shell.getStyle(); if ((style & styles) == styles) { return true; } } } return false; }
/** * Returns whether or not the help tray can handle the given shell. In some * cases the help tray is not appropriate for shells that are too short and * not resizable. In these cases infopops are used. * * @param shell the shell to check * @return whether or not the help tray is appropriate for the hsell */ public static boolean isAppropriateFor(Shell shell) { if (shell != null && !shell.isDisposed() && shell.isVisible()) { Object data = shell.getData(); return (data instanceof TrayDialog && (shell.getSize().y >= MINIMUM_HEIGHT || (shell.getStyle() & SWT.RESIZE) != 0)); } return false; }
private static void renderImage( Shell shell ) { if( ( shell.getStyle() & SWT.TITLE ) != 0 ) { Image image = shell.getImage(); if( image == null ) { Image[] defaultImages = shell.getImages(); if( defaultImages.length > 0 ) { image = defaultImages[0]; } } renderProperty( shell, PROP_IMAGE, image, null ); } }
@Override public Rectangle computeTrim() { Rectangle trim= super.computeTrim(); if (isResizable()) { boolean RTL= (getShell().getStyle() & SWT.RIGHT_TO_LEFT) != 0; if (RTL) { trim.x-= fgScrollBarSize.x; } trim.width+= fgScrollBarSize.x; trim.height+= fgScrollBarSize.y; } return trim; }
@Override public Rectangle computeTrim() { Rectangle trim= super.computeTrim(); if (isResizable()) { boolean RTL= (getShell().getStyle() & SWT.RIGHT_TO_LEFT) != 0; if (RTL) { trim.x-= fgScrollBarSize.x; } trim.width+= fgScrollBarSize.x; trim.height+= fgScrollBarSize.y; } return trim; }
@Override public void handleEvent(Event event) { Shell shell = Utils.getActiveShell(); if (null == shell || shell.isDisposed() || item.isDisposed()) { event.doit = false; return; } if (((shell.getStyle() & SWT.MIN) != 0)) { item.setEnabled(!shell.getMinimized()); } else { item.setEnabled(false); } } };
private static void writeImage( final Shell shell ) throws IOException { if( ( shell.getStyle() & SWT.TITLE ) != 0 ) { Image image = shell.getImage(); if( image == null ) { Image[] defaultImages = shell.getImages(); if( defaultImages.length > 0 ) { image = defaultImages[0]; } } if( WidgetLCAUtil.hasChanged( shell, PROP_IMAGE, image, null ) ) { JSWriter writer = JSWriter.getWriterFor( shell ); writer.set( JSConst.QX_FIELD_ICON, ImageFactory.getImagePath( image ) ); } } }