RoundedToolbar - Haixing-Hu/swt-widgets GitHub Wiki

RoundedToolbar is a simple rounded toolbar with grey icons. It comes from the RoundedToolbar widget of the OPAL project.

Usage

Screen Shot of the RoundedToolbar Widget

Here is the code snippet:

final RoundedToolbar roundedToolBar = new RoundedToolbar(shell, SWT.NONE);

roundedToolBar.setMultiselection(true);
//roundedToolBar.setBackground(grey1);
roundedToolBar.setCornerRadius(6);

roundedToolBar.addControlListener(new ControlListener() {

  @Override
  public void controlResized(final ControlEvent e) {
    System.out.println(roundedToolBar.getSize());

  }

  @Override
  public void controlMoved(final ControlEvent e) {
    // TODO Auto-generated method stub

  }
});

final RoundedToolItem item1 = new RoundedToolItem(roundedToolBar);
item1.setSelection(true);
item1.setTooltipText("Multiple ballons");
item1.setWidth(40);
item1.setSelectionImage(iconBubble3w);
item1.setImage(iconBubble3b);

final RoundedToolItem item2 = new RoundedToolItem(roundedToolBar);
item2.setTooltipText("Simple item");
item2.setSelectionImage(iconBubble1w);
item2.setImage(iconBubble1b);
item2.setWidth(40);

final RoundedToolItem item3 = new RoundedToolItem(roundedToolBar);
item3.setTooltipText("Lot of lines\r\n\r\nThis item has a line-break");
item3.setSelectionImage(iconBubble2w);
item3.setImage(iconBubble2b);
item3.setWidth(40);

Example

An example is located in the source repository:

src/test/java/com/github/haixing_hu/swt/toolbar/RoundedToolbarExample.java