Leaked source code of windows server 2003
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.

99 lines
1.9 KiB

  1. /*++
  2. Copyright (c) 1999 Intel Corporation
  3. Module Name:
  4. libTitle.c
  5. Abstract:
  6. Defines the TitleBar data type
  7. --*/
  8. #ifndef _LIB_TITLE_BAR
  9. #define _LIB_TITLE_BAR
  10. #include "libMisc.h"
  11. STATIC EFI_STATUS TitleBarInit (VOID);
  12. STATIC EFI_STATUS TitleBarCleanup (VOID);
  13. STATIC EFI_STATUS TitleBarRefresh (VOID);
  14. STATIC EFI_STATUS TitleBarHide (VOID);
  15. STATIC EFI_STATUS TitleBarSetTitle (CHAR16*);
  16. EE_TITLE_BAR TitleBar = {
  17. NULL,
  18. TitleBarInit,
  19. TitleBarCleanup,
  20. TitleBarRefresh,
  21. TitleBarHide,
  22. TitleBarSetTitle
  23. };
  24. STATIC
  25. EFI_STATUS
  26. TitleBarInit ()
  27. {
  28. CHAR16 *Filename;
  29. Filename = PoolPrint(L"New File");
  30. TitleBarSetTitle(Filename);
  31. FreePool(Filename);
  32. return EFI_SUCCESS;
  33. }
  34. STATIC
  35. EFI_STATUS
  36. TitleBarCleanup ()
  37. {
  38. MainEditor.FileBuffer->ClearLine (TITLE_BAR_LOCATION);
  39. if (TitleBar.Filename) {
  40. FreePool (TitleBar.Filename);
  41. }
  42. return EFI_SUCCESS;
  43. }
  44. STATIC
  45. EFI_STATUS
  46. TitleBarRefresh ()
  47. {
  48. EE_COLOR_UNION Orig,New;
  49. Orig = MainEditor.ColorAttributes;
  50. New.Colors.Foreground = Orig.Colors.Background;
  51. New.Colors.Background = Orig.Colors.Foreground;
  52. Out->SetAttribute (Out,New.Data);
  53. MainEditor.FileBuffer->ClearLine(TITLE_BAR_LOCATION);
  54. PrintAt (0,TITLE_BAR_LOCATION,L" %s %s %s ",EDITOR_NAME,EDITOR_VERSION,TitleBar.Filename);
  55. Out->SetAttribute (Out,Orig.Data);
  56. return EFI_SUCCESS;
  57. }
  58. STATIC
  59. EFI_STATUS
  60. TitleBarHide ()
  61. {
  62. MainEditor.FileBuffer->ClearLine (TITLE_BAR_LOCATION);
  63. return EFI_SUCCESS;
  64. }
  65. STATIC
  66. EFI_STATUS
  67. TitleBarSetTitle (CHAR16* Filename)
  68. {
  69. if (TitleBar.Filename != NULL ) {
  70. FreePool (TitleBar.Filename);
  71. }
  72. TitleBar.Filename = StrDuplicate (Filename);
  73. TitleBar.Refresh();
  74. return EFI_SUCCESS;
  75. }
  76. #endif /* _LIB_TITLE_BAR */