[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Problems with controls background laid on Group, relevant only for Mac

Hello everybody!

We have faced such problem under Mac platform: if some control, except of Text, is laid on Group this control saves 25% of own background color.


Here is the source code

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;

public class MacBackgroundDemo {

  public static void main(final String[] args) {

    final Display display = new Display();
    final Shell shell = new Shell(display);
    shell.setLayout(new FillLayout());

    Group group = new Group(shell, SWT.SHADOW_NONE);
    group.setText("Example");

    group.setLayout(new FillLayout());

    Label label = new Label(group, SWT.CENTER);
    label.setText("...TEST...");
    label.setBackground(Display.getCurrent()
         .getSystemColor(SWT.COLOR_RED));

    shell.pack();
    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch())
        display.sleep();
    }
    display.dispose();
  }
}


This code is respected under Windows platform totally, but under Mac platform we receive different background for Label.


My best suggestion is: in Control we have drawBackground() method where we invoke getThemeAlfa() - which is normally looks like that:

float getThemeAlfa() {
  return 1 * parent.getThemeAlfa();
}

but in Group control under Mac platform this method is overridden like that:

float getThemeAlfa() {
  return 0.25 * parent.getThemeAlfa();
}


The question is: was it maid intentionally or this is a bug? Will it be fixed in next version of Eclipse? (now I'm using 3.3.1.1)