418 |
|
|
419 |
public void setBounds (int x, int y, int width, int height) |
public void setBounds (int x, int y, int width, int height) |
420 |
{ |
{ |
421 |
|
int new_x = x; |
422 |
|
int new_y = y; |
423 |
|
|
424 |
Component parent = awtComponent.getParent (); |
Component parent = awtComponent.getParent (); |
425 |
|
|
426 |
// Heavyweight components that are children of one or more |
// Heavyweight components that are children of one or more |
441 |
|
|
442 |
i = ((Container) parent).getInsets (); |
i = ((Container) parent).getInsets (); |
443 |
|
|
444 |
x += parent.getX () + i.left; |
new_x += parent.getX () + i.left; |
445 |
y += parent.getY () + i.top; |
new_y += parent.getY () + i.top; |
446 |
|
|
447 |
parent = parent.getParent (); |
parent = parent.getParent (); |
448 |
} |
} |
451 |
// placing a heavyweight component in a Window. |
// placing a heavyweight component in a Window. |
452 |
if (parent instanceof Window && !lightweightChild) |
if (parent instanceof Window && !lightweightChild) |
453 |
{ |
{ |
|
Insets insets = ((Window) parent).getInsets (); |
|
454 |
GtkWindowPeer peer = (GtkWindowPeer) parent.getPeer (); |
GtkWindowPeer peer = (GtkWindowPeer) parent.getPeer (); |
455 |
|
// important: we want the window peer's insets here, not the |
456 |
|
// window's, since user sub-classes of Window can override |
457 |
|
// getInset and we only want to correct for the frame borders, |
458 |
|
// not for any user-defined inset values |
459 |
|
Insets insets = peer.getInsets (); |
460 |
|
|
461 |
int menuBarHeight = 0; |
int menuBarHeight = 0; |
462 |
if (peer instanceof GtkFramePeer) |
if (peer instanceof GtkFramePeer) |
463 |
menuBarHeight = ((GtkFramePeer) peer).getMenuBarHeight (); |
menuBarHeight = ((GtkFramePeer) peer).getMenuBarHeight (); |
464 |
|
|
465 |
// Convert from Java coordinates to GTK coordinates. |
new_x = x - insets.left; |
466 |
setNativeBounds (x - insets.left, y - insets.top + menuBarHeight, |
new_y = y - insets.top + menuBarHeight; |
|
width, height); |
|
467 |
} |
} |
468 |
else |
|
469 |
setNativeBounds (x, y, width, height); |
setNativeBounds (new_x, new_y, width, height); |
470 |
} |
} |
471 |
|
|
472 |
void setCursor () |
void setCursor () |
678 |
{ |
{ |
679 |
backBuffer.flush(); |
backBuffer.flush(); |
680 |
} |
} |
681 |
|
|
682 |
|
public String toString () |
683 |
|
{ |
684 |
|
return "peer of " + awtComponent.toString(); |
685 |
|
} |
686 |
} |
} |