public void addDragSupport(int operations, Transfer[] transferTypes, DragSourceListener listener) { titleRegion.addDragSupport(operations, transferTypes, listener); }
public void addDropSupport(int operations, Transfer[] transferTypes, DropTargetListener listener) { titleRegion.addDropSupport(operations, transferTypes, listener); }
private void hookHoverListeners() { HoverListener listener = new HoverListener(); addMouseTrackListener(listener); addMouseMoveListener(listener); titleLabel.addMouseTrackListener(listener); titleLabel.addMouseMoveListener(listener); addPaintListener(e -> onPaint(e)); }
private void hookHoverListeners() { HoverListener listener = new HoverListener(); addMouseTrackListener(listener); addMouseMoveListener(listener); titleLabel.addMouseTrackListener(listener); titleLabel.addMouseMoveListener(listener); addPaintListener(new PaintListener() { @Override public void paintControl(PaintEvent e) { onPaint(e); } }); }
private void createMenuHyperlink() { menuHyperlink = new MenuHyperlink(this, SWT.NULL); menuHyperlink.setBackground(getColor(FormHeading.COLOR_BASE_BG)); menuHyperlink.setDecorationColor(getForeground()); menuHyperlink.setHoverDecorationColor(getDisplay().getSystemColor(SWT.COLOR_LIST_FOREGROUND)); HoverListener listener = new HoverListener(); menuHyperlink.addMouseTrackListener(listener); menuHyperlink.addMouseMoveListener(listener); if (dragSupport) addDragSupport(menuHyperlink, dragOperations, dragTransferTypes, dragListener); }
tsize = titleRegion.computeSize(flexWidth, SWT.DEFAULT); } else { Point tsizeNatural = titleRegion.computeSize(SWT.DEFAULT, SWT.DEFAULT); messageCache.setControl(messageRegion.getMessageControl()); tsize = titleRegion.computeSize(flex, SWT.DEFAULT); msize.x = MESSAGE_AREA_LIMIT; if (hasToolBar() && getToolBarAlignment() == SWT.TOP) row1Height = Math.max(row1Height, tbsize.y); titleRegion.setBounds(xloc, if (tsize.y > 0) { int titleLeadingSpace = (tsize.y - titleRegion.getFontHeight()) / 2; messageOffset = (titleLeadingSpace + titleRegion.getFontBaselineHeight()) - (messageLeadingSpace + messageRegion.getFontBaselineHeight());
private void ensureBusyLabelExists() { if (busyLabel == null) { busyLabel = new BusyIndicator(this, SWT.NULL); busyLabel.setBackground(getColor(FormHeading.COLOR_BASE_BG)); HoverListener listener = new HoverListener(); busyLabel.addMouseTrackListener(listener); busyLabel.addMouseMoveListener(listener); if (menuManager != null) busyLabel.setMenu(menuManager.createContextMenu(this)); if (dragSupport) addDragSupport(busyLabel, dragOperations, dragTransferTypes, dragListener); IMessageToolTipManager mng = ((FormHeading) getParent()) .getMessageToolTipManager(); if (mng != null) mng.createToolTip(busyLabel, true); } }
public void updateImage(Image newImage, boolean doLayout) { Image theImage = newImage != null ? newImage : this.image; if (theImage != null) { ensureBusyLabelExists(); } else if (busyLabel != null) { if (!busyLabel.isBusy()) { busyLabel.dispose(); busyLabel = null; } } if (busyLabel != null) { busyLabel.setImage(theImage); } if (doLayout) layout(); }
public IMenuManager getMenuManager() { if (menuManager == null) { menuManager = new MenuManager(); Menu menu = menuManager.createContextMenu(this); setMenu(menu); titleLabel.setMenu(menu); if (busyLabel != null) busyLabel.setMenu(menu); createMenuHyperlink(); } return menuManager; }
public TitleRegion(Composite parent) { super(parent, SWT.NULL); titleLabel = new Label(this, SWT.WRAP); titleLabel.setVisible(false); titleCache = new SizeCache(); super.setLayout(new TitleRegionLayout()); hookHoverListeners(); addListener(SWT.Dispose, new Listener() { @Override public void handleEvent(Event e) { if (dragImage != null) { dragImage.dispose(); dragImage = null; } } }); }
titleRegion = new TitleRegion(this);
private void createMenuHyperlink() { menuHyperlink = new MenuHyperlink(this, SWT.NULL); menuHyperlink.setBackground(getColor(FormHeading.COLOR_BASE_BG)); menuHyperlink.setDecorationColor(getForeground()); menuHyperlink.setHoverDecorationColor(getDisplay().getSystemColor(SWT.COLOR_LIST_FOREGROUND)); HoverListener listener = new HoverListener(); menuHyperlink.addMouseTrackListener(listener); menuHyperlink.addMouseMoveListener(listener); if (dragSupport) addDragSupport(menuHyperlink, dragOperations, dragTransferTypes, dragListener); }
tsize = titleRegion.computeSize(flex, SWT.DEFAULT); msize.x = MESSAGE_AREA_LIMIT; if (hasToolBar() && getToolBarAlignment() == SWT.TOP) row1Height = Math.max(row1Height, tbsize.y); titleRegion.setBounds(xloc, if (tsize.y > 0) { int titleLeadingSpace = (tsize.y - titleRegion.getFontHeight()) / 2; messageOffset = (titleLeadingSpace + titleRegion.getFontBaselineHeight()) - (messageLeadingSpace + messageRegion.getFontBaselineHeight());
private void ensureBusyLabelExists() { if (busyLabel == null) { busyLabel = new BusyIndicator(this, SWT.NULL); busyLabel.setBackground(getColor(FormHeading.COLOR_BASE_BG)); HoverListener listener = new HoverListener(); busyLabel.addMouseTrackListener(listener); busyLabel.addMouseMoveListener(listener); if (menuManager != null) busyLabel.setMenu(menuManager.createContextMenu(this)); if (dragSupport) addDragSupport(busyLabel, dragOperations, dragTransferTypes, dragListener); IMessageToolTipManager mng = ((FormHeading) getParent()) .getMessageToolTipManager(); if (mng != null) mng.createToolTip(busyLabel, true); } }
public void updateImage(Image newImage, boolean doLayout) { Image theImage = newImage != null ? newImage : this.image; if (theImage != null) { ensureBusyLabelExists(); } else if (busyLabel != null) { if (!busyLabel.isBusy()) { busyLabel.dispose(); busyLabel = null; } } if (busyLabel != null) { busyLabel.setImage(theImage); } if (doLayout) layout(); }
public IMenuManager getMenuManager() { if (menuManager == null) { menuManager = new MenuManager(); Menu menu = menuManager.createContextMenu(this); setMenu(menu); titleLabel.setMenu(menu); if (busyLabel != null) busyLabel.setMenu(menu); createMenuHyperlink(); } return menuManager; }
public TitleRegion(Composite parent) { super(parent, SWT.NULL); titleLabel = new Label(this, SWT.WRAP); titleLabel.setVisible(false); titleCache = new SizeCache(); super.setLayout(new TitleRegionLayout()); hookHoverListeners(); addListener(SWT.Dispose, e -> { if (dragImage != null) { dragImage.dispose(); dragImage = null; } }); }
titleRegion = new TitleRegion(this);
/** * Sets the form's busy state. Busy form will display 'busy' animation in * the area of the title image. * * @param busy * the form's busy state */ public boolean setBusy(boolean busy) { if (busy) ensureBusyLabelExists(); else if (busyLabel == null) return false; if (busy == busyLabel.isBusy()) return false; busyLabel.setBusy(busy); if (busyLabel.getImage() == null) { layout(); return true; } return false; }
public void addDragSupport(int operations, Transfer[] transferTypes, DragSourceListener listener) { dragSupport = true; dragOperations = operations; dragTransferTypes = transferTypes; dragListener = listener; dragSource = addDragSupport(titleLabel, operations, transferTypes, listener); addDragSupport(this, operations, transferTypes, listener); if (busyLabel != null) addDragSupport(busyLabel, operations, transferTypes, listener); if (menuHyperlink != null) addDragSupport(menuHyperlink, operations, transferTypes, listener); }