public class TWindow extends TWidget
Modifier and Type | Field and Description |
---|---|
static int |
ABSOLUTEXY
Window is placed at absolute position (no smart placement) (default
no).
|
static int |
CENTERED
Window is centered (default no).
|
static int |
HIDEONCLOSE
Hitting the closebox with the mouse calls TApplication.hideWindow()
rather than TApplication.closeWindow() (default no).
|
protected boolean |
inKeyboardResize
If true, then the user selected "Size/Move" (or hit Ctrl-F5) and is
resizing/moving the window via the keyboard.
|
protected boolean |
inWindowMove
If true, then the user clicked on the title bar and is moving the
window.
|
protected boolean |
inWindowResize
If true, then the user clicked on the bottom right corner and is
resizing the window.
|
static int |
MODAL
Window is modal (default no).
|
protected TMouseEvent |
mouse
Remember mouse state.
|
static int |
NOCLOSEBOX
Window has no close box (default no).
|
static int |
NOZOOMBOX
Window has no maximize box (default no).
|
static int |
OVERRIDEMENU
Menus cannot be used when this window is active (default no).
|
static int |
RESIZABLE
Window is resizable (default yes).
|
protected TStatusBar |
statusBar
A window may have a status bar associated with it.
|
Constructor and Description |
---|
TWindow(TApplication application,
java.lang.String title,
int width,
int height)
Public constructor.
|
TWindow(TApplication application,
java.lang.String title,
int width,
int height,
int flags)
Public constructor.
|
TWindow(TApplication application,
java.lang.String title,
int x,
int y,
int width,
int height)
Public constructor.
|
TWindow(TApplication application,
java.lang.String title,
int x,
int y,
int width,
int height,
int flags)
Public constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
activate()
Activate window (bring to top and receive events).
|
protected void |
addShortcutKeypress(TKeypress key)
Add a keypress to be overridden for this window.
|
void |
center()
Recenter the window on-screen.
|
protected void |
clearShortcutKeypresses()
Remove all keypresses to be overridden for this window.
|
void |
close()
Close window.
|
void |
draw()
Called by TApplication.drawChildren() to render on screen.
|
TApplication |
getApplication()
Get this TWindow's parent TApplication.
|
CellAttributes |
getBackground()
Retrieve the background color.
|
CellAttributes |
getBorder()
Retrieve the border color.
|
CellAttributes |
getBorderControls()
Retrieve the color used by the window movement/sizing controls.
|
Screen |
getScreen()
Get the Screen.
|
TStatusBar |
getStatusBar()
Get the window's status bar, or null if it does not have one.
|
java.lang.String |
getTitle()
Get window title.
|
int |
getZ()
Get Z order.
|
boolean |
hasCloseBox()
Returns true if this window has a close box.
|
boolean |
hasHiddenMouse()
Returns true if this window does not want the application-wide mouse
cursor drawn over it.
|
boolean |
hasOverriddenMenu()
Returns true if this window does not want menus to work while it is
visible.
|
boolean |
hasZoomBox()
Returns true if this window has a maximize/zoom box.
|
void |
hide()
Hide window.
|
boolean |
inMovements()
See if this window is undergoing any movement/resize/etc.
|
boolean |
isHidden()
Returns true if this window is hidden.
|
boolean |
isModal()
Returns true if this window is modal.
|
boolean |
isShortcutKeypress(TKeypress key)
Determine if a keypress is overridden for this window.
|
boolean |
isShown()
Returns true if this window is shown.
|
void |
maximize()
Maximize window.
|
protected boolean |
mouseOnClose()
Returns true if the mouse is currently on the close button.
|
protected boolean |
mouseOnMaximize()
Returns true if the mouse is currently on the maximize/restore button.
|
protected boolean |
mouseOnResize()
Returns true if the mouse is currently on the resizable lower right
corner.
|
TStatusBar |
newStatusBar(java.lang.String text)
Set the window's status bar to a new one.
|
protected void |
onClose()
Subclasses should override this method to cleanup resources.
|
void |
onCommand(TCommandEvent command)
Handle posted command events.
|
protected void |
onFocus()
Called by application.switchWindow() when this window gets the
focus, and also by application.addWindow().
|
protected void |
onHide()
Called by application.hideWindow().
|
void |
onKeypress(TKeypressEvent keypress)
Handle keystrokes.
|
void |
onMenu(TMenuEvent menu)
Handle posted menu events.
|
void |
onMouseDown(TMouseEvent mouse)
Handle mouse button presses.
|
void |
onMouseMotion(TMouseEvent mouse)
Handle mouse movements.
|
void |
onMouseUp(TMouseEvent mouse)
Handle mouse button releases.
|
protected void |
onPreClose()
Subclasses should override this method to perform any user prompting
before they are offscreen.
|
void |
onResize(TResizeEvent resize)
Method that subclasses can override to handle window/screen resize
events.
|
protected void |
onShow()
Called by application.showWindow().
|
protected void |
onUnfocus()
Called by application.switchWindow() when another window gets the
focus.
|
protected void |
removeShortcutKeypress(TKeypress key)
Remove a keypress to be overridden for this window.
|
void |
restore()
Restore (unmaximize) window.
|
void |
setHiddenMouse(boolean hideMouse)
Set request to prevent the application-wide mouse cursor from being
drawn over this window.
|
void |
setMaximumWindowHeight(int maximumWindowHeight)
Set the maximum height for this window.
|
void |
setMaximumWindowWidth(int maximumWindowWidth)
Set the maximum width for this window.
|
void |
setMinimumWindowHeight(int minimumWindowHeight)
Set the minimum height for this window.
|
void |
setMinimumWindowWidth(int minimumWindowWidth)
Set the minimum width for this window.
|
void |
setTitle(java.lang.String title)
Set window title.
|
void |
setZ(int z)
Set Z order.
|
void |
show()
Show window.
|
void |
stopMovements()
Stop any pending movement/resize/etc.
|
java.lang.String |
toString()
Generate a human-readable string for this window.
|
activate, activate, activateAll, addButton, addCalendar, addCheckBox, addComboBox, addDirectoryList, addDirectoryList, addDirectoryList, addDirectoryList, addEditor, addField, addField, addField, addImage, addImage, addLabel, addLabel, addLabel, addLabel, addLabel, addLabel, addList, addList, addList, addList, addPanel, addPasswordField, addPasswordField, addPasswordField, addProgressBar, addRadioGroup, addSpinner, addSplitPane, addTable, addTable, addText, addText, addTreeViewWidget, addTreeViewWidget, compareTo, doRepaint, drawBox, drawBox, drawBoxShadow, fileOpenBox, fileOpenBox, fileOpenBox, fileOpenBox, fileSaveBox, getAbsoluteX, getAbsoluteY, getActiveChild, getAttrXY, getChildren, getCursorAbsoluteX, getCursorAbsoluteY, getCursorX, getCursorY, getHeight, getLayoutManager, getParent, getTheme, getWidth, getWindow, getX, getY, handleEvent, hLineXY, inputBox, inputBox, inputBox, isAbsoluteActive, isActive, isCursorVisible, isDrawable, isEnabled, isVisible, messageBox, messageBox, mouseWouldHit, onIdle, onMouseDoubleClick, putAll, putAttrXY, putAttrXY, putCharXY, putCharXY, putCharXY, putStringXY, putStringXY, remove, remove, remove, remove, removeAll, resetTabOrder, setActive, setCursorVisible, setCursorX, setCursorY, setDimensions, setEnabled, setHeight, setLayoutManager, setParent, setupForTWindow, setVisible, setWidth, setWindow, setX, setY, splitHorizontal, splitVertical, switchWidget, toPrettyString, toPrettyString, vLineXY
public static final int RESIZABLE
public static final int MODAL
public static final int CENTERED
public static final int NOCLOSEBOX
public static final int NOZOOMBOX
public static final int ABSOLUTEXY
public static final int HIDEONCLOSE
public static final int OVERRIDEMENU
protected boolean inWindowMove
protected boolean inWindowResize
protected boolean inKeyboardResize
protected TMouseEvent mouse
protected TStatusBar statusBar
public TWindow(TApplication application, java.lang.String title, int width, int height)
application
- TApplication that manages this windowtitle
- window title, will be centered along the top borderwidth
- width of windowheight
- height of windowpublic TWindow(TApplication application, java.lang.String title, int width, int height, int flags)
application
- TApplication that manages this windowtitle
- window title, will be centered along the top borderwidth
- width of windowheight
- height of windowflags
- bitmask of RESIZABLE, CENTERED, or MODALpublic TWindow(TApplication application, java.lang.String title, int x, int y, int width, int height)
application
- TApplication that manages this windowtitle
- window title, will be centered along the top borderx
- column relative to parenty
- row relative to parentwidth
- width of windowheight
- height of windowpublic TWindow(TApplication application, java.lang.String title, int x, int y, int width, int height, int flags)
application
- TApplication that manages this windowtitle
- window title, will be centered along the top borderx
- column relative to parenty
- row relative to parentwidth
- width of windowheight
- height of windowflags
- mask of RESIZABLE, CENTERED, or MODALprotected boolean mouseOnClose()
protected boolean mouseOnMaximize()
protected boolean mouseOnResize()
protected void onPreClose()
protected void onClose()
protected void onFocus()
protected void onUnfocus()
protected void onHide()
protected void onShow()
public void onMouseDown(TMouseEvent mouse)
onMouseDown
in class TWidget
mouse
- mouse button eventpublic void onMouseUp(TMouseEvent mouse)
public void onMouseMotion(TMouseEvent mouse)
onMouseMotion
in class TWidget
mouse
- mouse motion eventpublic void onKeypress(TKeypressEvent keypress)
onKeypress
in class TWidget
keypress
- keystroke eventpublic void onCommand(TCommandEvent command)
public void onMenu(TMenuEvent menu)
public void onResize(TResizeEvent resize)
public final TApplication getApplication()
getApplication
in class TWidget
public final Screen getScreen()
public void draw()
public final java.lang.String getTitle()
public final void setTitle(java.lang.String title)
title
- new window titlepublic final int getZ()
public final void setZ(int z)
z
- the new Z value. Lower number means more in-front.protected void addShortcutKeypress(TKeypress key)
key
- the key to start taking control ofprotected void removeShortcutKeypress(TKeypress key)
key
- the key to stop taking control ofprotected void clearShortcutKeypresses()
public boolean isShortcutKeypress(TKeypress key)
key
- the key to checkpublic TStatusBar getStatusBar()
public TStatusBar newStatusBar(java.lang.String text)
text
- the status bar textpublic final void setMaximumWindowWidth(int maximumWindowWidth)
maximumWindowWidth
- new maximum widthpublic final void setMinimumWindowWidth(int minimumWindowWidth)
minimumWindowWidth
- new minimum widthpublic final void setMaximumWindowHeight(int maximumWindowHeight)
maximumWindowHeight
- new maximum heightpublic final void setMinimumWindowHeight(int minimumWindowHeight)
minimumWindowHeight
- new minimum heightpublic final void center()
public void maximize()
public void restore()
public final boolean isHidden()
public final boolean isShown()
public void hide()
public void show()
public void activate()
public void close()
public boolean inMovements()
public void stopMovements()
public final boolean isModal()
public final boolean hasCloseBox()
public final boolean hasZoomBox()
public final boolean hasOverriddenMenu()
public CellAttributes getBackground()
public CellAttributes getBorder()
public CellAttributes getBorderControls()
public boolean hasHiddenMouse()
public final void setHiddenMouse(boolean hideMouse)
hideMouse
- if true, this window does not want the
application-wide mouse cursor drawn over itCopyright © 2019 Kevin Lamonte. Licensed MIT.