99 |
native void gtkWidgetRequestFocus (); |
native void gtkWidgetRequestFocus (); |
100 |
native void gtkWidgetDispatchKeyEvent (int id, long when, int mods, |
native void gtkWidgetDispatchKeyEvent (int id, long when, int mods, |
101 |
int keyCode, int keyLocation); |
int keyCode, int keyLocation); |
102 |
native void gtkWidgetRepaintArea(int x, int y, int width, int height); |
|
103 |
|
native boolean isRealized (); |
104 |
|
|
105 |
void create () |
void create () |
106 |
{ |
{ |
118 |
|
|
119 |
create (); |
create (); |
120 |
|
|
|
setParent (); |
|
|
|
|
|
connectJObject (); |
|
121 |
connectSignals (); |
connectSignals (); |
122 |
|
|
123 |
if (awtComponent.getForeground () != null) |
if (awtComponent.getForeground () != null) |
127 |
if (awtComponent.getFont() != null) |
if (awtComponent.getFont() != null) |
128 |
setFont(awtComponent.getFont()); |
setFont(awtComponent.getFont()); |
129 |
|
|
130 |
setCursor (awtComponent.getCursor ()); |
Component parent = awtComponent.getParent (); |
131 |
|
|
132 |
|
// Only set our parent on the GTK side if our parent on the AWT |
133 |
|
// side is not showing. Otherwise the gtk peer will be shown |
134 |
|
// before we've had a chance to position and size it properly. |
135 |
|
if (awtComponent instanceof Window |
136 |
|
|| (parent != null && ! parent.isShowing ())) |
137 |
|
setParentAndBounds (); |
138 |
|
} |
139 |
|
|
140 |
|
void setParentAndBounds () |
141 |
|
{ |
142 |
|
setParent (); |
143 |
|
|
144 |
setComponentBounds (); |
setComponentBounds (); |
145 |
|
|
181 |
void setComponentBounds () |
void setComponentBounds () |
182 |
{ |
{ |
183 |
Rectangle bounds = awtComponent.getBounds (); |
Rectangle bounds = awtComponent.getBounds (); |
184 |
|
|
185 |
|
if (bounds.x == 0 && bounds.y == 0 |
186 |
|
&& bounds.width == 0 && bounds.height == 0) |
187 |
|
return; |
188 |
|
|
189 |
setBounds (bounds.x, bounds.y, bounds.width, bounds.height); |
setBounds (bounds.x, bounds.y, bounds.width, bounds.height); |
190 |
} |
} |
191 |
|
|
380 |
|
|
381 |
public void repaint (long tm, int x, int y, int width, int height) |
public void repaint (long tm, int x, int y, int width, int height) |
382 |
{ |
{ |
383 |
beginNativeRepaint (); |
if (x == 0 && y == 0 && width == 0 && height == 0) |
384 |
gtkWidgetRepaintArea (x, y, width, height); |
return; |
385 |
endNativeRepaint (); |
|
386 |
q.postEvent (new PaintEvent (awtComponent, PaintEvent.UPDATE, |
q.postEvent (new PaintEvent (awtComponent, PaintEvent.UPDATE, |
387 |
new Rectangle (x, y, width, height))); |
new Rectangle (x, y, width, height))); |
388 |
} |
} |
451 |
setNativeBounds (x, y, width, height); |
setNativeBounds (x, y, width, height); |
452 |
} |
} |
453 |
|
|
454 |
|
void setCursor () |
455 |
|
{ |
456 |
|
setCursor (awtComponent.getCursor ()); |
457 |
|
} |
458 |
|
|
459 |
public void setCursor (Cursor cursor) |
public void setCursor (Cursor cursor) |
460 |
{ |
{ |
461 |
gtkWidgetSetCursor (cursor.getType ()); |
gtkWidgetSetCursor (cursor.getType ()); |