[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.platform.swt] Re: Use CTabFolder

 
Veronica is right.
There  is an error  if you change scheme (in the operating system) on the fly.  Editors remain with old scheme.
All Views and Editors don't appear with righ color, even if the file is closed and oppened again.
Seems that the only way is to leave the car, close the door, enter again and turn on engine.
May be someone can open a bug report, if not already open.

[]s
Glauco Reis

Veronika Irvine wrote:

You are better off using SWT.COLOR_TITLE_BACKGROUND_GRADIENT, SWT.COLOR_TITLE_BACKGROUND, and SWT.COLOR_TITLE_FOREGROUND.  Not all colour schemes are blue.  There are also colour constants for the inactive colours.
"Glauco Reis" <gsrt@xxxxxxxxxxxx> wrote in message news:3EA2AB9E.CD9A9D25@xxxxxxxxxxxx...Hi David,

Exactly as  Randy told you,  to make the same behaviour of editor TABs you must use CTabFolder. TabFoder don't implement the color gradient behaviour, wich is need for Windows "look&feel".
The internal class you is looking for is org.eclipse.ui.internal.EditorWorkbook.java.
The following code shows the same behaviour of Edit Tab.

import org.eclipse.swt.*;
import org.eclipse.swt.custom.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.graphics.*;
 

public class TestCTabFolder {

public static void main(String[] args) {
     Display display = new Display();
     Shell shell = new Shell(display);
     shell.setLayout(new FillLayout());
     CTabFolder folder = new CTabFolder(shell, SWT.BORDER);
     folder.setSelectionForeground(display.getSystemColor(SWT.COLOR_WHITE));
     folder.setSelectionBackground(new
     Color[]{display.getSystemColor(SWT.COLOR_DARK_BLUE),
                             display.getSystemColor(SWT.COLOR_BLUE),
                             display.getSystemColor(SWT.COLOR_DARK_GRAY),
                             display.getSystemColor(SWT.COLOR_GRAY)},
                 new int[] {25, 50, 100});
     folder.update();
     for (int i = 0; i < 3; i++) {
          CTabItem item = new CTabItem(folder, SWT.BORDER);
          item.setText("Edit text"+i);
          if ((i %2) == 0)
               item.setImage( new Image(display, "imagem.gif")  );
          else
               item.setImage( new Image(display, "gold.gif")  );

          Text text = new Text(folder, SWT.BORDER | SWT.MULTI);
          text.setText("Content for Item "+i);
          item.setControl(text);
     }
     folder.addCTabFolderListener(new CTabFolderAdapter() {
          public void itemClosed(CTabFolderEvent event) { }
     });
     shell.setSize(400, 400);
     shell.open();
     while (!shell.isDisposed()) {
          if (!display.readAndDispatch())
               display.sleep();
     }
     display.dispose();
  }
}
 

[]s
Glauco Reis

David Taylor wrote:

Thanks Randy.  I was looking too deep into the ui/internal source and
completely skipped over the custom widgets.

-Dave

"Randy Hudson" <none@xxxxxxxxxx> wrote in message
news:b7vcpa$hl0$1@xxxxxxxxxxxxx...
>
>
>