af02429a562dc577bb4ed26f26482595fb7a0d81
[tpg/acess2.git] / Usermode / Applications / axwin2_src / WM / interface.c
1 /*
2  * Acess GUI (AxWin) Version 2
3  * By John Hodge (thePowersGang)
4  * 
5  * interface.c
6  * > Main Overarching UI
7  */
8 #include "common.h"
9
10 // === GLOBALS ==
11  int    giInterface_Width = 0;
12 tElement        *gpInterface_Sidebar;
13 tElement        *gpInterface_MainArea;
14 tElement        *gpInterface_HeaderBar;
15 tElement        *gpInterface_TabBar;
16 tElement        *gpInterface_TabContent;
17
18 // === CODE ===
19 /**
20  * \brief Initialise the UI
21  */
22 void Interface_Init(void)
23 {
24         tElement        *area;
25         tElement        *btn, *text;
26         
27         // Calculate sizes
28         giInterface_Width = giScreenWidth/16;
29         
30         // Set root window to no-border
31         WM_SetFlags(NULL, 0);
32         
33         // -- Create Sidebar --
34         gpInterface_Sidebar = WM_CreateElement(NULL, ELETYPE_TOOLBAR, ELEFLAG_VERTICAL);
35         WM_SetSize( gpInterface_Sidebar, giInterface_Width );
36         
37         // --- Top segment ---
38         area = WM_CreateElement(gpInterface_Sidebar, ELETYPE_BOX, ELEFLAG_VERTICAL);
39         // ---- Menu Button ----
40         btn = WM_CreateElement(area, ELETYPE_BUTTON, ELEFLAG_NOSTRETCH);
41         WM_SetSize(btn, giInterface_Width);
42         //text = WM_CreateElement(btn, ELETYPE_IMAGE, ELEFLAG_SCALE);
43         //WM_SetText(text, "asset://LogoSmall.sif");
44         text = WM_CreateElement(btn, ELETYPE_TEXT, 0);
45         WM_SetText(text, "Acess");
46         
47         // ---- Plain <hr/> style spacer ----
48         WM_CreateElement(area, ELETYPE_SPACER, 0);
49         
50         // Open Windows Go Here
51         
52         // --- Bottom Segment ---
53         area = WM_CreateElement(gpInterface_Sidebar, ELETYPE_BOX, ELEFLAG_VERTICAL|ELEFLAG_ALIGN_END);
54         
55         // ---- Plain <hr/> style spacer ----
56         WM_CreateElement(area, ELETYPE_SPACER, 0);
57         
58         // ---- Version String ----
59         text = WM_CreateElement(area, ELETYPE_TEXT, ELEFLAG_WRAP);
60         WM_SetText(text, "AxWin 1.0");
61         
62         // -- Create Main Area and regions within --
63         gpInterface_MainArea = WM_CreateElement(NULL, ELETYPE_BOX, ELEFLAG_VERTICAL);
64         gpInterface_HeaderBar = WM_CreateElement(gpInterface_MainArea, ELETYPE_BOX, 0);
65         gpInterface_TabBar = WM_CreateElement(gpInterface_MainArea, ELETYPE_TABBAR, 0);
66         gpInterface_TabContent = WM_CreateElement(gpInterface_MainArea, ELETYPE_BOX, 0);
67 }
68
69 void Interface_Update(void)
70 {
71         giInterface_Width = giScreenWidth/16;
72         WM_SetSize( gpInterface_Sidebar, giInterface_Width );
73 }
74
75 void Interface_Render(void)
76 {
77         
78         Video_FillRect(
79                 0, 0,
80                 giInterface_Width, giScreenHeight,
81                 0xDDDDDD);
82         
83         Video_Update();
84 }

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