More work on the GUI. Still useless tho
[tpg/acess2.git] / Usermode / Applications / axwin2_src / WM / interface.c
1 /*
2  * Acess GUI (AxWin) Version 2
3  * By John Hodge (thePowersGang)
4  */
5 #include "common.h"
6
7 // === GLOBALS ==
8  int    giInterface_Width = 0;
9 tElement        *gpInterface_Sidebar;
10 tElement        *gpInterface_MainArea;
11 tElement        *gpInterface_HeaderBar;
12 tElement        *gpInterface_TabBar;
13 tElement        *gpInterface_TabContent;
14
15 // === CODE ===
16 void Interface_Init(void)
17 {
18         tElement        *btn, *text;
19         
20         giInterface_Width = giScreenWidth/16;
21         
22         WM_SetFlags(NULL, ELEFLAG_HORIZONTAL);
23         
24         // Create Sidebar
25         gpInterface_Sidebar = WM_CreateElement(NULL, ELETYPE_TOOLBAR, ELEFLAG_VERTICAL);
26         WM_SetSize( gpInterface_Sidebar, giInterface_Width );
27         // Create Main Area and regions within
28         gpInterface_MainArea = WM_CreateElement(NULL, ELETYPE_BOX, ELEFLAG_VERTICAL);
29         gpInterface_HeaderBar = WM_CreateElement(gpInterface_MainArea, ELETYPE_BOX, ELEFLAG_HORIZONTAL);
30         gpInterface_TabBar = WM_CreateElement(gpInterface_MainArea, ELETYPE_TABBAR, 0);
31         gpInterface_TabContent = WM_CreateElement(gpInterface_MainArea, ELETYPE_BOX, 0);
32         
33         // Menu Button
34         btn = WM_CreateElement(gpInterface_Sidebar, ELETYPE_BUTTON, 0);
35         WM_SetSize(btn, giInterface_Width);
36         //text = WM_CreateElement(btn, ELETYPE_IMAGE, ELEFLAG_SCALE);
37         //WM_SetText(text, "asset://LogoSmall.png");
38         text = WM_CreateElement(btn, ELETYPE_TEXT, 0);
39         WM_SetText(text, "Acess");
40         
41         // Plain <hr/> style spacer
42         WM_CreateElement(gpInterface_Sidebar, ELETYPE_SPACER, 0);
43         
44         // Create spacing gap (aligns the rest to the bottom/right)
45         WM_CreateElement(gpInterface_Sidebar, ELETYPE_GAP, 0);
46         
47         // Plain <hr/> style spacer
48         WM_CreateElement(gpInterface_Sidebar, ELETYPE_SPACER, 0);
49         
50         // Version String
51         text = WM_CreateElement(gpInterface_Sidebar, ELETYPE_TEXT, ELEFLAG_WRAP);
52         WM_SetText(text, "AxWin 1.0");
53 }
54
55 void Interface_Update(void)
56 {
57         giInterface_Width = giScreenWidth/16;
58         WM_SetSize( gpInterface_Sidebar, giInterface_Width );
59 }
60
61 void Interface_Render(void)
62 {
63         
64         Video_FillRect(
65                 0, 0,
66                 giInterface_Width, giScreenHeight,
67                 0xDDDDDD);
68         
69         Video_Update();
70 }

UCC git Repository :: git.ucc.asn.au