Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

114 lines
2.2 KiB

  1. /*++
  2. Copyright (c) 1999 Intel Corporation
  3. Module Name:
  4. libStatus.c
  5. Abstract:
  6. Defines the StatusBar data type and the operations for it.
  7. --*/
  8. #ifndef _LIB_STATUS_BAR
  9. #define _LIB_STATUS_BAR
  10. #include "libMisc.h"
  11. STATIC EFI_STATUS MainStatusBarInit (VOID);
  12. STATIC EFI_STATUS MainStatusBarCleanup (VOID);
  13. STATIC EFI_STATUS MainStatusBarRefresh (VOID);
  14. STATIC EFI_STATUS MainStatusBarHide (VOID);
  15. STATIC EFI_STATUS MainStatusBarSetStatusString (CHAR16*);
  16. STATIC EFI_STATUS MainStatusBarSetOffset (UINTN);
  17. EE_STATUS_BAR MainStatusBar = {
  18. NULL,
  19. 0x00,
  20. MainStatusBarInit,
  21. MainStatusBarCleanup,
  22. MainStatusBarRefresh,
  23. MainStatusBarHide,
  24. MainStatusBarSetStatusString,
  25. MainStatusBarSetOffset
  26. };
  27. STATIC
  28. EFI_STATUS
  29. MainStatusBarInit ()
  30. {
  31. /* Nothing to do.... */
  32. MainStatusBar.SetStatusString(L"");
  33. return EFI_SUCCESS;
  34. }
  35. STATIC
  36. EFI_STATUS
  37. MainStatusBarCleanup ()
  38. {
  39. MainEditor.FileBuffer->ClearLine(STATUS_BAR_LOCATION);
  40. if ( MainStatusBar.StatusString != NULL ) {
  41. FreePool ((VOID*)MainStatusBar.StatusString);
  42. }
  43. return EFI_SUCCESS;
  44. }
  45. STATIC
  46. EFI_STATUS
  47. MainStatusBarRefresh ()
  48. {
  49. EE_COLOR_UNION Orig,New;
  50. Orig = MainEditor.ColorAttributes;
  51. New.Colors.Foreground = Orig.Colors.Background;
  52. New.Colors.Background = Orig.Colors.Foreground;
  53. Out->SetAttribute (Out,New.Data);
  54. MainEditor.FileBuffer->ClearLine(STATUS_BAR_LOCATION);
  55. PrintAt (0,STATUS_BAR_LOCATION,L" Offset: %X %s",
  56. MainStatusBar.Offset,MainStatusBar.StatusString);
  57. Out->SetAttribute (Out,Orig.Data);
  58. MainEditor.FileBuffer->RestorePosition();
  59. return EFI_SUCCESS;
  60. }
  61. STATIC
  62. EFI_STATUS
  63. MainStatusBarHide ()
  64. {
  65. MainEditor.FileBuffer->ClearLine(STATUS_BAR_LOCATION);
  66. return EFI_SUCCESS;
  67. }
  68. STATIC
  69. EFI_STATUS
  70. MainStatusBarSetStatusString (
  71. IN CHAR16* Str
  72. )
  73. {
  74. if ( MainStatusBar.StatusString != NULL ) {
  75. FreePool (MainStatusBar.StatusString);
  76. }
  77. MainStatusBar.StatusString = StrDuplicate (Str);
  78. MainStatusBarRefresh();
  79. return EFI_SUCCESS;
  80. }
  81. STATIC
  82. EFI_STATUS
  83. MainStatusBarSetOffset (
  84. IN UINTN Offset
  85. )
  86. {
  87. MainStatusBar.Offset = Offset;
  88. MainStatusBar.Refresh();
  89. return EFI_SUCCESS;
  90. }
  91. #endif /* _LIB_STATUS_BAR */