]> code.delx.au - refind/blob - refind/screen.h
Fixed bug that caused volume icons to be read only from default icons
[refind] / refind / screen.h
1 /*
2 * refit/screen.h
3 * Screen management header file
4 *
5 * Copyright (c) 2006-2009 Christoph Pfisterer
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are
10 * met:
11 *
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * * Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the
18 * distribution.
19 *
20 * * Neither the name of Christoph Pfisterer nor the names of the
21 * contributors may be used to endorse or promote products derived
22 * from this software without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
28 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 */
36
37 #ifndef __SCREEN_H_
38 #define __SCREEN_H_
39
40 #ifdef __MAKEWITH_GNUEFI
41 #include "efi.h"
42 #include "efilib.h"
43 #else
44 #include "../include/tiano_includes.h"
45 #endif
46
47 #include "libeg.h"
48
49 //
50 // screen module
51 //
52
53 #define DONT_CHANGE_TEXT_MODE 1024 /* textmode # that's a code to not change the text mode */
54
55 #define ATTR_BASIC (EFI_LIGHTGRAY | EFI_BACKGROUND_BLACK)
56 #define ATTR_ERROR (EFI_YELLOW | EFI_BACKGROUND_BLACK)
57 #define ATTR_BANNER (EFI_WHITE | EFI_BACKGROUND_BLUE)
58 #define ATTR_CHOICE_BASIC ATTR_BASIC
59 #define ATTR_CHOICE_CURRENT (EFI_WHITE | EFI_BACKGROUND_GREEN)
60 #define ATTR_SCROLLARROW (EFI_LIGHTGREEN | EFI_BACKGROUND_BLACK)
61
62 //#define LAYOUT_TEXT_WIDTH (512)
63 //#define LAYOUT_TEXT_WIDTH (425)
64 #define LAYOUT_BANNER_YGAP 32
65
66 //#define FONT_CELL_WIDTH (7)
67 //#define FONT_CELL_HEIGHT (12)
68
69 extern UINTN ConWidth;
70 extern UINTN ConHeight;
71 extern CHAR16 *BlankLine;
72
73 extern UINTN UGAWidth;
74 extern UINTN UGAHeight;
75 extern BOOLEAN AllowGraphicsMode;
76
77 extern EG_PIXEL StdBackgroundPixel;
78 extern EG_PIXEL MenuBackgroundPixel;
79
80 VOID InitScreen(VOID);
81 VOID SetupScreen(VOID);
82 VOID BeginTextScreen(IN CHAR16 *Title);
83 VOID FinishTextScreen(IN BOOLEAN WaitAlways);
84 VOID BeginExternalScreen(IN BOOLEAN UseGraphicsMode, IN CHAR16 *Title);
85 VOID FinishExternalScreen(VOID);
86 VOID TerminateScreen(VOID);
87 VOID DrawScreenHeader(IN CHAR16 *Title);
88
89 #if REFIT_DEBUG > 0
90 VOID DebugPause(VOID);
91 #else
92 #define DebugPause()
93 #endif
94 VOID EndlessIdleLoop(VOID);
95 BOOLEAN ReadAllKeyStrokes(VOID);
96 VOID PauseForKey(VOID);
97 VOID PauseSeconds(UINTN Seconds);
98
99 BOOLEAN CheckFatalError(IN EFI_STATUS Status, IN CHAR16 *where);
100 BOOLEAN CheckError(IN EFI_STATUS Status, IN CHAR16 *where);
101
102 VOID SwitchToText(IN BOOLEAN CursorEnabled);
103 VOID SwitchToGraphics(VOID);
104
105 VOID SwitchToGraphicsAndClear(VOID);
106 VOID BltClearScreen(IN BOOLEAN ShowBanner);
107 VOID BltImage(IN EG_IMAGE *Image, IN UINTN XPos, IN UINTN YPos);
108 VOID BltImageAlpha(IN EG_IMAGE *Image, IN UINTN XPos, IN UINTN YPos, IN EG_PIXEL *BackgroundPixel);
109 //VOID BltImageComposite(IN EG_IMAGE *BaseImage, IN EG_IMAGE *TopImage, IN UINTN XPos, IN UINTN YPos);
110 VOID BltImageCompositeBadge(IN EG_IMAGE *BaseImage, IN EG_IMAGE *TopImage, IN EG_IMAGE *BadgeImage, IN UINTN XPos, IN UINTN YPos);
111
112 #endif