|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--waba.ui.Control | +--waba.ui.Container | +--waba.ui.Window
Window is a "floating" top-level window. This class IS functional like a modal window. The following example creates an popup window class:
class TestWindow extends Window { Button btnHi; public TestWindow() { super("Test",true); // with caption and borders setRect(CENTER,CENTER,100,50); add(btnHi=new Button("Hi!")); btnHi.setRect(CENTER,CENTER,PREFERRED,PREFERRED); } public void onEvent(Event event) { if (event.type == ControlEvent.PRESSED && event.target == btnHi) unpop(); // a WINDOW_CLOSED event will be posted to this PARENT window by the Window class. } }To use it:
class Main extends MainWindow { TestWindow tw; public void onStart() { popupModal(tw = new TestWindow()); } public void onEvent(Event event) { if (event.target == tw && event.type == ControlEvent.WINDOW_CLOSED) { tw = null; // or any other stuff } } }
Field Summary | |
protected static ControlEvent |
_controlEvent
|
protected Graphics |
_g
|
protected static KeyEvent |
_keyEvent
|
protected static PenEvent |
_penEvent
|
protected boolean |
beepIfOut
|
boolean |
flicker
|
protected Graphics |
gbuf
|
static int |
HIDE_STATE
used to hide the showing state |
protected Image |
imgBuf
|
protected boolean |
needsPaint
|
static byte |
NO_BORDER
|
static byte |
RECT_BORDER
|
static byte |
ROUND_BORDER
|
protected byte |
style
|
static byte |
TAB_BORDER
|
static byte |
TAB_ONLY_BORDER
|
protected java.lang.String |
title
|
protected Font |
titleFont
|
Fields inherited from class waba.ui.Container |
children,
tail |
Fields inherited from class waba.ui.Control |
BOTTOM,
CENTER,
controlCount,
enabled,
FILL,
fm,
font,
height,
LEFT,
name,
next,
parent,
PREFERRED,
prev,
RIGHT,
TOP,
width,
x,
y |
Constructor Summary | |
Window()
Constructs a window. |
|
Window(java.lang.String title,
boolean border)
Deprecated. |
|
Window(java.lang.String title,
byte style)
|
Method Summary | |
void |
_doPaint()
paints the top-level window. called by MainWindow |
void |
_doPaint(int x,
int y,
int width,
int height)
Called by the VM to repaint an area. |
void |
_postEvent(int type,
int key,
int x,
int y,
int modifiers,
int timeStamp)
Called by the VM to post key and pen events. |
protected void |
damageRect(int x,
int y,
int width,
int height)
Adds a damage rectangle to the current list of areas that need repainting. |
Rect |
getClientRect()
returns the client rect, ie, the rect minus the border and title area |
Control |
getFocus()
Returns the focus control for this window. |
static Window |
getTopMost()
returns the topmost window |
protected boolean |
isTopMost()
returns true if this window is the top-level window |
boolean |
isVisible()
true if this is the topmost window |
protected boolean |
onClickedOutside(int x,
int y)
called when the user clicks outside the bounds of this window. must return true if the event was handled, false otherwise. guich@1.2 |
protected void |
onPopup()
called imediatly before the popup began. the default implementation does nothing. |
protected void |
onUnpop()
called imediatly before the unpop began. the default implementation does nothing. |
void |
paintTitle(java.lang.String title,
Graphics gg)
paints the title immediatly. |
void |
popupModal(Window another)
popup a modal window, and make it child of this one. all events in the behind window are deactivated |
protected void |
postPopup()
called after the popup is done and after the repaint of this window. the default implementation does nothing. |
protected void |
postUnpop()
called after the unpop is done and after the repaint of the other window. the default implementation does nothing. |
void |
setBorderStyle(byte style)
sets the border style. use the constants XXXX_BORDER. sets the flag border accordingly to the style. |
void |
setDoubleBuffer(boolean doubleBuf)
Sets true if we have to use an double buffer to paint the screen. only works in palm os 3.0 or greater. it automatically sets to off if palm os 2.0 is running. |
void |
setFocus(Control c)
Sets focus to the given control. |
void |
setStatePosition(int x,
int y)
used to set the position where the status chars will be displayed. the chars are 8x11 pixels. this method must be called so the status can be displayed. these positions must be relative to this window, because they are converted to absolute coordinates. use setStatePosition(Window.HIDE_STATE,Window.HIDE_STATE) to remove the display of the state. |
void |
setTitle(java.lang.String title)
sets the title and call repaint. if you want a imediate repaint, call paintTitle. |
void |
setTitleFont(Font titleFont)
sets the title font |
void |
setVisible(boolean visible)
this method does nothing in this class |
java.lang.String |
toString()
Returns the string representation of the object. |
void |
unpop()
hides this window. if there are no more windows, exit is called. |
Methods inherited from class waba.ui.Container |
add,
findChild,
paintChildren,
remove |
Methods inherited from class waba.ui.Control |
addTimer,
contains,
createGraphics,
getAbsoluteRect,
getFontMetrics,
getNext,
getParent,
getPreferredHeight,
getPreferredWidth,
getRect,
isEnabled,
onBoundsChanged,
onEvent,
onPaint,
onWindowPaintFinished,
postEvent,
removeTimer,
repaint,
repaintNow,
setEnabled,
setFont,
setRect,
setRect |
Methods inherited from class java.lang.Object |
hashCode |
Field Detail |
public static final byte NO_BORDER
public static final byte RECT_BORDER
public static final byte ROUND_BORDER
public static final byte TAB_BORDER
public static final byte TAB_ONLY_BORDER
public static final int HIDE_STATE
protected static KeyEvent _keyEvent
protected static PenEvent _penEvent
protected static ControlEvent _controlEvent
protected boolean needsPaint
protected Graphics _g
protected Image imgBuf
protected Graphics gbuf
protected java.lang.String title
protected boolean beepIfOut
protected Font titleFont
public boolean flicker
protected byte style
Constructor Detail |
public Window()
public Window(java.lang.String title, boolean border)
public Window(java.lang.String title, byte style)
Method Detail |
public void setTitleFont(Font titleFont)
public void setTitle(java.lang.String title)
public void setBorderStyle(byte style)
public void setDoubleBuffer(boolean doubleBuf)
public void setFocus(Control c)
public Control getFocus()
setFocus(waba.ui.Control)
protected void damageRect(int x, int y, int width, int height)
protected boolean onClickedOutside(int x, int y)
public void _postEvent(int type, int key, int x, int y, int modifiers, int timeStamp)
public Rect getClientRect()
public void paintTitle(java.lang.String title, Graphics gg)
public void _doPaint(int x, int y, int width, int height)
public final void popupModal(Window another)
public final void unpop()
public void _doPaint()
protected boolean isTopMost()
public java.lang.String toString()
public static Window getTopMost()
protected void onPopup()
protected void postPopup()
protected void onUnpop()
protected void postUnpop()
public void setVisible(boolean visible)
public boolean isVisible()
public void setStatePosition(int x, int y)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |