1
1
/* GtkFramePeer.java -- Implements FramePeer with GTK
2
Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
2
Copyright (C) 1999, 2002, 2004, 2006 Free Software Foundation, Inc.
4
4
This file is part of GNU Classpath.
77
74
removeMenuBarPeer ();
78
75
insets.top -= menuBarHeight;
80
awtComponent.validate ();
77
// if component has already been validated, we need to revalidate.
78
// otherwise, it will be validated when it is shown.
79
if (awtComponent.isValid())
80
awtComponent.validate ();
81
81
gtkFixedSetVisible (true);
83
83
else if (bar != null && menuBar == null)
92
92
setMenuBarWidth (menuBar, menuBarWidth);
93
93
menuBarHeight = getMenuBarHeight ();
94
94
insets.top += menuBarHeight;
95
awtComponent.validate ();
95
// if component has already been validated, we need to revalidate.
96
// otherwise, it will be validated when it is shown.
97
if (awtComponent.isValid())
98
awtComponent.validate ();
96
99
gtkFixedSetVisible (true);
98
101
else if (bar != null && menuBar != null)
120
123
public void setBounds (int x, int y, int width, int height)
122
// prevent window_configure_cb -> awtComponent.setSize ->
123
// peer.setBounds -> nativeSetBounds self-deadlock on GDK lock.
124
if (Thread.currentThread() == GtkToolkit.mainThread)
126
int menuBarWidth = width - insets.left - insets.right;
127
if (menuBar != null && menuBarWidth > 0)
128
setMenuBarWidthUnlocked (menuBar, menuBarWidth);
133
125
int menuBarWidth = width - insets.left - insets.right;
134
126
if (menuBar != null && menuBarWidth > 0)
135
127
setMenuBarWidth (menuBar, menuBarWidth);
137
nativeSetBounds (x, y,
138
width - insets.left - insets.right,
139
height - insets.top - insets.bottom
129
super.setBounds(x, y, width, height + menuBarHeight);
143
132
public void setResizable (boolean resizable)
196
public Graphics getGraphics ()
199
if (GtkToolkit.useGraphics2D ())
200
g = new GdkGraphics2D (this);
202
g = new GdkGraphics (this);
203
g.translate (-insets.left, -insets.top);
207
185
protected void postConfigureEvent (int x, int y, int width, int height)
209
int frame_width = width + insets.left + insets.right;
187
if (menuBar != null && width > 0)
188
setMenuBarWidthUnlocked (menuBar, width);
210
190
// Since insets.top already includes the MenuBar's height, we need
211
191
// to subtract the MenuBar's height from the top inset.
212
int frame_height = height + insets.top + insets.bottom - menuBarHeight;
214
if (frame_width != awtComponent.getWidth()
215
|| frame_height != awtComponent.getHeight())
216
awtComponent.setSize(frame_width, frame_height);
218
int frame_x = x - insets.left;
192
int frame_height = height - menuBarHeight;
219
194
// Likewise, since insets.top includes the MenuBar height, we need
220
195
// to add back the MenuBar height to the frame's y position. If
221
196
// no MenuBar exists in this frame, the MenuBar height will be 0.
222
int frame_y = y - insets.top + menuBarHeight;
224
if (frame_x != awtComponent.getX()
225
|| frame_y != awtComponent.getY())
227
// awtComponent.setLocation(frame_x, frame_y);
231
protected void postMouseEvent(int id, long when, int mods, int x, int y,
232
int clickCount, boolean popupTrigger)
234
super.postMouseEvent (id, when, mods,
235
x + insets.left, y + insets.top,
236
clickCount, popupTrigger);
239
protected void postExposeEvent (int x, int y, int width, int height)
242
q().postEvent (new PaintEvent (awtComponent, PaintEvent.PAINT,
243
new Rectangle (x + insets.left,
197
int frame_y = y + menuBarHeight;
199
super.postConfigureEvent(x, frame_y, width, frame_height);
248
202
public int getState ()