Composite
Window
AbstractBasePane
, AbstractWindow
, ActionListDialog
, BasicWindow
, DialogWindow
, FileDialog
, ListSelectDialog
, MessageDialog
, TextInputDialog
, WaitingDialog
public interface BasePane extends Composite
MultiWindowTextGUI
, the background space behind the windows is a BasePane
too, just like each of the
windows. They are all drawn separately and composited together. Every BasePane
has a single component that
is drawn over the entire area the BasePane
is occupying, it's very likely you want to set this component to
be a container of some sort, probably a Panel
, that can host multiple child components.Panel
Modifier and Type | Method | Description |
---|---|---|
void |
draw(TextGUIGraphics graphics) |
Called by the GUI system (or something imitating the GUI system) to draw the root container.
|
TerminalPosition |
fromGlobal(TerminalPosition position) |
Returns a position expressed in global coordinates, i.e. row and column offset from the top-left corner of the
terminal into a position relative to the top-left corner of the base pane.
|
Component |
getComponent() |
Returns the component that is the content of the BasePane.
|
TerminalPosition |
getCursorPosition() |
Returns the position of where to put the terminal cursor according to this root container.
|
Interactable |
getFocusedInteractable() |
Returns the component in the root container that currently has input focus.
|
TextGUI |
getTextGUI() |
Returns the TextGUI this BasePane belongs to or
null if none. |
Theme |
getTheme() |
Returns the text GUI
Theme associated with this base pane/window. |
boolean |
handleInput(KeyStroke key) |
Called by the GUI system to delegate a keyboard input event.
|
void |
invalidate() |
Invalidates the whole root container (including all of its child components) which will cause them all to be
recalculated (for containers) and redrawn.
|
boolean |
isInvalid() |
Checks if this root container (i.e. any of its child components) has signaled that what it's currently displaying
is out of date and needs re-drawing.
|
void |
setComponent(Component component) |
Sets the top-level component inside this BasePane.
|
void |
setEnableDirectionBasedMovements(boolean enableDirectionBasedMovements) |
If set to false, using the keyboard arrows keys will have the same effect as using the tab and reverse tab.
|
void |
setFocusedInteractable(Interactable interactable) |
Sets the component currently in focus within this root container, or sets no component in focus if
null
is passed in. |
void |
setStrictFocusChange(boolean strictFocusChange) |
If set to true, up/down array keys will not translate to next/previous if there are no more components
above/below.
|
void |
setTheme(Theme theme) |
|
TerminalPosition |
toGlobal(TerminalPosition localPosition) |
Returns a position in a root container's local coordinate space to global coordinates
|
TextGUI getTextGUI()
null
if none. One example of when this method returns
null
is when calling it on a Window that hasn't been displayed yet.void draw(TextGUIGraphics graphics)
graphics
- TextGraphics object to draw withboolean isInvalid()
true
if the container's content is invalid and needs redrawing, false
otherwisevoid invalidate()
boolean handleInput(KeyStroke key)
false
so that the GUI system can take further decisions on what to do with it.key
- Keyboard inputtrue
If the root container could handle the input, false otherwiseComponent getComponent()
getComponent
in interface Composite
void setComponent(Component component)
setComponent
in interface Composite
component
- Component which this BasePane is using as it's contentInteractable getFocusedInteractable()
void setFocusedInteractable(Interactable interactable)
null
is passed in.interactable
- Interactable to focus, or null
to clear focusTerminalPosition getCursorPosition()
null
if no component has focus or if the root container doesn't
want the cursor to be visible. Note that the coordinates are in local coordinate space, relative to the top-left
corner of the root container. You can use your TextGUI implementation to translate these to global coordinates.null
if the cursor shouldn't be visibleTerminalPosition toGlobal(TerminalPosition localPosition)
localPosition
- The local position to translateTerminalPosition fromGlobal(TerminalPosition position)
fromGlobal(toGlobal(..))
should return the exact same position.position
- Position expressed in global coordinates to translate to local coordinates of this BasePanevoid setStrictFocusChange(boolean strictFocusChange)
strictFocusChange
- Will not allow relaxed navigation if set to true
void setEnableDirectionBasedMovements(boolean enableDirectionBasedMovements)
In Lanterna 2, direction based movements were not available.
enableDirectionBasedMovements
- Should direction based focus movements be enabled?Theme getTheme()
Theme
associated with this base pane/window. This is either coming from the
TextGUI
this object is associated with, the theme set as the override through setTheme(Theme)
or null
if this base pane/window isn't added to any TextGUI
and doesn't have any override.Theme
this base pane/window is expected to use when drawing the contentsvoid setTheme(Theme theme)
Theme
to use for this base pane/window, rather than the default Theme
associated with the TextGUI
it is attached to. If called with null
, it will clear the override
and use the default value instead.theme
- Theme
to assign to this base pane/window, or null
to resetCopyright © 2020. All rights reserved.