grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / c / Unpack / gui.c
blob88e6d182642144f99fbcab793310412339d74df1
1 /*
2 Copyright © 2003, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <exec/types.h>
7 #include <intuition/intuition.h>
8 #include <utility/tagitem.h>
9 #include <proto/intuition.h>
10 #include <proto/graphics.h>
12 #include "gui.h"
14 struct Window *background = NULL;
15 struct Window *window = NULL;
16 struct Screen *screen = NULL;
17 struct RastPort *rp = NULL;
18 WORD width, height;
20 BOOL GUI_Open()
22 screen = LockPubScreen( NULL );
23 if( screen != NULL )
25 width = screen->Width / 3;
26 height = width / 12;
28 background = OpenWindowTags
30 NULL,
31 WA_Left, 0,
32 WA_Top, 0,
33 WA_Width, screen->Width,
34 WA_Height, screen->Height,
35 WA_Borderless, TRUE,
36 TAG_DONE
39 window = OpenWindowTags
41 NULL,
42 WA_Title, (IPTR) "Unpacking...",
43 WA_InnerWidth, width,
44 WA_InnerHeight, height,
45 WA_Left, screen->Width / 2 - width / 2,
46 WA_Top, screen->Height / 2 - height / 2,
47 WA_GimmeZeroZero, TRUE,
48 WA_Activate, TRUE,
49 WA_DragBar, TRUE,
50 WA_CustomScreen, (IPTR) screen,
51 TAG_DONE
52 );
54 if( background != NULL && window != NULL )
56 SetAPen( background->RPort, 1 );
57 RectFill( background->RPort, 0, 0, screen->Width, screen->Height );
59 rp = window->RPort;
60 SetAPen( rp, 3 );
62 return TRUE;
66 GUI_Close();
68 return FALSE;
71 void GUI_Close()
73 if( window != NULL ) CloseWindow( window );
74 if( background != NULL ) CloseWindow( background );
75 if( screen != NULL ) UnlockPubScreen( NULL, screen );
77 CloseWorkBench();
80 void GUI_Update( LONG position, LONG max )
82 static WORD oldx = 0;
83 WORD newx;
85 newx = (position * width) / max;
86 if( newx > oldx )
88 RectFill( rp, oldx, 0, newx, height );
89 oldx = newx;