/** Destroy the surface */
public abstract void _dispose();
+ /** Notifies the surface that limits have been imposed on the surface's size */
+ public void setLimits(int min_width, int min_height, int max_width, int max_height) { }
+
// Helper methods for subclasses ////////////////////////////////////////////////////////////
/** sends a KeyPressed message; subclasses should not add the C- or A- prefixes, nor should they capitalize alphabet characters */
protected final void KeyPressed(String key) {
if (key == null) return;
-
+
if (key.equals("alt")) alt = true;
else if (alt) key = "A-" + key;
public KMessage(String k) { key = k; }
public void perform() {
if (key.equals("C-v") || key.equals("A-v")) Platform.clipboardReadEnabled = true;
- for(int i=0; i<keywatchers.size(); i++)
- ((Box)keywatchers.elementAt(i)).put("KeyPressed", null, key);
+ outer: for(int i=0; i<keywatchers.size(); i++) {
+ Box b = (Box)keywatchers.elementAt(i);
+ for(Box cur = b; cur != null; cur = cur.getParent())
+ if (cur.invisible) continue outer;
+ b.put("KeyPressed", null, key);
+ }
Platform.clipboardReadEnabled = false;
}
}
else if (key.equals("control")) control = false;
else if (key.equals("shift")) shift = false;
MessageQueue.add(new Message() { public void perform() {
- for(int i=0; i<keywatchers.size(); i++)
- ((Box)keywatchers.elementAt(i)).put("KeyReleased", null, key);
+ outer: for(int i=0; i<keywatchers.size(); i++) {
+ Box b = (Box)keywatchers.elementAt(i);
+ for(Box cur = b; cur != null; cur = cur.getParent())
+ if (cur.invisible) continue outer;
+ b.put("KeyReleased", null, key);
+ }
}});
}