本文整理了Java中org.eclipse.swt.widgets.Event.setBounds()
方法的一些代码示例,展示了Event.setBounds()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Event.setBounds()
方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Event
类名称:Event
方法名:setBounds
[英]Sets the bounds.
[中]设置边界。
代码示例来源:origin: pentaho/pentaho-kettle
resizeEvent.type = SWT.Resize;
resizeEvent.display = getDisplay();
resizeEvent.setBounds( table.getBounds() );
table.notifyListeners( SWT.Resize, resizeEvent );
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
void setBoundsInPixels (Rectangle rect) {
setBounds(DPIUtil.autoScaleDown(rect));
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc
void setBoundsInPixels (Rectangle rect) {
setBounds(DPIUtil.autoScaleDown(rect));
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc
void setBoundsInPixels (Rectangle rect) {
setBounds(DPIUtil.autoScaleDown(rect));
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x
void setBoundsInPixels (Rectangle rect) {
setBounds(DPIUtil.autoScaleDown(rect));
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt
public static Event newSelectionEvent( Widget widget,
Widget item,
Rectangle bounds,
int stateMask,
String text,
boolean doit,
int detail )
{
Event event = newEvent( widget, SWT.Selection );
event.item = item;
event.setBounds( bounds );
event.stateMask = stateMask;
event.text = text;
event.doit = doit;
event.detail = detail;
return event;
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt
public void handleNotifyResize( Display display ) {
Event event = new Event();
event.display = display;
event.type = SWT.Resize;
event.time = EventUtil.getLastEventTime();
event.setBounds( display.getBounds() );
getDisplayAdapter( display ).notifyListeners( SWT.Resize, event );
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt
public void handleNotifySelection( ToolItem item, JsonObject properties ) {
Event event = createSelectionEvent( SWT.Selection, properties );
if( ( item.getStyle() & SWT.RADIO ) != 0 && !item.getSelection() ) {
event.time = -1;
}
if( event.detail == SWT.ARROW ) {
event.setBounds( getBounds( item ) );
}
item.notifyListeners( SWT.Selection, event );
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt
protected static Event createSelectionEvent( int eventType, JsonObject properties ) {
Event event = new Event();
event.type = eventType;
event.stateMask = readStateMask( properties );
event.detail = readDetail( properties );
event.text = readText( properties );
event.button = readButton( properties );
event.setBounds( readBounds( properties ) );
return event;
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt
private void repaint( Rectangle paintRect ) {
if( gcAdapter != null ) {
gcAdapter.clearGCOperations();
gcAdapter.setForceRedraw( true );
}
GC gc = new GC( this );
Event paintEvent = new Event();
paintEvent.gc = gc;
paintEvent.setBounds( paintRect );
notifyListeners( SWT.Paint, paintEvent );
gc.dispose();
if( gcAdapter != null ) {
gcAdapter.setPaintRect( paintRect );
}
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc
boolean sendDragEvent (int button, int stateMask, int x, int y, boolean isStateMask) {
Event event = new Event ();
event.button = button;
Rectangle eventRect = new Rectangle (x, y, 0, 0);
event.setBounds (eventRect);
if ((style & SWT.MIRRORED) != 0) event.x = DPIUtil.autoScaleDown(getClientWidth ()) - event.x;
if (isStateMask) {
event.stateMask = stateMask;
} else {
setInputState (event, stateMask);
}
postEvent (SWT.DragDetect, event);
if (isDisposed ()) return false;
return event.doit;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x
boolean sendDragEvent (int button, int stateMask, int x, int y, boolean isStateMask) {
Event event = new Event ();
event.button = button;
Rectangle eventRect = new Rectangle (x, y, 0, 0);
event.setBounds (eventRect);
if ((style & SWT.MIRRORED) != 0) event.x = DPIUtil.autoScaleDown(getClientWidth ()) - event.x;
if (isStateMask) {
event.stateMask = stateMask;
} else {
setInputState (event, stateMask);
}
postEvent (SWT.DragDetect, event);
if (isDisposed ()) return false;
return event.doit;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc
boolean sendDragEvent (int button, int stateMask, int x, int y, boolean isStateMask) {
Event event = new Event ();
event.button = button;
Rectangle eventRect = new Rectangle (x, y, 0, 0);
event.setBounds (eventRect);
if ((style & SWT.MIRRORED) != 0) event.x = DPIUtil.autoScaleDown(getClientWidth ()) - event.x;
if (isStateMask) {
event.stateMask = stateMask;
} else {
setInputState (event, stateMask);
}
postEvent (SWT.DragDetect, event);
if (isDisposed ()) return false;
return event.doit;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc
@Override
int /*long*/ gtk_expose_event (int /*long*/ widget, int /*long*/ eventPtr) {
if ((state & OBSCURED) != 0) return 0;
if (!hooksPaint ()) return 0;
GdkEventExpose gdkEvent = new GdkEventExpose ();
OS.memmove(gdkEvent, eventPtr, GdkEventExpose.sizeof);
Event event = new Event ();
event.count = gdkEvent.count;
Rectangle eventRect = new Rectangle (gdkEvent.area_x, gdkEvent.area_y, gdkEvent.area_width, gdkEvent.area_height);
event.setBounds (DPIUtil.autoScaleDown (eventRect));
if ((style & SWT.MIRRORED) != 0) event.x = DPIUtil.autoScaleDown (getClientWidth ()) - event.width - event.x;
GCData data = new GCData ();
data.damageRgn = gdkEvent.region;
GC gc = event.gc = GC.gtk_new (this, data);
drawWidget (gc);
sendEvent (SWT.Paint, event);
gc.dispose ();
event.gc = null;
return 0;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc
@Override
int /*long*/ gtk_expose_event (int /*long*/ widget, int /*long*/ eventPtr) {
if ((state & OBSCURED) != 0) return 0;
if (!hooksPaint ()) return 0;
GdkEventExpose gdkEvent = new GdkEventExpose ();
OS.memmove(gdkEvent, eventPtr, GdkEventExpose.sizeof);
Event event = new Event ();
event.count = gdkEvent.count;
Rectangle eventRect = new Rectangle (gdkEvent.area_x, gdkEvent.area_y, gdkEvent.area_width, gdkEvent.area_height);
event.setBounds (DPIUtil.autoScaleDown (eventRect));
if ((style & SWT.MIRRORED) != 0) event.x = DPIUtil.autoScaleDown (getClientWidth ()) - event.width - event.x;
GCData data = new GCData ();
data.damageRgn = gdkEvent.region;
GC gc = event.gc = GC.gtk_new (this, data);
drawWidget (gc);
sendEvent (SWT.Paint, event);
gc.dispose ();
event.gc = null;
return 0;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x
@Override
long /*int*/ gtk_expose_event (long /*int*/ widget, long /*int*/ eventPtr) {
if ((state & OBSCURED) != 0) return 0;
if (!hooksPaint ()) return 0;
GdkEventExpose gdkEvent = new GdkEventExpose ();
OS.memmove(gdkEvent, eventPtr, GdkEventExpose.sizeof);
Event event = new Event ();
event.count = gdkEvent.count;
Rectangle eventRect = new Rectangle (gdkEvent.area_x, gdkEvent.area_y, gdkEvent.area_width, gdkEvent.area_height);
event.setBounds (DPIUtil.autoScaleDown (eventRect));
if ((style & SWT.MIRRORED) != 0) event.x = DPIUtil.autoScaleDown (getClientWidth ()) - event.width - event.x;
GCData data = new GCData ();
data.damageRgn = gdkEvent.region;
GC gc = event.gc = GC.gtk_new (this, data);
drawWidget (gc);
sendEvent (SWT.Paint, event);
gc.dispose ();
event.gc = null;
return 0;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc
boolean showMenu (int x, int y, int detail) {
Event event = new Event ();
Rectangle eventRect = new Rectangle (x, y, 0, 0);
event.setBounds (DPIUtil.autoScaleDown (eventRect));
event.detail = detail;
sendEvent (SWT.MenuDetect, event);
//widget could be disposed at this point
if (isDisposed ()) return false;
if (event.doit) {
if (menu != null && !menu.isDisposed ()) {
boolean hooksKeys = hooks (SWT.KeyDown) || hooks (SWT.KeyUp);
menu.createIMMenu (hooksKeys ? imHandle() : 0);
Rectangle rect = DPIUtil.autoScaleUp (event.getBounds ());
if (rect.x != x || rect.y != y) {
menu.setLocationInPixels (rect.x, rect.y);
}
menu.setVisible (true);
return true;
}
}
return false;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x
boolean showMenu (int x, int y, int detail) {
Event event = new Event ();
Rectangle eventRect = new Rectangle (x, y, 0, 0);
event.setBounds (DPIUtil.autoScaleDown (eventRect));
event.detail = detail;
sendEvent (SWT.MenuDetect, event);
//widget could be disposed at this point
if (isDisposed ()) return false;
if (event.doit) {
if (menu != null && !menu.isDisposed ()) {
boolean hooksKeys = hooks (SWT.KeyDown) || hooks (SWT.KeyUp);
menu.createIMMenu (hooksKeys ? imHandle() : 0);
Rectangle rect = DPIUtil.autoScaleUp (event.getBounds ());
if (rect.x != x || rect.y != y) {
menu.setLocationInPixels (rect.x, rect.y);
}
menu.setVisible (true);
return true;
}
}
return false;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc
boolean showMenu (int x, int y, int detail) {
Event event = new Event ();
Rectangle eventRect = new Rectangle (x, y, 0, 0);
event.setBounds (DPIUtil.autoScaleDown (eventRect));
event.detail = detail;
sendEvent (SWT.MenuDetect, event);
//widget could be disposed at this point
if (isDisposed ()) return false;
if (event.doit) {
if (menu != null && !menu.isDisposed ()) {
boolean hooksKeys = hooks (SWT.KeyDown) || hooks (SWT.KeyUp);
menu.createIMMenu (hooksKeys ? imHandle() : 0);
Rectangle rect = DPIUtil.autoScaleUp (event.getBounds ());
if (rect.x != x || rect.y != y) {
menu.setLocationInPixels (rect.x, rect.y);
}
menu.setVisible (true);
return true;
}
}
return false;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc
@Override
int /*long*/ gtk_draw (int /*long*/ widget, int /*long*/ cairo) {
if ((state & OBSCURED) != 0) return 0;
if (!hooksPaint ()) return 0;
GdkRectangle rect = new GdkRectangle ();
OS.gdk_cairo_get_clip_rectangle (cairo, rect);
Event event = new Event ();
event.count = 1;
Rectangle eventRect = new Rectangle (rect.x, rect.y, rect.width, rect.height);
event.setBounds (DPIUtil.autoScaleDown (eventRect));
if ((style & SWT.MIRRORED) != 0) event.x = DPIUtil.autoScaleDown (getClientWidth ()) - event.width - event.x;
GCData data = new GCData ();
// data.damageRgn = gdkEvent.region;
if (OS.GTK_VERSION <= OS.VERSION (3, 9, 0)) {
data.cairo = cairo;
}
GC gc = event.gc = GC.gtk_new (this, data);
Rectangle rect2 = DPIUtil.autoScaleDown(new Rectangle(rect.x, rect.y, rect.width, rect.height));
// Caveat: rect2 is necessary because GC#setClipping(Rectangle) got broken by bug 446075
gc.setClipping (rect2.x, rect2.y, rect2.width, rect2.height);
drawWidget (gc);
sendEvent (SWT.Paint, event);
gc.dispose ();
event.gc = null;
return 0;
}
内容来源于网络,如有侵权,请联系作者删除!