3 * Copyright (C) 1998-2003 Brian Palmer <brianp@sginet.com>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 PVOID TextVideoBuffer
= NULL
;
26 * Prints formatted text to the screen
28 int TuiPrintf(const char *Format
, ...)
36 Length
= _vsnprintf(Buffer
, sizeof(Buffer
), Format
, ap
);
39 if (Length
== -1) Length
= sizeof(Buffer
);
41 for (i
= 0; i
< Length
; i
++)
43 MachConsPutChar(Buffer
[i
]);
49 BOOLEAN
TuiInitialize(VOID
)
51 MachVideoHideShowTextCursor(FALSE
);
52 MachVideoClearScreen(ATTR(COLOR_GRAY
, COLOR_BLACK
));
54 TextVideoBuffer
= VideoAllocateOffScreenBuffer();
55 if (TextVideoBuffer
== NULL
)
63 VOID
TuiUnInitialize(VOID
)
65 if (UiUseSpecialEffects
)
71 MachVideoSetDisplayMode(NULL
, FALSE
);
74 MachVideoClearScreen(ATTR(COLOR_GRAY
, COLOR_BLACK
));
75 MachVideoHideShowTextCursor(TRUE
);
78 VOID
TuiDrawBackdrop(VOID
)
81 // Fill in the background (excluding title box & status bar)
84 TUI_TITLE_BOX_CHAR_HEIGHT
,
88 ATTR(UiBackdropFgColor
, UiBackdropBgColor
));
96 TUI_TITLE_BOX_CHAR_HEIGHT
- 1,
101 ATTR(UiTitleBoxFgColor
, UiTitleBoxBgColor
));
108 GetFreeLoaderVersionString(),
109 ATTR(UiTitleBoxFgColor
, UiTitleBoxBgColor
));
117 ATTR(UiTitleBoxFgColor
, UiTitleBoxBgColor
));
121 ATTR(UiTitleBoxFgColor
, UiTitleBoxBgColor
));
126 TuiDrawText(UiScreenWidth
- 16, 3, /*"F1 for Help"*/"F8 for Options", ATTR(UiTitleBoxFgColor
, UiTitleBoxBgColor
));
131 TuiDrawText( (UiScreenWidth
/ 2) - ((ULONG
)strlen(UiTitleBoxTitleText
) / 2),
134 ATTR(UiTitleBoxFgColor
, UiTitleBoxBgColor
));
137 // Update the date & time
141 VideoCopyOffScreenBufferToVRAM();
146 * This function assumes coordinates are zero-based
148 VOID
TuiFillArea(ULONG Left
, ULONG Top
, ULONG Right
, ULONG Bottom
, CHAR FillChar
, UCHAR Attr
/* Color Attributes */)
150 PUCHAR ScreenMemory
= (PUCHAR
)TextVideoBuffer
;
153 // Clip the area to the screen
154 if ((Left
>= UiScreenWidth
) || (Top
>= UiScreenHeight
))
158 if (Right
>= UiScreenWidth
)
160 Right
= UiScreenWidth
- 1;
162 if (Bottom
>= UiScreenHeight
)
164 Bottom
= UiScreenHeight
- 1;
167 // Loop through each line and fill it in
168 for (i
=Top
; i
<=Bottom
; i
++)
170 // Loop through each character (column) in the line and fill it in
171 for (j
=Left
; j
<=Right
; j
++)
173 ScreenMemory
[((i
*2)*UiScreenWidth
)+(j
*2)] = (UCHAR
)FillChar
;
174 ScreenMemory
[((i
*2)*UiScreenWidth
)+(j
*2)+1] = Attr
;
181 * This function assumes coordinates are zero-based
183 VOID
TuiDrawShadow(ULONG Left
, ULONG Top
, ULONG Right
, ULONG Bottom
)
185 PUCHAR ScreenMemory
= (PUCHAR
)TextVideoBuffer
;
188 // Shade the bottom of the area
189 if (Bottom
< (UiScreenHeight
- 1))
191 if (UiScreenHeight
< 34)
200 for (; Idx
<=Right
; Idx
++)
202 ScreenMemory
[(((Bottom
+1)*2)*UiScreenWidth
)+(Idx
*2)+1] = ATTR(COLOR_GRAY
, COLOR_BLACK
);
206 // Shade the right of the area
207 if (Right
< (UiScreenWidth
- 1))
209 for (Idx
=Top
+1; Idx
<=Bottom
; Idx
++)
211 ScreenMemory
[((Idx
*2)*UiScreenWidth
)+((Right
+1)*2)+1] = ATTR(COLOR_GRAY
, COLOR_BLACK
);
214 if (UiScreenHeight
< 34)
216 if ((Right
+ 1) < (UiScreenWidth
- 1))
218 for (Idx
=Top
+1; Idx
<=Bottom
; Idx
++)
220 ScreenMemory
[((Idx
*2)*UiScreenWidth
)+((Right
+2)*2)+1] = ATTR(COLOR_GRAY
, COLOR_BLACK
);
225 // Shade the bottom right corner
226 if ((Right
< (UiScreenWidth
- 1)) && (Bottom
< (UiScreenHeight
- 1)))
228 ScreenMemory
[(((Bottom
+1)*2)*UiScreenWidth
)+((Right
+1)*2)+1] = ATTR(COLOR_GRAY
, COLOR_BLACK
);
230 if (UiScreenHeight
< 34)
232 if (((Right
+ 1) < (UiScreenWidth
- 1)) && (Bottom
< (UiScreenHeight
- 1)))
234 ScreenMemory
[(((Bottom
+1)*2)*UiScreenWidth
)+((Right
+2)*2)+1] = ATTR(COLOR_GRAY
, COLOR_BLACK
);
241 * This function assumes coordinates are zero-based
243 VOID
TuiDrawBox(ULONG Left
, ULONG Top
, ULONG Right
, ULONG Bottom
, UCHAR VertStyle
, UCHAR HorzStyle
, BOOLEAN Fill
, BOOLEAN Shadow
, UCHAR Attr
)
245 UCHAR ULCorner
, URCorner
, LLCorner
, LRCorner
;
247 // Calculate the corner values
248 if (HorzStyle
== HORZ
)
250 if (VertStyle
== VERT
)
257 else // VertStyle == D_VERT
265 else // HorzStyle == D_HORZ
267 if (VertStyle
== VERT
)
274 else // VertStyle == D_VERT
283 // Fill in box background
286 TuiFillArea(Left
, Top
, Right
, Bottom
, ' ', Attr
);
290 TuiFillArea(Left
, Top
, Left
, Top
, ULCorner
, Attr
);
291 TuiFillArea(Right
, Top
, Right
, Top
, URCorner
, Attr
);
292 TuiFillArea(Left
, Bottom
, Left
, Bottom
, LLCorner
, Attr
);
293 TuiFillArea(Right
, Bottom
, Right
, Bottom
, LRCorner
, Attr
);
296 TuiFillArea(Left
, Top
+1, Left
, Bottom
-1, VertStyle
, Attr
);
298 TuiFillArea(Left
+1, Top
, Right
-1, Top
, HorzStyle
, Attr
);
299 // Fill in right line
300 TuiFillArea(Right
, Top
+1, Right
, Bottom
-1, VertStyle
, Attr
);
301 // Fill in bottom line
302 TuiFillArea(Left
+1, Bottom
, Right
-1, Bottom
, HorzStyle
, Attr
);
307 TuiDrawShadow(Left
, Top
, Right
, Bottom
);
313 * This function assumes coordinates are zero-based
315 VOID
TuiDrawText(ULONG X
, ULONG Y
, PCSTR Text
, UCHAR Attr
)
317 PUCHAR ScreenMemory
= (PUCHAR
)TextVideoBuffer
;
321 for (i
=X
, j
=0; Text
[j
] && i
<UiScreenWidth
; i
++,j
++)
323 ScreenMemory
[((Y
*2)*UiScreenWidth
)+(i
*2)] = (UCHAR
)Text
[j
];
324 ScreenMemory
[((Y
*2)*UiScreenWidth
)+(i
*2)+1] = Attr
;
328 VOID
TuiDrawCenteredText(ULONG Left
, ULONG Top
, ULONG Right
, ULONG Bottom
, PCSTR TextString
, UCHAR Attr
)
333 ULONG LineBreakCount
;
342 TextLength
= strlen(TextString
);
344 // Count the new lines and the box width
348 for (Index
=0; Index
<TextLength
; Index
++)
350 if (TextString
[Index
] == '\n')
357 if ((Index
- LastIndex
) > BoxWidth
)
359 BoxWidth
= (ULONG
)(Index
- LastIndex
);
364 BoxHeight
= LineBreakCount
+ 1;
366 RealLeft
= (((Right
- Left
) - BoxWidth
) / 2) + Left
;
367 RealTop
= (((Bottom
- Top
) - BoxHeight
) / 2) + Top
;
370 for (Index
=0; Index
<TextLength
; Index
++)
372 if (TextString
[Index
] == '\n')
379 X
= (ULONG
)(RealLeft
+ LastIndex
);
382 Temp
[0] = TextString
[Index
];
384 TuiDrawText(X
, Y
, Temp
, Attr
);
389 VOID
TuiDrawStatusText(PCSTR StatusText
)
393 TuiDrawText(0, UiScreenHeight
-1, " ", ATTR(UiStatusBarFgColor
, UiStatusBarBgColor
));
394 TuiDrawText(1, UiScreenHeight
-1, StatusText
, ATTR(UiStatusBarFgColor
, UiStatusBarBgColor
));
396 for (i
=strlen(StatusText
)+1; i
<UiScreenWidth
; i
++)
398 TuiDrawText((ULONG
)i
, UiScreenHeight
-1, " ", ATTR(UiStatusBarFgColor
, UiStatusBarBgColor
));
401 VideoCopyOffScreenBufferToVRAM();
404 VOID
TuiUpdateDateTime(VOID
)
410 BOOLEAN PMHour
= FALSE
;
412 /* Don't draw the time if this has been disabled */
413 if (!UiDrawTime
) return;
415 TimeInfo
= ArcGetTime();
416 if (TimeInfo
->Year
< 1 || 9999 < TimeInfo
->Year
||
417 TimeInfo
->Month
< 1 || 12 < TimeInfo
->Month
||
418 TimeInfo
->Day
< 1 || 31 < TimeInfo
->Day
||
419 23 < TimeInfo
->Hour
||
420 59 < TimeInfo
->Minute
||
421 59 < TimeInfo
->Second
)
423 /* This happens on QEmu sometimes. We just skip updating */
426 // Get the month name
427 strcpy(DateString
, UiMonthNames
[TimeInfo
->Month
- 1]);
429 _itoa(TimeInfo
->Day
, TempString
, 10);
430 // Get the day postfix
431 if (1 == TimeInfo
->Day
|| 21 == TimeInfo
->Day
|| 31 == TimeInfo
->Day
)
433 strcat(TempString
, "st");
435 else if (2 == TimeInfo
->Day
|| 22 == TimeInfo
->Day
)
437 strcat(TempString
, "nd");
439 else if (3 == TimeInfo
->Day
|| 23 == TimeInfo
->Day
)
441 strcat(TempString
, "rd");
445 strcat(TempString
, "th");
448 // Add the day to the date
449 strcat(DateString
, TempString
);
450 strcat(DateString
, " ");
452 // Get the year and add it to the date
453 _itoa(TimeInfo
->Year
, TempString
, 10);
454 strcat(DateString
, TempString
);
457 TuiDrawText(UiScreenWidth
-(ULONG
)strlen(DateString
)-2, 1, DateString
, ATTR(UiTitleBoxFgColor
, UiTitleBoxBgColor
));
459 // Get the hour and change from 24-hour mode to 12-hour
460 if (TimeInfo
->Hour
> 12)
462 TimeInfo
->Hour
-= 12;
465 if (TimeInfo
->Hour
== 0)
469 _itoa(TimeInfo
->Hour
, TempString
, 10);
470 strcpy(TimeString
, " ");
471 strcat(TimeString
, TempString
);
472 strcat(TimeString
, ":");
473 _itoa(TimeInfo
->Minute
, TempString
, 10);
474 if (TimeInfo
->Minute
< 10)
476 strcat(TimeString
, "0");
478 strcat(TimeString
, TempString
);
479 strcat(TimeString
, ":");
480 _itoa(TimeInfo
->Second
, TempString
, 10);
481 if (TimeInfo
->Second
< 10)
483 strcat(TimeString
, "0");
485 strcat(TimeString
, TempString
);
488 strcat(TimeString
, " PM");
492 strcat(TimeString
, " AM");
496 TuiDrawText(UiScreenWidth
-(ULONG
)strlen(TimeString
)-2, 2, TimeString
, ATTR(UiTitleBoxFgColor
, UiTitleBoxBgColor
));
499 VOID
TuiSaveScreen(PUCHAR Buffer
)
501 PUCHAR ScreenMemory
= (PUCHAR
)TextVideoBuffer
;
504 for (i
=0; i
< (UiScreenWidth
* UiScreenHeight
* 2); i
++)
506 Buffer
[i
] = ScreenMemory
[i
];
510 VOID
TuiRestoreScreen(PUCHAR Buffer
)
512 PUCHAR ScreenMemory
= (PUCHAR
)TextVideoBuffer
;
515 for (i
=0; i
< (UiScreenWidth
* UiScreenHeight
* 2); i
++)
517 ScreenMemory
[i
] = Buffer
[i
];
521 VOID
TuiMessageBox(PCSTR MessageText
)
525 // Save the screen contents
526 ScreenBuffer
= MmHeapAlloc(UiScreenWidth
* UiScreenHeight
* 2);
527 TuiSaveScreen(ScreenBuffer
);
529 // Display the message box
530 TuiMessageBoxCritical(MessageText
);
532 // Restore the screen contents
533 TuiRestoreScreen(ScreenBuffer
);
534 MmHeapFree(ScreenBuffer
);
537 VOID
TuiMessageBoxCritical(PCSTR MessageText
)
540 unsigned int height
= 1;
549 for (i
=0; i
<strlen(MessageText
); i
++)
551 if (MessageText
[i
] == '\n')
556 for (i
=0,j
=0,k
=0; i
<height
; i
++)
558 while ((MessageText
[j
] != '\n') && (MessageText
[j
] != 0))
571 // Calculate box area
572 x1
= (UiScreenWidth
- (width
+2))/2;
574 y1
= ((UiScreenHeight
- height
- 2)/2) + 1;
575 y2
= y1
+ height
+ 4;
578 TuiDrawBox(x1
, y1
, x2
, y2
, D_VERT
, D_HORZ
, TRUE
, TRUE
, ATTR(UiMessageBoxFgColor
, UiMessageBoxBgColor
));
581 for (i
=0,j
=0; i
<strlen(MessageText
)+1; i
++)
583 if ((MessageText
[i
] == '\n') || (MessageText
[i
] == 0))
587 UiDrawText(x1
+2, y1
+1+curline
, temp
, ATTR(UiMessageBoxFgColor
, UiMessageBoxBgColor
));
591 temp
[j
++] = MessageText
[i
];
595 strcpy(temp
, " OK ");
596 UiDrawText(x1
+((x2
-x1
)/2)-3, y2
-2, temp
, ATTR(COLOR_BLACK
, COLOR_GRAY
));
599 UiDrawStatusText("Press ENTER to continue");
601 VideoCopyOffScreenBufferToVRAM();
607 key
= MachConsGetCh();
608 if(key
== KEY_EXTENDED
)
609 key
= MachConsGetCh();
613 else if(key
== KEY_SPACE
)
615 else if(key
== KEY_ESC
)
621 VideoCopyOffScreenBufferToVRAM();
628 VOID
TuiDrawProgressBarCenter(ULONG Position
, ULONG Range
, PCHAR ProgressText
)
630 ULONG Left
, Top
, Right
, Bottom
;
631 ULONG Width
= 50; // Allow for 50 "bars"
634 Left
= (UiScreenWidth
- Width
- 4) / 2;
635 Right
= Left
+ Width
+ 3;
636 Top
= (UiScreenHeight
- Height
- 2) / 2;
638 Bottom
= Top
+ Height
+ 1;
640 TuiDrawProgressBar(Left
, Top
, Right
, Bottom
, Position
, Range
, ProgressText
);
643 VOID
TuiDrawProgressBar(ULONG Left
, ULONG Top
, ULONG Right
, ULONG Bottom
, ULONG Position
, ULONG Range
, PCHAR ProgressText
)
646 ULONG ProgressBarWidth
= (Right
- Left
) - 3;
648 // First make sure the progress bar text fits
649 UiTruncateStringEllipsis(ProgressText
, ProgressBarWidth
- 4);
651 if (Position
> Range
)
657 TuiDrawBox(Left
, Top
, Right
, Bottom
, VERT
, HORZ
, TRUE
, TRUE
, ATTR(UiMenuFgColor
, UiMenuBgColor
));
660 // Draw the "Loading..." text
662 TuiDrawCenteredText(Left
+ 2, Top
+ 2, Right
- 2, Top
+ 2, ProgressText
, ATTR(UiTextColor
, UiMenuBgColor
));
664 // Draw the percent complete
665 for (i
=0; i
<(Position
*ProgressBarWidth
)/Range
; i
++)
667 TuiDrawText(Left
+2+i
, Top
+2, "\xDB", ATTR(UiTextColor
, UiMenuBgColor
));
671 for (; i
<ProgressBarWidth
; i
++)
673 TuiDrawText(Left
+2+i
, Top
+2, "\xB2", ATTR(UiTextColor
, UiMenuBgColor
));
677 VideoCopyOffScreenBufferToVRAM();
680 UCHAR
TuiTextToColor(PCSTR ColorText
)
682 if (_stricmp(ColorText
, "Black") == 0)
684 else if (_stricmp(ColorText
, "Blue") == 0)
686 else if (_stricmp(ColorText
, "Green") == 0)
688 else if (_stricmp(ColorText
, "Cyan") == 0)
690 else if (_stricmp(ColorText
, "Red") == 0)
692 else if (_stricmp(ColorText
, "Magenta") == 0)
693 return COLOR_MAGENTA
;
694 else if (_stricmp(ColorText
, "Brown") == 0)
696 else if (_stricmp(ColorText
, "Gray") == 0)
698 else if (_stricmp(ColorText
, "DarkGray") == 0)
699 return COLOR_DARKGRAY
;
700 else if (_stricmp(ColorText
, "LightBlue") == 0)
701 return COLOR_LIGHTBLUE
;
702 else if (_stricmp(ColorText
, "LightGreen") == 0)
703 return COLOR_LIGHTGREEN
;
704 else if (_stricmp(ColorText
, "LightCyan") == 0)
705 return COLOR_LIGHTCYAN
;
706 else if (_stricmp(ColorText
, "LightRed") == 0)
707 return COLOR_LIGHTRED
;
708 else if (_stricmp(ColorText
, "LightMagenta") == 0)
709 return COLOR_LIGHTMAGENTA
;
710 else if (_stricmp(ColorText
, "Yellow") == 0)
712 else if (_stricmp(ColorText
, "White") == 0)
718 UCHAR
TuiTextToFillStyle(PCSTR FillStyleText
)
720 if (_stricmp(FillStyleText
, "Light") == 0)
724 else if (_stricmp(FillStyleText
, "Medium") == 0)
728 else if (_stricmp(FillStyleText
, "Dark") == 0)
736 VOID
TuiFadeInBackdrop(VOID
)
738 PPALETTE_ENTRY TuiFadePalette
= NULL
;
740 if (UiUseSpecialEffects
&& ! MachVideoIsPaletteFixed())
742 TuiFadePalette
= (PPALETTE_ENTRY
)MmHeapAlloc(sizeof(PALETTE_ENTRY
) * 64);
744 if (TuiFadePalette
!= NULL
)
746 VideoSavePaletteState(TuiFadePalette
, 64);
747 VideoSetAllColorsToBlack(64);
751 // Draw the backdrop and title box
754 if (UiUseSpecialEffects
&& ! MachVideoIsPaletteFixed() && TuiFadePalette
!= NULL
)
756 VideoFadeIn(TuiFadePalette
, 64);
757 MmHeapFree(TuiFadePalette
);
761 VOID
TuiFadeOut(VOID
)
763 PPALETTE_ENTRY TuiFadePalette
= NULL
;
765 if (UiUseSpecialEffects
&& ! MachVideoIsPaletteFixed())
767 TuiFadePalette
= (PPALETTE_ENTRY
)MmHeapAlloc(sizeof(PALETTE_ENTRY
) * 64);
769 if (TuiFadePalette
!= NULL
)
771 VideoSavePaletteState(TuiFadePalette
, 64);
775 if (UiUseSpecialEffects
&& ! MachVideoIsPaletteFixed() && TuiFadePalette
!= NULL
)
780 MachVideoSetDisplayMode(NULL
, FALSE
);
782 if (UiUseSpecialEffects
&& ! MachVideoIsPaletteFixed() && TuiFadePalette
!= NULL
)
784 VideoRestorePaletteState(TuiFadePalette
, 64);
785 MmHeapFree(TuiFadePalette
);
790 BOOLEAN
TuiEditBox(PCSTR MessageText
, PCHAR EditTextBuffer
, ULONG Length
)
793 unsigned int height
= 1;
801 ULONG EditBoxStartX
, EditBoxEndX
;
803 unsigned int EditBoxTextCount
;
804 int EditBoxTextDisplayIndex
;
808 // Save the screen contents
809 ScreenBuffer
= MmHeapAlloc(UiScreenWidth
* UiScreenHeight
* 2);
810 TuiSaveScreen(ScreenBuffer
);
813 for (i
=0; i
<strlen(MessageText
); i
++)
815 if (MessageText
[i
] == '\n')
820 for (i
=0,j
=0,k
=0; i
<height
; i
++)
822 while ((MessageText
[j
] != '\n') && (MessageText
[j
] != 0))
835 // Calculate box area
836 x1
= (UiScreenWidth
- (width
+2))/2;
838 y1
= ((UiScreenHeight
- height
- 2)/2) + 1;
839 y2
= y1
+ height
+ 4;
842 TuiDrawBox(x1
, y1
, x2
, y2
, D_VERT
, D_HORZ
, TRUE
, TRUE
, ATTR(UiMessageBoxFgColor
, UiMessageBoxBgColor
));
845 for (i
=0,j
=0; i
<strlen(MessageText
)+1; i
++)
847 if ((MessageText
[i
] == '\n') || (MessageText
[i
] == 0))
851 UiDrawText(x1
+2, y1
+1+curline
, temp
, ATTR(UiMessageBoxFgColor
, UiMessageBoxBgColor
));
855 temp
[j
++] = MessageText
[i
];
858 EditBoxTextCount
= 0;
859 EditBoxLine
= y2
- 2;
860 EditBoxStartX
= x1
+ 3;
861 EditBoxEndX
= x2
- 3;
862 UiFillArea(EditBoxStartX
, EditBoxLine
, EditBoxEndX
, EditBoxLine
, ' ', ATTR(UiEditBoxTextColor
, UiEditBoxBgColor
));
865 EditBoxCursorX
= EditBoxStartX
;
866 MachVideoSetTextCursorPosition(EditBoxCursorX
, EditBoxLine
);
867 MachVideoHideShowTextCursor(TRUE
);
870 UiDrawStatusText("Press ENTER to continue, or ESC to cancel");
872 VideoCopyOffScreenBufferToVRAM();
878 key
= MachConsGetCh();
879 if(key
== KEY_EXTENDED
)
881 key
= MachConsGetCh();
889 else if(key
== KEY_ESC
)
894 else if (key
== KEY_BACKSPACE
) // Remove a character
896 if (EditBoxTextCount
)
899 EditTextBuffer
[EditBoxTextCount
] = 0;
906 else // Add this key to the buffer
908 if (EditBoxTextCount
< Length
- 1)
910 EditTextBuffer
[EditBoxTextCount
] = key
;
912 EditTextBuffer
[EditBoxTextCount
] = 0;
921 // Draw the edit box background
922 UiFillArea(EditBoxStartX
, EditBoxLine
, EditBoxEndX
, EditBoxLine
, ' ', ATTR(UiEditBoxTextColor
, UiEditBoxBgColor
));
925 if (EditBoxTextCount
> (EditBoxEndX
- EditBoxStartX
))
927 EditBoxTextDisplayIndex
= EditBoxTextCount
- (EditBoxEndX
- EditBoxStartX
);
928 EditBoxCursorX
= EditBoxEndX
;
932 EditBoxTextDisplayIndex
= 0;
933 EditBoxCursorX
= EditBoxStartX
+ EditBoxTextCount
;
935 UiDrawText(EditBoxStartX
, EditBoxLine
, &EditTextBuffer
[EditBoxTextDisplayIndex
], ATTR(UiEditBoxTextColor
, UiEditBoxBgColor
));
938 MachVideoSetTextCursorPosition(EditBoxCursorX
, EditBoxLine
);
942 VideoCopyOffScreenBufferToVRAM();
947 // Hide the cursor again
948 MachVideoHideShowTextCursor(FALSE
);
950 // Restore the screen contents
951 TuiRestoreScreen(ScreenBuffer
);
952 MmHeapFree(ScreenBuffer
);
957 const UIVTBL TuiVtbl
=
970 TuiMessageBoxCritical
,
971 TuiDrawProgressBarCenter
,