@Override Rectangle getClientAreaInPixels () { Rectangle clientRectangle = super.getClientAreaInPixels (); /* * Bug 453827 Child position fix. * SWT's calls to gtk_widget_size_allocate and gtk_widget_set_allocation * causes GTK+ to move the clientHandle's SwtFixed down by the size of the label. * These calls can come up from 'shell' and group has no control over these calls. * * This is an undesired side-effect. Client handle's x & y positions should never * be incremented as this is an internal sub-container. * * Note: 0 by 0 was chosen as 1 by 1 shifts controls beyond their original pos. * The long term fix would be to not use widget_*_allocation from higher containers * like shell and to not use gtkframe in non-group widgets (e.g used in label atm). */ clientRectangle.x = 0; clientRectangle.y = 0; return clientRectangle; }
@Override Rectangle getClientAreaInPixels () { Rectangle clientRectangle = super.getClientAreaInPixels (); /* * Bug 453827 Child position fix. * SWT's calls to gtk_widget_size_allocate and gtk_widget_set_allocation * causes GTK+ to move the clientHandle's SwtFixed down by the size of the label. * These calls can come up from 'shell' and group has no control over these calls. * * This is an undesired side-effect. Client handle's x & y positions should never * be incremented as this is an internal sub-container. * * Note: 0 by 0 was chosen as 1 by 1 shifts controls beyond their original pos. * The long term fix would be to not use widget_*_allocation from higher containers * like shell and to not use gtkframe in non-group widgets (e.g used in label atm). */ clientRectangle.x = 0; clientRectangle.y = 0; return clientRectangle; }
@Override Rectangle getClientAreaInPixels () { Rectangle clientRectangle = super.getClientAreaInPixels (); /* * Bug 453827 Child position fix. * SWT's calls to gtk_widget_size_allocate and gtk_widget_set_allocation * causes GTK+ to move the clientHandle's SwtFixed down by the size of the label. * These calls can come up from 'shell' and group has no control over these calls. * * This is an undesired side-effect. Client handle's x & y positions should never * be incremented as this is an internal sub-container. * * Note: 0 by 0 was chosen as 1 by 1 shifts controls beyond their original pos. * The long term fix would be to not use widget_*_allocation from higher containers * like shell and to not use gtkframe in non-group widgets (e.g used in label atm). */ clientRectangle.x = 0; clientRectangle.y = 0; return clientRectangle; }
@Override Rectangle getClientAreaInPixels () { Rectangle clientRectangle = super.getClientAreaInPixels (); if (OS.GTK3) { /* * Bug 454936 (see also other 454936 references) * SWT's calls to gtk_widget_size_allocate and gtk_widget_set_allocation * causes GTK+ to move the clientHandle's SwtFixed down by the size of the labels. * These calls can come up from 'shell' and TabFolder has no control over these calls. * * This is an undesired side-effect. Client handle's x & y positions should never * be incremented as this is an internal sub-container. * * Note: 0 by 0 was chosen as 1 by 1 shifts controls beyond their original pos. * The long term fix would be to not use widget_*_allocation from higher containers, * but this would require removal of swtFixed. * * This is Gtk3-specific for Tabfolder as the architecture is changed in gtk3 only. */ clientRectangle.x = 0; clientRectangle.y = 0; } return clientRectangle; }
@Override Rectangle getClientAreaInPixels () { Rectangle clientRectangle = super.getClientAreaInPixels (); if (OS.GTK3) { /* * Bug 454936 (see also other 454936 references) * SWT's calls to gtk_widget_size_allocate and gtk_widget_set_allocation * causes GTK+ to move the clientHandle's SwtFixed down by the size of the labels. * These calls can come up from 'shell' and TabFolder has no control over these calls. * * This is an undesired side-effect. Client handle's x & y positions should never * be incremented as this is an internal sub-container. * * Note: 0 by 0 was chosen as 1 by 1 shifts controls beyond their original pos. * The long term fix would be to not use widget_*_allocation from higher containers, * but this would require removal of swtFixed. * * This is Gtk3-specific for Tabfolder as the architecture is changed in gtk3 only. */ clientRectangle.x = 0; clientRectangle.y = 0; } return clientRectangle; }
@Override Rectangle getClientAreaInPixels () { Rectangle clientRectangle = super.getClientAreaInPixels (); if (OS.GTK3) { /* * Bug 454936 (see also other 454936 references) * SWT's calls to gtk_widget_size_allocate and gtk_widget_set_allocation * causes GTK+ to move the clientHandle's SwtFixed down by the size of the labels. * These calls can come up from 'shell' and TabFolder has no control over these calls. * * This is an undesired side-effect. Client handle's x & y positions should never * be incremented as this is an internal sub-container. * * Note: 0 by 0 was chosen as 1 by 1 shifts controls beyond their original pos. * The long term fix would be to not use widget_*_allocation from higher containers, * but this would require removal of swtFixed. * * This is Gtk3-specific for Tabfolder as the architecture is changed in gtk3 only. */ clientRectangle.x = 0; clientRectangle.y = 0; } return clientRectangle; }
void center () { if (parent == null) return; Rectangle rect = getBoundsInPixels (); Rectangle parentRect = display.mapInPixels (parent, null, parent.getClientAreaInPixels()); int x = Math.max (parentRect.x, parentRect.x + (parentRect.width - rect.width) / 2); int y = Math.max (parentRect.y, parentRect.y + (parentRect.height - rect.height) / 2); Rectangle monitorRect = parent.getMonitor ().getClientArea(); if (x + rect.width > monitorRect.x + monitorRect.width) { x = Math.max (monitorRect.x, monitorRect.x + monitorRect.width - rect.width); } else { x = Math.max (x, monitorRect.x); } if (y + rect.height > monitorRect.y + monitorRect.height) { y = Math.max (monitorRect.y, monitorRect.y + monitorRect.height - rect.height); } else { y = Math.max (y, monitorRect.y); } setLocationInPixels (x, y); }
void center () { if (parent == null) return; Rectangle rect = getBoundsInPixels (); Rectangle parentRect = display.mapInPixels (parent, null, parent.getClientAreaInPixels()); int x = Math.max (parentRect.x, parentRect.x + (parentRect.width - rect.width) / 2); int y = Math.max (parentRect.y, parentRect.y + (parentRect.height - rect.height) / 2); Rectangle monitorRect = DPIUtil.autoScaleUp(parent.getMonitor ().getClientArea()); if (x + rect.width > monitorRect.x + monitorRect.width) { x = Math.max (monitorRect.x, monitorRect.x + monitorRect.width - rect.width); } else { x = Math.max (x, monitorRect.x); } if (y + rect.height > monitorRect.y + monitorRect.height) { y = Math.max (monitorRect.y, monitorRect.y + monitorRect.height - rect.height); } else { y = Math.max (y, monitorRect.y); } setLocationInPixels (x, y); }
void center () { if (parent == null) return; Rectangle rect = getBoundsInPixels (); Rectangle parentRect = display.mapInPixels (parent, null, parent.getClientAreaInPixels()); int x = Math.max (parentRect.x, parentRect.x + (parentRect.width - rect.width) / 2); int y = Math.max (parentRect.y, parentRect.y + (parentRect.height - rect.height) / 2); Rectangle monitorRect = DPIUtil.autoScaleUp(parent.getMonitor ().getClientArea()); if (x + rect.width > monitorRect.x + monitorRect.width) { x = Math.max (monitorRect.x, monitorRect.x + monitorRect.width - rect.width); } else { x = Math.max (x, monitorRect.x); } if (y + rect.height > monitorRect.y + monitorRect.height) { y = Math.max (monitorRect.y, monitorRect.y + monitorRect.height - rect.height); } else { y = Math.max (y, monitorRect.y); } setLocationInPixels (x, y); }
void center () { if (parent == null) return; Rectangle rect = getBoundsInPixels (); Rectangle parentRect = display.mapInPixels (parent, null, parent.getClientAreaInPixels()); int x = Math.max (parentRect.x, parentRect.x + (parentRect.width - rect.width) / 2); int y = Math.max (parentRect.y, parentRect.y + (parentRect.height - rect.height) / 2); Rectangle monitorRect = DPIUtil.autoScaleUp(parent.getMonitor ().getClientArea()); if (x + rect.width > monitorRect.x + monitorRect.width) { x = Math.max (monitorRect.x, monitorRect.x + monitorRect.width - rect.width); } else { x = Math.max (x, monitorRect.x); } if (y + rect.height > monitorRect.y + monitorRect.height) { y = Math.max (monitorRect.y, monitorRect.y + monitorRect.height - rect.height); } else { y = Math.max (y, monitorRect.y); } setLocationInPixels (x, y); }
@Override void printWidget (GC gc, int /*long*/ drawable, int depth, int x, int y) { Region oldClip = new Region (gc.getDevice ()); Region newClip = new Region (gc.getDevice ()); Point loc = DPIUtil.autoScaleDown(new Point (x, y)); gc.getClipping (oldClip); Rectangle rect = getBounds (); newClip.add (oldClip); newClip.intersect (loc.x, loc.y, rect.width, rect.height); gc.setClipping (newClip); super.printWidget (gc, drawable, depth, x, y); Rectangle clientRect = getClientAreaInPixels (); Point pt = display.mapInPixels (this, parent, clientRect.x, clientRect.y); clientRect.x = x + pt.x - rect.x; clientRect.y = y + pt.y - rect.y; newClip.intersect (DPIUtil.autoScaleDown(clientRect)); gc.setClipping (newClip); Control [] children = _getChildren (); for (int i=children.length-1; i>=0; --i) { Control child = children [i]; if (child.getVisible ()) { Point location = child.getLocationInPixels (); child.printWidget (gc, drawable, depth, x + location.x, y + location.y); } } gc.setClipping (oldClip); oldClip.dispose (); newClip.dispose (); }
@Override void printWidget (GC gc, long /*int*/ drawable, int depth, int x, int y) { Region oldClip = new Region (gc.getDevice ()); Region newClip = new Region (gc.getDevice ()); Point loc = DPIUtil.autoScaleDown(new Point (x, y)); gc.getClipping (oldClip); Rectangle rect = getBounds (); newClip.add (oldClip); newClip.intersect (loc.x, loc.y, rect.width, rect.height); gc.setClipping (newClip); super.printWidget (gc, drawable, depth, x, y); Rectangle clientRect = getClientAreaInPixels (); Point pt = display.mapInPixels (this, parent, clientRect.x, clientRect.y); clientRect.x = x + pt.x - rect.x; clientRect.y = y + pt.y - rect.y; newClip.intersect (DPIUtil.autoScaleDown(clientRect)); gc.setClipping (newClip); Control [] children = _getChildren (); for (int i=children.length-1; i>=0; --i) { Control child = children [i]; if (child.getVisible ()) { Point location = child.getLocationInPixels (); child.printWidget (gc, drawable, depth, x + location.x, y + location.y); } } gc.setClipping (oldClip); oldClip.dispose (); newClip.dispose (); }
@Override void printWidget (GC gc, int /*long*/ drawable, int depth, int x, int y) { Region oldClip = new Region (gc.getDevice ()); Region newClip = new Region (gc.getDevice ()); Point loc = DPIUtil.autoScaleDown(new Point (x, y)); gc.getClipping (oldClip); Rectangle rect = getBounds (); newClip.add (oldClip); newClip.intersect (loc.x, loc.y, rect.width, rect.height); gc.setClipping (newClip); super.printWidget (gc, drawable, depth, x, y); Rectangle clientRect = getClientAreaInPixels (); Point pt = display.mapInPixels (this, parent, clientRect.x, clientRect.y); clientRect.x = x + pt.x - rect.x; clientRect.y = y + pt.y - rect.y; newClip.intersect (DPIUtil.autoScaleDown(clientRect)); gc.setClipping (newClip); Control [] children = _getChildren (); for (int i=children.length-1; i>=0; --i) { Control child = children [i]; if (child.getVisible ()) { Point location = child.getLocationInPixels (); child.printWidget (gc, drawable, depth, x + location.x, y + location.y); } } gc.setClipping (oldClip); oldClip.dispose (); newClip.dispose (); }