org.eclipse.swt.graphics.GC.drawFocus()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(131)

本文整理了Java中org.eclipse.swt.graphics.GC.drawFocus()方法的一些代码示例,展示了GC.drawFocus()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GC.drawFocus()方法的具体详情如下:
包路径:org.eclipse.swt.graphics.GC
类名称:GC
方法名:drawFocus

GC.drawFocus介绍

[英]Draws a rectangle, based on the specified arguments, which has the appearance of the platform's focus rectangle if the platform supports such a notion, and otherwise draws a simple rectangle in the receiver's foreground color.
[中]基于指定的参数绘制一个矩形,如果平台支持这样的概念,则该矩形具有平台的焦点矩形的外观,否则在接收器的前景色中绘制一个简单的矩形。

代码示例

代码示例来源:origin: org.eclipse.platform/org.eclipse.debug.ui

@Override
  public void paintControl(PaintEvent e) {
    if (fHasFocus && !isTextVisible()) {
      e.gc.drawFocus(e.x, e.y, e.width, e.height);
    }
  }
});

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

@Override
  public void paintControl(PaintEvent e) {
    if (fHasFocus && !isTextVisible()) {
      e.gc.drawFocus(e.x, e.y, e.width, e.height);
    }
  }
});

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

@Override
  public void paintControl(PaintEvent e) {
    if (fHasFocus && isTextVisible()) {
      e.gc.drawFocus(e.x, e.y, e.width, e.height);
    }
  }
});

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

@Override
  public void paintControl(PaintEvent e) {
    if (fHasFocus && !isTextVisible()) {
      e.gc.drawFocus(e.x, e.y, e.width, e.height);
    }
  }
});

代码示例来源:origin: org.eclipse.platform/org.eclipse.debug.ui

@Override
  public void paintControl(PaintEvent e) {
    if (fHasFocus && isTextVisible()) {
      e.gc.drawFocus(e.x, e.y, e.width, e.height);
    }
  }
});

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

@Override
  public void paintControl(PaintEvent e) {
    if (fHasFocus && isTextVisible()) {
      e.gc.drawFocus(e.x, e.y, e.width, e.height);
    }
  }
});

代码示例来源:origin: org.eclipse/org.eclipse.wst.common.ui.properties

public void paintControl(PaintEvent e) {
    if (gainedFocus) {
      Rectangle r = getClientArea();
      e.gc.drawFocus(0, 0, r.width, r.height);
    }
  }
});

代码示例来源:origin: org.eclipse/org.eclipse.help.ui

protected void paint(PaintEvent e) {
  if (hasFocus) {
    GC gc = e.gc;
    Point size = getSize();
    gc.setForeground(getForeground());
    gc.drawFocus(0, 0, size.x, size.y);
  }
}

代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64

public void drawFocus(GC gc, Rectangle bounds, DrawData data) {
  checkTheme();
  if (gc == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
  if (bounds == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
  if (data == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
  if (gc.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
  gc.drawFocus(bounds.x, bounds.y, bounds.width, bounds.height);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.forms

private void paintTitleFocus(GC gc) {
  Point size = textLabel.getSize();
  gc.setBackground(textLabel.getBackground());
  gc.setForeground(textLabel.getForeground());
  if (toggle.isFocusControl())
    gc.drawFocus(0, 0, size.x, size.y);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x

public void drawFocus(GC gc, Rectangle bounds, DrawData data) {
  checkTheme();
  if (gc == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
  if (bounds == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
  if (data == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
  if (gc.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
  gc.drawFocus(bounds.x, bounds.y, bounds.width, bounds.height);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.forms

@Override
public void paintFocus(GC gc, Color bg, Color fg, boolean selected,
    Rectangle repaintRegion) {
  Rectangle bounds = getBounds();
  if (bounds == null)
    return;
  if (selected) {
    gc.setBackground(bg);
    gc.setForeground(fg);
    gc.drawFocus(bounds.x, bounds.y, bounds.width, bounds.height);
  } else {
    gc.setForeground(bg);
    gc.drawRectangle(bounds.x, bounds.y, bounds.width - 1,
        bounds.height - 1);
  }
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.forms

@Override
public void paintFocus(GC gc, Color bg, Color fg, boolean selected,
    Rectangle repaintRegion) {
  Rectangle bounds = getBounds();
  if (bounds == null)
    return;
  if (selected) {
    gc.setBackground(bg);
    gc.setForeground(fg);
    gc.drawFocus(bounds.x, bounds.y, bounds.width, bounds.height);
  } else {
    gc.setForeground(bg);
    gc.drawRectangle(bounds.x, bounds.y, bounds.width - 1,
        bounds.height - 1);
  }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc

public void drawFocus(GC gc, Rectangle bounds, DrawData data) {
  checkTheme();
  if (gc == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
  if (bounds == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
  if (data == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
  if (gc.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
  gc.drawFocus(bounds.x, bounds.y, bounds.width, bounds.height);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.forms

private void paintTitleFocus(GC gc) {
    Point size = textLabel.getSize();
    gc.setBackground(textLabel.getBackground());
    gc.setForeground(textLabel.getForeground());
    if (toggle.isFocusControl())
      gc.drawFocus(0, 0, size.x, size.y);
  }
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86

public void drawFocus(GC gc, Rectangle bounds, DrawData data) {
  checkTheme();
  if (gc == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
  if (bounds == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
  if (data == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
  if (gc.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
  gc.drawFocus(bounds.x, bounds.y, bounds.width, bounds.height);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc

public void drawFocus(GC gc, Rectangle bounds, DrawData data) {
  checkTheme();
  if (gc == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
  if (bounds == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
  if (data == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
  if (gc.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
  gc.drawFocus(bounds.x, bounds.y, bounds.width, bounds.height);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.forms

/**
 * Paints the control as a reaction to the provided paint event.
 *
 * @param e
 *            the paint event
 */
protected void paint(PaintEvent e) {
  GC gc = e.gc;
  Rectangle clientArea = getClientArea();
  if (clientArea.width == 0 || clientArea.height == 0)
    return;
  paintHyperlink(gc);
  if (paintFocus && hasFocus) {
    Rectangle carea = getClientArea();
    gc.setForeground(getForeground());
    gc.drawFocus(0, 0, carea.width, carea.height);
  }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.forms

@Override
protected void paintHyperlink(GC gc) {
  Rectangle box = getBoxBounds(gc);
  gc.setForeground(getDisplay().getSystemColor(
      SWT.COLOR_WIDGET_NORMAL_SHADOW));
  gc.drawRectangle(box);
  gc.setForeground(getForeground());
  gc.drawLine(box.x + 2, box.y + 4, box.x + 6, box.y + 4);
  if (!isExpanded()) {
    gc.drawLine(box.x + 4, box.y + 2, box.x + 4, box.y + 6);
  }
  if (paintFocus && getSelection()) {
    gc.setForeground(getForeground());
    gc.drawFocus(box.x - 1, box.y - 1, box.width + 3, box.height + 3);
  }
}
private Rectangle getBoxBounds(GC gc) {

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.forms

@Override
protected void paintHyperlink(GC gc) {
  Rectangle box = getBoxBounds(gc);
  gc.setForeground(getDisplay().getSystemColor(
      SWT.COLOR_WIDGET_NORMAL_SHADOW));
  gc.drawRectangle(box);
  gc.setForeground(getForeground());
  gc.drawLine(box.x + 2, box.y + 4, box.x + 6, box.y + 4);
  if (!isExpanded()) {
    gc.drawLine(box.x + 4, box.y + 2, box.x + 4, box.y + 6);
  }
  if (paintFocus && getSelection()) {
    gc.setForeground(getForeground());
    gc.drawFocus(box.x - 1, box.y - 1, box.width + 3, box.height + 3);
  }
}
private Rectangle getBoxBounds(GC gc) {

相关文章

GC类方法