2 * Jexer - Java Text User Interface
4 * The MIT License (MIT)
6 * Copyright (C) 2016 Kevin Lamonte
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24 * DEALINGS IN THE SOFTWARE.
26 * @author Kevin Lamonte [kevin.lamonte@gmail.com]
31 import jexer
.bits
.Cell
;
32 import jexer
.bits
.CellAttributes
;
33 import jexer
.bits
.GraphicsChars
;
34 import jexer
.event
.TCommandEvent
;
35 import jexer
.event
.TKeypressEvent
;
36 import jexer
.event
.TMenuEvent
;
37 import jexer
.event
.TMouseEvent
;
38 import jexer
.event
.TResizeEvent
;
39 import jexer
.io
.Screen
;
40 import jexer
.menu
.TMenu
;
41 import static jexer
.TCommand
.*;
42 import static jexer
.TKeypress
.*;
45 * TWindow is the top-level container and drawing surface for other widgets.
47 public class TWindow
extends TWidget
{
50 * Window's parent TApplication.
52 private TApplication application
;
55 * Get this TWindow's parent TApplication.
57 * @return this TWindow's parent TApplication
60 public final TApplication
getApplication() {
70 public final Screen
getScreen() {
71 return application
.getScreen();
77 private String title
= "";
82 * @return window title
84 public final String
getTitle() {
91 * @param title new window title
93 public final void setTitle(final String title
) {
98 * Window is resizable (default yes).
100 public static final int RESIZABLE
= 0x01;
103 * Window is modal (default no).
105 public static final int MODAL
= 0x02;
108 * Window is centered (default no).
110 public static final int CENTERED
= 0x04;
115 private int flags
= RESIZABLE
;
118 * Z order. Lower number means more in-front.
123 * Get Z order. Lower number means more in-front.
125 * @return Z value. Lower number means more in-front.
127 public final int getZ() {
132 * Set Z order. Lower number means more in-front.
134 * @param z the new Z value. Lower number means more in-front.
136 public final void setZ(final int z
) {
141 * If true, then the user clicked on the title bar and is moving the
144 protected boolean inWindowMove
= false;
147 * If true, then the user clicked on the bottom right corner and is
148 * resizing the window.
150 protected boolean inWindowResize
= false;
153 * If true, then the user selected "Size/Move" (or hit Ctrl-F5) and is
154 * resizing/moving the window via the keyboard.
156 private boolean inKeyboardResize
= false;
159 * If true, this window is maximized.
161 private boolean maximized
= false;
164 * Remember mouse state.
166 protected TMouseEvent mouse
;
168 // For moving the window. resizing also uses moveWindowMouseX/Y
169 private int moveWindowMouseX
;
170 private int moveWindowMouseY
;
171 private int oldWindowX
;
172 private int oldWindowY
;
175 private int resizeWindowWidth
;
176 private int resizeWindowHeight
;
177 private int minimumWindowWidth
= 10;
178 private int minimumWindowHeight
= 2;
179 private int maximumWindowWidth
= -1;
180 private int maximumWindowHeight
= -1;
182 // For maximize/restore
183 private int restoreWindowWidth
;
184 private int restoreWindowHeight
;
185 private int restoreWindowX
;
186 private int restoreWindowY
;
189 * Set the maximum width for this window.
191 * @param maximumWindowWidth new maximum width
193 public final void setMaximumWindowWidth(final int maximumWindowWidth
) {
194 this.maximumWindowWidth
= maximumWindowWidth
;
198 * Public constructor. Window will be located at (0, 0).
200 * @param application TApplication that manages this window
201 * @param title window title, will be centered along the top border
202 * @param width width of window
203 * @param height height of window
205 public TWindow(final TApplication application
, final String title
,
206 final int width
, final int height
) {
208 this(application
, title
, 0, 0, width
, height
, RESIZABLE
);
212 * Public constructor. Window will be located at (0, 0).
214 * @param application TApplication that manages this window
215 * @param title window title, will be centered along the top border
216 * @param width width of window
217 * @param height height of window
218 * @param flags bitmask of RESIZABLE, CENTERED, or MODAL
220 public TWindow(final TApplication application
, final String title
,
221 final int width
, final int height
, final int flags
) {
223 this(application
, title
, 0, 0, width
, height
, flags
);
227 * Public constructor.
229 * @param application TApplication that manages this window
230 * @param title window title, will be centered along the top border
231 * @param x column relative to parent
232 * @param y row relative to parent
233 * @param width width of window
234 * @param height height of window
236 public TWindow(final TApplication application
, final String title
,
237 final int x
, final int y
, final int width
, final int height
) {
239 this(application
, title
, x
, y
, width
, height
, RESIZABLE
);
243 * Public constructor.
245 * @param application TApplication that manages this window
246 * @param title window title, will be centered along the top border
247 * @param x column relative to parent
248 * @param y row relative to parent
249 * @param width width of window
250 * @param height height of window
251 * @param flags mask of RESIZABLE, CENTERED, or MODAL
253 public TWindow(final TApplication application
, final String title
,
254 final int x
, final int y
, final int width
, final int height
,
259 // I am my own window and parent
260 setupForTWindow(this, x
, y
+ application
.getDesktopTop(),
265 this.application
= application
;
268 // Minimum width/height are 10 and 2
269 assert (width
>= 10);
270 assert (getHeight() >= 2);
272 // MODAL implies CENTERED
274 this.flags
|= CENTERED
;
277 // Center window if specified
280 // Add me to the application
281 application
.addWindow(this);
285 * Recenter the window on-screen.
287 public final void center() {
288 if ((flags
& CENTERED
) != 0) {
289 if (getWidth() < getScreen().getWidth()) {
290 setX((getScreen().getWidth() - getWidth()) / 2);
294 setY(((application
.getDesktopBottom()
295 - application
.getDesktopTop()) - getHeight()) / 2);
299 setY(getY() + application
.getDesktopTop());
304 * Returns true if this window is modal.
306 * @return true if this window is modal
308 public final boolean isModal() {
309 if ((flags
& MODAL
) == 0) {
316 * Returns true if the mouse is currently on the close button.
318 * @return true if mouse is currently on the close button
320 private boolean mouseOnClose() {
322 && (mouse
.getAbsoluteY() == getY())
323 && (mouse
.getAbsoluteX() == getX() + 3)
331 * Returns true if the mouse is currently on the maximize/restore button.
333 * @return true if the mouse is currently on the maximize/restore button
335 private boolean mouseOnMaximize() {
338 && (mouse
.getAbsoluteY() == getY())
339 && (mouse
.getAbsoluteX() == getX() + getWidth() - 4)
347 * Returns true if the mouse is currently on the resizable lower right
350 * @return true if the mouse is currently on the resizable lower right
353 private boolean mouseOnResize() {
354 if (((flags
& RESIZABLE
) != 0)
357 && (mouse
.getAbsoluteY() == getY() + getHeight() - 1)
358 && ((mouse
.getAbsoluteX() == getX() + getWidth() - 1)
359 || (mouse
.getAbsoluteX() == getX() + getWidth() - 2))
367 * Retrieve the background color.
369 * @return the background color
371 public final CellAttributes
getBackground() {
373 && (inWindowMove
|| inWindowResize
|| inKeyboardResize
)
376 return getTheme().getColor("twindow.background.windowmove");
377 } else if (isModal() && inWindowMove
) {
379 return getTheme().getColor("twindow.background.modal");
380 } else if (isModal()) {
382 return getTheme().getColor("twindow.background.modal");
384 return getTheme().getColor("twindow.background.modal.inactive");
385 } else if (isActive()) {
387 return getTheme().getColor("twindow.background");
390 return getTheme().getColor("twindow.background.inactive");
395 * Retrieve the border color.
397 * @return the border color
399 public CellAttributes
getBorder() {
401 && (inWindowMove
|| inWindowResize
|| inKeyboardResize
)
404 return getTheme().getColor("twindow.border.windowmove");
405 } else if (isModal() && inWindowMove
) {
407 return getTheme().getColor("twindow.border.modal.windowmove");
408 } else if (isModal()) {
410 return getTheme().getColor("twindow.border.modal");
412 return getTheme().getColor("twindow.border.modal.inactive");
414 } else if (isActive()) {
416 return getTheme().getColor("twindow.border");
419 return getTheme().getColor("twindow.border.inactive");
424 * Retrieve the border line type.
426 * @return the border line type
428 private int getBorderType() {
430 && (inWindowMove
|| inWindowResize
|| inKeyboardResize
)
434 } else if (isModal() && inWindowMove
) {
437 } else if (isModal()) {
443 } else if (isActive()) {
451 * Subclasses should override this method to cleanup resources. This is
452 * called by application.closeWindow().
454 public void onClose() {
455 // Default: do nothing
459 * Called by application.switchWindow() when this window gets the
460 * focus, and also by application.addWindow().
462 public void onFocus() {
463 // Default: do nothing
467 * Called by application.switchWindow() when another window gets the
470 public void onUnfocus() {
471 // Default: do nothing
475 * Called by TApplication.drawChildren() to render on screen.
479 // Draw the box and background first.
480 CellAttributes border
= getBorder();
481 CellAttributes background
= getBackground();
482 int borderType
= getBorderType();
484 getScreen().drawBox(0, 0, getWidth(), getHeight(), border
,
485 background
, borderType
, true);
488 int titleLeft
= (getWidth() - title
.length() - 2) / 2;
489 putCharXY(titleLeft
, 0, ' ', border
);
490 putStringXY(titleLeft
+ 1, 0, title
);
491 putCharXY(titleLeft
+ title
.length() + 1, 0, ' ', border
);
495 // Draw the close button
496 putCharXY(2, 0, '[', border
);
497 putCharXY(4, 0, ']', border
);
498 if (mouseOnClose() && mouse
.isMouse1()) {
499 putCharXY(3, 0, GraphicsChars
.CP437
[0x0F],
501 ?
getTheme().getColor("twindow.border.windowmove")
502 : getTheme().getColor("twindow.border.modal.windowmove"));
504 putCharXY(3, 0, GraphicsChars
.CP437
[0xFE],
506 ?
getTheme().getColor("twindow.border.windowmove")
507 : getTheme().getColor("twindow.border.modal.windowmove"));
510 // Draw the maximize button
513 putCharXY(getWidth() - 5, 0, '[', border
);
514 putCharXY(getWidth() - 3, 0, ']', border
);
515 if (mouseOnMaximize() && mouse
.isMouse1()) {
516 putCharXY(getWidth() - 4, 0, GraphicsChars
.CP437
[0x0F],
517 getTheme().getColor("twindow.border.windowmove"));
520 putCharXY(getWidth() - 4, 0, GraphicsChars
.CP437
[0x12],
521 getTheme().getColor("twindow.border.windowmove"));
523 putCharXY(getWidth() - 4, 0, GraphicsChars
.UPARROW
,
524 getTheme().getColor("twindow.border.windowmove"));
528 // Draw the resize corner
529 if ((flags
& RESIZABLE
) != 0) {
530 putCharXY(getWidth() - 2, getHeight() - 1,
531 GraphicsChars
.SINGLE_BAR
,
532 getTheme().getColor("twindow.border.windowmove"));
533 putCharXY(getWidth() - 1, getHeight() - 1,
534 GraphicsChars
.LRCORNER
,
535 getTheme().getColor("twindow.border.windowmove"));
542 * Handle mouse button presses.
544 * @param mouse mouse button event
547 public void onMouseDown(final TMouseEvent mouse
) {
550 inKeyboardResize
= false;
552 if ((mouse
.getAbsoluteY() == getY())
554 && (getX() <= mouse
.getAbsoluteX())
555 && (mouse
.getAbsoluteX() < getX() + getWidth())
557 && !mouseOnMaximize()
559 // Begin moving window
561 moveWindowMouseX
= mouse
.getAbsoluteX();
562 moveWindowMouseY
= mouse
.getAbsoluteY();
570 if (mouseOnResize()) {
571 // Begin window resize
572 inWindowResize
= true;
573 moveWindowMouseX
= mouse
.getAbsoluteX();
574 moveWindowMouseY
= mouse
.getAbsoluteY();
575 resizeWindowWidth
= getWidth();
576 resizeWindowHeight
= getHeight();
583 // I didn't take it, pass it on to my children
584 super.onMouseDown(mouse
);
590 private void maximize() {
591 restoreWindowWidth
= getWidth();
592 restoreWindowHeight
= getHeight();
593 restoreWindowX
= getX();
594 restoreWindowY
= getY();
595 setWidth(getScreen().getWidth());
596 setHeight(application
.getDesktopBottom() - 1);
603 * Restote (unmaximize) window.
605 private void restore() {
606 setWidth(restoreWindowWidth
);
607 setHeight(restoreWindowHeight
);
608 setX(restoreWindowX
);
609 setY(restoreWindowY
);
614 * Handle mouse button releases.
616 * @param mouse mouse button release event
619 public void onMouseUp(final TMouseEvent mouse
) {
622 if ((inWindowMove
) && (mouse
.isMouse1())) {
623 // Stop moving window
624 inWindowMove
= false;
628 if ((inWindowResize
) && (mouse
.isMouse1())) {
629 // Stop resizing window
630 inWindowResize
= false;
634 if (mouse
.isMouse1() && mouseOnClose()) {
636 application
.closeWindow(this);
640 if ((mouse
.getAbsoluteY() == getY())
642 && mouseOnMaximize()) {
650 // Pass a resize event to my children
651 onResize(new TResizeEvent(TResizeEvent
.Type
.WIDGET
,
652 getWidth(), getHeight()));
656 // I didn't take it, pass it on to my children
657 super.onMouseUp(mouse
);
661 * Handle mouse movements.
663 * @param mouse mouse motion event
666 public void onMouseMotion(final TMouseEvent mouse
) {
671 setX(oldWindowX
+ (mouse
.getAbsoluteX() - moveWindowMouseX
));
672 setY(oldWindowY
+ (mouse
.getAbsoluteY() - moveWindowMouseY
));
673 // Don't cover up the menu bar
674 if (getY() < application
.getDesktopTop()) {
675 setY(application
.getDesktopTop());
680 if (inWindowResize
) {
682 setWidth(resizeWindowWidth
+ (mouse
.getAbsoluteX()
683 - moveWindowMouseX
));
684 setHeight(resizeWindowHeight
+ (mouse
.getAbsoluteY()
685 - moveWindowMouseY
));
686 if (getX() + getWidth() > getScreen().getWidth()) {
687 setWidth(getScreen().getWidth() - getX());
689 if (getY() + getHeight() > application
.getDesktopBottom()) {
690 setY(application
.getDesktopBottom() - getHeight() + 1);
692 // Don't cover up the menu bar
693 if (getY() < application
.getDesktopTop()) {
694 setY(application
.getDesktopTop());
697 // Keep within min/max bounds
698 if (getWidth() < minimumWindowWidth
) {
699 setWidth(minimumWindowWidth
);
700 inWindowResize
= false;
702 if (getHeight() < minimumWindowHeight
) {
703 setHeight(minimumWindowHeight
);
704 inWindowResize
= false;
706 if ((maximumWindowWidth
> 0)
707 && (getWidth() > maximumWindowWidth
)
709 setWidth(maximumWindowWidth
);
710 inWindowResize
= false;
712 if ((maximumWindowHeight
> 0)
713 && (getHeight() > maximumWindowHeight
)
715 setHeight(maximumWindowHeight
);
716 inWindowResize
= false;
719 // Pass a resize event to my children
720 onResize(new TResizeEvent(TResizeEvent
.Type
.WIDGET
,
721 getWidth(), getHeight()));
725 // I didn't take it, pass it on to my children
726 super.onMouseMotion(mouse
);
732 * @param keypress keystroke event
735 public void onKeypress(final TKeypressEvent keypress
) {
737 if (inKeyboardResize
) {
739 // ESC - Exit size/move
740 if (keypress
.equals(kbEsc
)) {
741 inKeyboardResize
= false;
744 if (keypress
.equals(kbLeft
)) {
749 if (keypress
.equals(kbRight
)) {
750 if (getX() < getScreen().getWidth() - 1) {
754 if (keypress
.equals(kbDown
)) {
755 if (getY() < application
.getDesktopBottom() - 1) {
759 if (keypress
.equals(kbUp
)) {
764 if (keypress
.equals(kbShiftLeft
)) {
765 if ((getWidth() > minimumWindowWidth
)
766 || (minimumWindowWidth
<= 0)
768 setWidth(getWidth() - 1);
771 if (keypress
.equals(kbShiftRight
)) {
772 if ((getWidth() < maximumWindowWidth
)
773 || (maximumWindowWidth
<= 0)
775 setWidth(getWidth() + 1);
778 if (keypress
.equals(kbShiftUp
)) {
779 if ((getHeight() > minimumWindowHeight
)
780 || (minimumWindowHeight
<= 0)
782 setHeight(getHeight() - 1);
785 if (keypress
.equals(kbShiftDown
)) {
786 if ((getHeight() < maximumWindowHeight
)
787 || (maximumWindowHeight
<= 0)
789 setHeight(getHeight() + 1);
793 // Pass a resize event to my children
794 onResize(new TResizeEvent(TResizeEvent
.Type
.WIDGET
,
795 getWidth(), getHeight()));
800 // These keystrokes will typically not be seen unless a subclass
801 // overrides onMenu() due to how TApplication dispatches
804 // Ctrl-W - close window
805 if (keypress
.equals(kbCtrlW
)) {
806 application
.closeWindow(this);
810 // F6 - behave like Alt-TAB
811 if (keypress
.equals(kbF6
)) {
812 application
.switchWindow(true);
816 // Shift-F6 - behave like Shift-Alt-TAB
817 if (keypress
.equals(kbShiftF6
)) {
818 application
.switchWindow(false);
823 if (keypress
.equals(kbF5
)) {
831 // Ctrl-F5 - size/move
832 if (keypress
.equals(kbCtrlF5
)) {
833 inKeyboardResize
= !inKeyboardResize
;
836 // I didn't take it, pass it on to my children
837 super.onKeypress(keypress
);
841 * Handle posted command events.
843 * @param command command event
846 public void onCommand(final TCommandEvent command
) {
848 // These commands will typically not be seen unless a subclass
849 // overrides onMenu() due to how TApplication dispatches
852 if (command
.equals(cmWindowClose
)) {
853 application
.closeWindow(this);
857 if (command
.equals(cmWindowNext
)) {
858 application
.switchWindow(true);
862 if (command
.equals(cmWindowPrevious
)) {
863 application
.switchWindow(false);
867 if (command
.equals(cmWindowMove
)) {
868 inKeyboardResize
= true;
872 if (command
.equals(cmWindowZoom
)) {
880 // I didn't take it, pass it on to my children
881 super.onCommand(command
);
885 * Handle posted menu events.
887 * @param menu menu event
890 public void onMenu(final TMenuEvent menu
) {
891 if (menu
.getId() == TMenu
.MID_WINDOW_CLOSE
) {
892 application
.closeWindow(this);
896 if (menu
.getId() == TMenu
.MID_WINDOW_NEXT
) {
897 application
.switchWindow(true);
901 if (menu
.getId() == TMenu
.MID_WINDOW_PREVIOUS
) {
902 application
.switchWindow(false);
906 if (menu
.getId() == TMenu
.MID_WINDOW_MOVE
) {
907 inKeyboardResize
= true;
911 if (menu
.getId() == TMenu
.MID_WINDOW_ZOOM
) {
920 // I didn't take it, pass it on to my children
924 // ------------------------------------------------------------------------
925 // Passthru for Screen functions ------------------------------------------
926 // ------------------------------------------------------------------------
929 * Get the attributes at one location.
931 * @param x column coordinate. 0 is the left-most column.
932 * @param y row coordinate. 0 is the top-most row.
933 * @return attributes at (x, y)
935 public final CellAttributes
getAttrXY(final int x
, final int y
) {
936 return getScreen().getAttrXY(x
, y
);
940 * Set the attributes at one location.
942 * @param x column coordinate. 0 is the left-most column.
943 * @param y row coordinate. 0 is the top-most row.
944 * @param attr attributes to use (bold, foreColor, backColor)
946 public final void putAttrXY(final int x
, final int y
,
947 final CellAttributes attr
) {
949 getScreen().putAttrXY(x
, y
, attr
);
953 * Set the attributes at one location.
955 * @param x column coordinate. 0 is the left-most column.
956 * @param y row coordinate. 0 is the top-most row.
957 * @param attr attributes to use (bold, foreColor, backColor)
958 * @param clip if true, honor clipping/offset
960 public final void putAttrXY(final int x
, final int y
,
961 final CellAttributes attr
, final boolean clip
) {
963 getScreen().putAttrXY(x
, y
, attr
, clip
);
967 * Fill the entire screen with one character with attributes.
969 * @param ch character to draw
970 * @param attr attributes to use (bold, foreColor, backColor)
972 public final void putAll(final char ch
, final CellAttributes attr
) {
973 getScreen().putAll(ch
, attr
);
977 * Render one character with attributes.
979 * @param x column coordinate. 0 is the left-most column.
980 * @param y row coordinate. 0 is the top-most row.
981 * @param ch character + attributes to draw
983 public final void putCharXY(final int x
, final int y
, final Cell ch
) {
984 getScreen().putCharXY(x
, y
, ch
);
988 * Render one character with attributes.
990 * @param x column coordinate. 0 is the left-most column.
991 * @param y row coordinate. 0 is the top-most row.
992 * @param ch character to draw
993 * @param attr attributes to use (bold, foreColor, backColor)
995 public final void putCharXY(final int x
, final int y
, final char ch
,
996 final CellAttributes attr
) {
998 getScreen().putCharXY(x
, y
, ch
, attr
);
1002 * Render one character without changing the underlying attributes.
1004 * @param x column coordinate. 0 is the left-most column.
1005 * @param y row coordinate. 0 is the top-most row.
1006 * @param ch character to draw
1008 public final void putCharXY(final int x
, final int y
, final char ch
) {
1009 getScreen().putCharXY(x
, y
, ch
);
1013 * Render a string. Does not wrap if the string exceeds the line.
1015 * @param x column coordinate. 0 is the left-most column.
1016 * @param y row coordinate. 0 is the top-most row.
1017 * @param str string to draw
1018 * @param attr attributes to use (bold, foreColor, backColor)
1020 public final void putStringXY(final int x
, final int y
, final String str
,
1021 final CellAttributes attr
) {
1023 getScreen().putStringXY(x
, y
, str
, attr
);
1027 * Render a string without changing the underlying attribute. Does not
1028 * wrap if the string exceeds the line.
1030 * @param x column coordinate. 0 is the left-most column.
1031 * @param y row coordinate. 0 is the top-most row.
1032 * @param str string to draw
1034 public final void putStringXY(final int x
, final int y
, final String str
) {
1035 getScreen().putStringXY(x
, y
, str
);
1039 * Draw a vertical line from (x, y) to (x, y + n).
1041 * @param x column coordinate. 0 is the left-most column.
1042 * @param y row coordinate. 0 is the top-most row.
1043 * @param n number of characters to draw
1044 * @param ch character to draw
1045 * @param attr attributes to use (bold, foreColor, backColor)
1047 public final void vLineXY(final int x
, final int y
, final int n
,
1048 final char ch
, final CellAttributes attr
) {
1050 getScreen().vLineXY(x
, y
, n
, ch
, attr
);
1054 * Draw a horizontal line from (x, y) to (x + n, y).
1056 * @param x column coordinate. 0 is the left-most column.
1057 * @param y row coordinate. 0 is the top-most row.
1058 * @param n number of characters to draw
1059 * @param ch character to draw
1060 * @param attr attributes to use (bold, foreColor, backColor)
1062 public final void hLineXY(final int x
, final int y
, final int n
,
1063 final char ch
, final CellAttributes attr
) {
1065 getScreen().hLineXY(x
, y
, n
, ch
, attr
);