Java Code Examples for org.eclipse.swt.SWT#SHADOW_OUT

The following examples show how to use org.eclipse.swt.SWT#SHADOW_OUT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ImageLabel.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Paint the Label's border.
 */
private void paintBorder( GC gc, Rectangle r )
{
	Display disp = getDisplay( );

	Color c1 = null;
	Color c2 = null;

	int style = getStyle( );
	if ( ( style & SWT.SHADOW_IN ) != 0 )
	{
		c1 = disp.getSystemColor( SWT.COLOR_WIDGET_NORMAL_SHADOW );
		c2 = disp.getSystemColor( SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW );
	}
	if ( ( style & SWT.SHADOW_OUT ) != 0 )
	{
		c1 = disp.getSystemColor( SWT.COLOR_WIDGET_LIGHT_SHADOW );
		c2 = disp.getSystemColor( SWT.COLOR_WIDGET_NORMAL_SHADOW );
	}

	if ( c1 != null && c2 != null )
	{
		gc.setLineWidth( 1 );
		drawBevelRect( gc, r.x, r.y, r.width - 1, r.height - 1, c1, c2 );
	}
}
 
Example 2
Source File: MonthCalendarableItemControl.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Paint the Label's border.
 */
private void paintBorder(GC gc, Rectangle r) {
	Display disp= getDisplay();

	Color c1 = null;
	Color c2 = null;
	
	int style = getStyle();
	if ((style & SWT.SHADOW_IN) != 0) {
		c1 = disp.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
		c2 = disp.getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW);
	}
	if ((style & SWT.SHADOW_OUT) != 0) {		
		c1 = disp.getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW);
		c2 = disp.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
	}
		
	if (c1 != null && c2 != null) {
		gc.setLineWidth(1);
		drawBevelRect(gc, r.x, r.y, r.width-1, r.height-1, c1, c2);
	}
}
 
Example 3
Source File: ColorPicker.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
public ColorPicker(Composite parent, final Color originalColor) {
    super(parent, SWT.SHADOW_OUT);
    if (originalColor == null) throw new IllegalArgumentException("null");
    this.selectedColor = originalColor;
    setImage(getColorImage(originalColor));
    addMouseListener(
            new MouseAdapter() {
                @Override
                public void mouseDown(MouseEvent e) {
                    ColorDialog dialog = new ColorDialog(new Shell(Display.getDefault(), SWT.SHELL_TRIM));
                    dialog.setRGB(selectedColor.getRGB());
                    RGB selected = dialog.open();
                    if (selected != null) {
                        update(selected);
                    }
                }
            });
}
 
Example 4
Source File: LiveSashForm.java    From http4e with Apache License 2.0 6 votes vote down vote up
private int shadowSizeForShadow(int shadow)
{
  switch(shadow)
  {
    case SWT.SHADOW_IN:
    case SWT.SHADOW_OUT:
      return 1;

    case SWT.SHADOW_ETCHED_IN:
    case SWT.SHADOW_ETCHED_OUT:
      return 2;

    default:
      return 0;
  }
}
 
Example 5
Source File: IoPreferencePage.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
private void createIlcdNetworkContents(Composite parent) {
	Group section = new Group(parent, SWT.SHADOW_OUT);
	section.setText(M.ILCDNetworkSettings);
	StringFieldEditor urlEditor = new StringFieldEditor(
			IoPreference.ILCD_URL, M.URL, section);
	addField(urlEditor);
	StringFieldEditor userEditor = new StringFieldEditor(
			IoPreference.ILCD_USER, M.User, section);
	addField(userEditor);
	StringFieldEditor passwordEditor = new StringFieldEditor(
			IoPreference.ILCD_PASSWORD, M.Password, section);
	passwordEditor.getTextControl(section).setEchoChar('*');
	addField(passwordEditor);
	UI.gridLayout(section, 2);
	UI.gridData(section, true, false);
}
 
Example 6
Source File: ColorPicker.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
public ColorPicker(Composite parent, final Color originalColor) {
    super(parent, SWT.SHADOW_OUT);
    if (originalColor == null) throw new IllegalArgumentException("null");
    this.selectedColor = originalColor;
    setImage(getColorImage(originalColor));
    addMouseListener(
            new MouseAdapter() {
                @Override
                public void mouseDown(MouseEvent e) {
                    ColorDialog dialog = new ColorDialog(new Shell(Display.getDefault(), SWT.SHELL_TRIM));
                    dialog.setRGB(selectedColor.getRGB());
                    RGB selected = dialog.open();
                    if (selected != null) {
                        update(selected);
                    }
                }
            });
}
 
Example 7
Source File: CustomSeparator.java    From http4e with Apache License 2.0 5 votes vote down vote up
private static int checkStyle( int style){
   int mask = SWT.SHADOW_IN | SWT.SHADOW_OUT | SWT.SHADOW_NONE | SWT.HORIZONTAL | SWT.VERTICAL;
   style &= mask;
   if ((style & (SWT.SHADOW_IN | SWT.SHADOW_OUT | SWT.SHADOW_NONE)) == 0)
      style |= SWT.SHADOW_IN;
   if ((style & (SWT.HORIZONTAL | SWT.VERTICAL)) == 0)
      style |= SWT.VERTICAL;
   return style;
}
 
Example 8
Source File: ComponentStatusLabel.java    From arx with Apache License 2.0 5 votes vote down vote up
/**
 * Checkstyle method.
 *
 * @param style
 * @return
 */
private static int checkStyle(int style) {
    if ((style & SWT.BORDER) != 0) style |= SWT.SHADOW_IN;
    int mask = SWT.SHADOW_IN | SWT.SHADOW_OUT | SWT.SHADOW_NONE | SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT;
    style = style & mask;
    return style |= SWT.NO_FOCUS | SWT.DOUBLE_BUFFERED;
}
 
Example 9
Source File: ImageLabel.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Check the style bits to ensure that no invalid styles are applied.
 */
private static int checkStyle( int style )
{
	if ( ( style & SWT.BORDER ) != 0 )
		style |= SWT.SHADOW_IN;
	int mask = SWT.SHADOW_IN
			| SWT.SHADOW_OUT
			| SWT.SHADOW_NONE
			| SWT.LEFT_TO_RIGHT
			| SWT.RIGHT_TO_LEFT;
	style = style & mask;
	style |= SWT.NO_FOCUS;
	if ( ( style & ( SWT.CENTER | SWT.RIGHT ) ) == 0 )
		style |= SWT.LEFT;
	// TEMPORARY CODE
	/*
	 * The default background on carbon and some GTK themes is not a solid
	 * color but a texture. To show the correct default background, we must
	 * allow the operating system to draw it and therefore, we can not use
	 * the NO_BACKGROUND style. The NO_BACKGROUND style is not required on
	 * platforms that use double buffering which is true in both of these
	 * cases.
	 */
	String platform = SWT.getPlatform( );
	if ( "carbon".equals( platform ) || "gtk".equals( platform ) )return style; //$NON-NLS-1$ //$NON-NLS-2$
	return style | SWT.NO_BACKGROUND;
}
 
Example 10
Source File: AccordionSubComposite.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
void onPaint( PaintEvent event )
{
	Rectangle rect = getClientArea( );
	if ( rect.width == 0 || rect.height == 0 )
		return;

	GC gc = event.gc;
	
	Rectangle r = getClientArea( );

	Display disp = getDisplay( );

	Color c1 = null;
	Color c2 = null;

	int style = getStyle( );
	if ( ( style & SWT.SHADOW_IN ) != 0 )
	{
		c1 = disp.getSystemColor( SWT.COLOR_WIDGET_NORMAL_SHADOW );
		c2 = disp.getSystemColor( SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW );
	}
	if ( ( style & SWT.SHADOW_OUT ) != 0 )
	{
		c1 = disp.getSystemColor( SWT.COLOR_WIDGET_LIGHT_SHADOW );
		c2 = disp.getSystemColor( SWT.COLOR_WIDGET_NORMAL_SHADOW );
	}

	if ( c1 != null && c2 != null )
	{
		gc.setLineWidth( 1 );
		drawBevelRect( gc, r.x, r.y, r.width - 1, r.height - 1, c1, c2 );
	}
	
}
 
Example 11
Source File: AccordionLabel.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Check the style bits to ensure that no invalid styles are applied.
 */
private static int checkStyle( int style )
{
	if ( ( style & SWT.BORDER ) != 0 )
		style |= SWT.SHADOW_IN;
	int mask = SWT.SHADOW_IN
			| SWT.SHADOW_OUT
			| SWT.SHADOW_NONE
			| SWT.LEFT_TO_RIGHT
			| SWT.RIGHT_TO_LEFT;
	style = style & mask;
	return style |= SWT.NO_FOCUS | SWT.DOUBLE_BUFFERED;
}
 
Example 12
Source File: HopGuiPipelineLogDelegate.java    From hop with Apache License 2.0 5 votes vote down vote up
private void addToolBar() {
  toolbar = new ToolBar( pipelineLogComposite, SWT.BORDER | SWT.WRAP | SWT.SHADOW_OUT | SWT.LEFT | SWT.HORIZONTAL );
  FormData fdToolBar = new FormData();
  fdToolBar.left = new FormAttachment( 0, 0 );
  fdToolBar.top = new FormAttachment( 0, 0 );
  fdToolBar.right = new FormAttachment( 100, 0 );
  toolbar.setLayoutData( fdToolBar );
  hopGui.getProps().setLook( toolbar, Props.WIDGET_STYLE_TOOLBAR );

  toolBarWidgets = new GuiToolbarWidgets();
  toolBarWidgets.registerGuiPluginObject( this );
  toolBarWidgets.createToolbarWidgets( toolbar, GUI_PLUGIN_TOOLBAR_PARENT_ID );
  toolbar.pack();
}
 
Example 13
Source File: IoPreferencePage.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
private void createIlcdOtherContents(Composite parent) {
	Group section = new Group(parent, SWT.SHADOW_OUT);
	section.setText(M.ILCDOtherSettings);
	ComboFieldEditor langEditor = new ComboFieldEditor(
			IoPreference.ILCD_LANG, M.Language, getLanguages(),
			section);
	addField(langEditor);
	UI.gridLayout(section, 2);
	UI.gridData(section, true, false);
}
 
Example 14
Source File: MonthCalendarableItemControl.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Check the style bits to ensure that no invalid styles are applied.
 */
private static int checkStyle (int style) {
	if ((style & SWT.BORDER) != 0) style |= SWT.SHADOW_IN;
	int mask = SWT.SHADOW_IN | SWT.SHADOW_OUT | SWT.SHADOW_NONE | SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT;
	style = style & mask;
	return style |= SWT.NO_FOCUS | SWT.DOUBLE_BUFFERED;
}
 
Example 15
Source File: HopGuiWorkflowLogDelegate.java    From hop with Apache License 2.0 5 votes vote down vote up
private void addToolBar() {
  toolbar = new ToolBar( jobLogComposite, SWT.BORDER | SWT.WRAP | SWT.SHADOW_OUT | SWT.LEFT | SWT.HORIZONTAL );
  FormData fdToolBar = new FormData();
  fdToolBar.left = new FormAttachment( 0, 0 );
  fdToolBar.top = new FormAttachment( 0, 0 );
  fdToolBar.right = new FormAttachment( 100, 0 );
  toolbar.setLayoutData( fdToolBar );
  hopGui.getProps().setLook( toolbar, Props.WIDGET_STYLE_TOOLBAR );

  toolBarWidgets = new GuiToolbarWidgets();
  toolBarWidgets.registerGuiPluginObject( this );
  toolBarWidgets.createToolbarWidgets( toolbar, GUI_PLUGIN_TOOLBAR_PARENT_ID );
  toolbar.pack();
}
 
Example 16
Source File: HopGuiPipelineGridDelegate.java    From hop with Apache License 2.0 5 votes vote down vote up
private void addToolBar() {

    toolbar = new ToolBar( pipelineGridComposite, SWT.BORDER | SWT.WRAP | SWT.SHADOW_OUT | SWT.LEFT | SWT.HORIZONTAL );
    FormData fdToolBar = new FormData();
    fdToolBar.left = new FormAttachment( 0, 0 );
    fdToolBar.top = new FormAttachment( 0, 0 );
    fdToolBar.right = new FormAttachment( 100, 0 );
    toolbar.setLayoutData( fdToolBar );
    hopGui.getProps().setLook( toolbar, Props.WIDGET_STYLE_TOOLBAR );

    toolbarWidget = new GuiToolbarWidgets();
    toolbarWidget.registerGuiPluginObject( this );
    toolbarWidget.createToolbarWidgets( toolbar, GUI_PLUGIN_TOOLBAR_PARENT_ID );
    toolbar.pack();
  }
 
Example 17
Source File: BuilderGeneratorPreferences.java    From SparkBuilderGenerator with MIT License 4 votes vote down vote up
private void createSeparatorLine(Composite parent) {
    Label label = new Label(parent, SWT.SEPARATOR | SWT.SHADOW_OUT | SWT.HORIZONTAL);
    label.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 3, 1));
}
 
Example 18
Source File: LiveSashForm.java    From http4e with Apache License 2.0 4 votes vote down vote up
private static int checkStyle(int style)
{
  int mask = SWT.BORDER | SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT | SWT.SHADOW_OUT;
  return (style & mask) | SWT.NO_BACKGROUND;
}
 
Example 19
Source File: N4IDEXpectView.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void createPartControl(Composite parent) {

	FillLayout fillLayout = new FillLayout(SWT.VERTICAL);
	fillLayout.marginHeight = 5;
	fillLayout.marginWidth = 5;
	parent.setLayout(fillLayout);

	// main container
	container = new Composite(parent, SWT.BORDER);
	container.setLayout(new FillLayout());

	// create container for stack trace data
	Composite stacktraceDataContainer = new Composite(parent, SWT.BORDER);

	FormLayout formLayout = new FormLayout();
	formLayout.marginHeight = 5;
	formLayout.marginWidth = 5;
	formLayout.spacing = 5;
	stacktraceDataContainer.setLayout(formLayout);

	Composite stackLabelContainer = new Composite(stacktraceDataContainer, SWT.NO_SCROLL | SWT.SHADOW_NONE);
	stackLabelContainer.setLayout(new GridLayout());

	FormData stackLabelFormData = new FormData();
	stackLabelFormData.top = new FormAttachment(0);
	stackLabelFormData.left = new FormAttachment(0);
	stackLabelFormData.right = new FormAttachment(100);
	stackLabelFormData.bottom = new FormAttachment(20);
	stackLabelContainer.setLayoutData(stackLabelFormData);

	Composite stackTraceContainer = new Composite(stacktraceDataContainer, SWT.NO_SCROLL | SWT.SHADOW_NONE);
	stackTraceContainer.setLayout(new FillLayout());

	FormData stackTraceFormData = new FormData();
	stackTraceFormData.top = new FormAttachment(stackLabelContainer);
	stackTraceFormData.left = new FormAttachment(0);
	stackTraceFormData.right = new FormAttachment(100);
	stackTraceFormData.bottom = new FormAttachment(100);
	stackTraceContainer.setLayoutData(stackTraceFormData);

	// Create viewer for test tree in main container
	testTreeViewer = new TreeViewer(container);
	testTreeViewer.setContentProvider(new XpectContentProvider());
	testTreeViewer.setLabelProvider(new XpectLabelProvider(this.testsExecutionStatus));
	testTreeViewer.setInput(null);

	// create stack trace label
	stacktraceLabel = new Label(stackLabelContainer, SWT.SHADOW_OUT);
	FontData fontData = stacktraceLabel.getFont().getFontData()[0];
	Display display = Display.getCurrent();
	// may be null if outside the UI thread
	if (display == null)
		display = Display.getDefault();
	Font font = new Font(display, new FontData(fontData.getName(), fontData
			.getHeight(), SWT.BOLD));
	// Make stack trace label bold
	stacktraceLabel.setFont(font);

	stacktraceLabel.setText(NO_TRACE_MSG);

	// create stack trace console
	MessageConsole messageConsole = new MessageConsole("trace", null);
	stacktraceConsole = new TraceConsole(messageConsole);
	stacktraceConsoleViewer = new TextConsoleViewer(stackTraceContainer, messageConsole);

	// context menu
	getSite().setSelectionProvider(testTreeViewer);
	MenuManager contextMenu = new MenuManager();
	contextMenu.setRemoveAllWhenShown(true);
	getSite().registerContextMenu(contextMenu, testTreeViewer);
	Control control = testTreeViewer.getControl();
	Menu menu = contextMenu.createContextMenu(control);
	control.setMenu(menu);
	activateContext();

	createSelectionActions();

}
 
Example 20
Source File: ImageLabel.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
void onPaint( PaintEvent event )
{
	Rectangle rect = getClientArea( );
	if ( rect.width == 0 || rect.height == 0 )
		return;

	Image img = image;
	Point extent = getTotalSize( img );

	GC gc = event.gc;

	// determine horizontal position
	int x = rect.x + hIndent;
	if ( align == SWT.CENTER )
	{
		x = ( rect.width - extent.x ) / 2;
	}
	if ( align == SWT.RIGHT )
	{
		x = rect.width - extent.x - hIndent;
	}

	if ( this.backgroundColor != null )
	{
		Color oldBackground = gc.getBackground( );
		gc.setBackground( backgroundColor );
		gc.fillRectangle( 0, 0, rect.width, rect.height );
		gc.setBackground( oldBackground );
	}
	else
	{
		if ( ( getStyle( ) & SWT.NO_BACKGROUND ) != 0 )
		{
			gc.setBackground( getBackground( ) );
			gc.fillRectangle( rect );
		}
	}

	// draw border
	int style = getStyle( );
	if ( ( style & SWT.SHADOW_IN ) != 0 || ( style & SWT.SHADOW_OUT ) != 0 )
	{
		paintBorder( gc, rect );
	}
	// draw the image
	if ( img != null )
	{
		Rectangle imageRect = img.getBounds( );
		if ( this.isFocusControl( ) )
		{

			ImageData data = img.getImageData( );
			PaletteData palette = new PaletteData( new RGB[]{
					this.getDisplay( )
							.getSystemColor( SWT.COLOR_WHITE )
							.getRGB( ),
					this.getDisplay( )
							.getSystemColor( SWT.COLOR_LIST_SELECTION )
							.getRGB( ),
			} );
			ImageData sourceData = new ImageData( data.width,
					data.height,
					1,
					palette );
			for ( int i = 0; i < data.width; i++ )
			{
				for ( int j = 0; j < data.height; j++ )
				{
					if ( data.getPixel( i, j ) != data.transparentPixel )
						sourceData.setPixel( i, j, 1 );
				}
			}

			Image highlightImage = new Image( this.getDisplay( ),
					sourceData );

			gc.drawImage( highlightImage,
					0,
					0,
					imageRect.width,
					imageRect.height,
					x,
					( rect.height - imageRect.height ) / 2,
					rect.width - 10,
					imageRect.height );
			highlightImage.dispose( );
		}
		else
			gc.drawImage( img,
					0,
					0,
					imageRect.width,
					imageRect.height,
					x,
					( rect.height - imageRect.height ) / 2,
					rect.width - 10,
					imageRect.height );
		x += imageRect.width;
	}
}