Bugfixes to usermode 64-bit division, more work on GUI (now sizes almost correctly)
[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        *area;
19         tElement        *btn, *text;
20         
21         giInterface_Width = giScreenWidth/16;
22         
23         WM_SetFlags(NULL, 0);
24         
25         // -- Create Sidebar --
26         gpInterface_Sidebar = WM_CreateElement(NULL, ELETYPE_TOOLBAR, ELEFLAG_VERTICAL);
27         WM_SetSize( gpInterface_Sidebar, giInterface_Width );
28         
29         // --- Top segment ---
30         area = WM_CreateElement(gpInterface_Sidebar, ELETYPE_BOX, ELEFLAG_VERTICAL);
31         // ---- Menu Button ----
32         btn = WM_CreateElement(area, ELETYPE_BUTTON, ELEFLAG_NOSTRETCH);
33         WM_SetSize(btn, giInterface_Width);
34         //text = WM_CreateElement(btn, ELETYPE_IMAGE, ELEFLAG_SCALE);
35         //WM_SetText(text, "asset://LogoSmall.sif");
36         text = WM_CreateElement(btn, ELETYPE_TEXT, 0);
37         WM_SetText(text, "Acess");
38         
39         // ---- Plain <hr/> style spacer ----
40         WM_CreateElement(area, ELETYPE_SPACER, 0);
41         
42         // Windows Go Here
43         
44         // --- Bottom Segment ---
45         area = WM_CreateElement(gpInterface_Sidebar, ELETYPE_BOX, ELEFLAG_VERTICAL|ELEFLAG_ALIGN_END);
46         
47         // ---- Plain <hr/> style spacer ----
48         WM_CreateElement(area, ELETYPE_SPACER, 0);
49         
50         // ---- Version String ----
51         text = WM_CreateElement(area, ELETYPE_TEXT, ELEFLAG_WRAP);
52         WM_SetText(text, "AxWin 1.0");
53         
54         // -- Create Main Area and regions within --
55         gpInterface_MainArea = WM_CreateElement(NULL, ELETYPE_BOX, ELEFLAG_VERTICAL);
56         gpInterface_HeaderBar = WM_CreateElement(gpInterface_MainArea, ELETYPE_BOX, 0);
57         gpInterface_TabBar = WM_CreateElement(gpInterface_MainArea, ELETYPE_TABBAR, 0);
58         gpInterface_TabContent = WM_CreateElement(gpInterface_MainArea, ELETYPE_BOX, 0);
59 }
60
61 void Interface_Update(void)
62 {
63         giInterface_Width = giScreenWidth/16;
64         WM_SetSize( gpInterface_Sidebar, giInterface_Width );
65 }
66
67 void Interface_Render(void)
68 {
69         
70         Video_FillRect(
71                 0, 0,
72                 giInterface_Width, giScreenHeight,
73                 0xDDDDDD);
74         
75         Video_Update();
76 }

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