65632bb1f50b804da7d173b30e26fa019dc4aee7
[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 #include "resources/LogoSmall.sif.res.h"
10
11 // === GLOBALS ==
12  int    giInterface_Width = 0;
13  int    giInterface_HeaderBarSize = 20;
14  int    giInterface_TabBarSize = 20;
15 tElement        *gpInterface_Sidebar;
16 tElement        *gpInterface_ProgramList;
17 tElement        *gpInterface_MainArea;
18 tElement        *gpInterface_HeaderBar;
19 tElement        *gpInterface_TabBar;
20 tElement        *gpInterface_TabContent;
21 const char      csLogoSmall[] = "base64:///"RESOURCE_LogoSmall_sif;
22
23 // === CODE ===
24 /**
25  * \brief Initialise the UI
26  */
27 void Interface_Init(void)
28 {
29         tElement        *btn, *text;
30         tElement        *ele;
31
32         // Calculate sizes
33         giInterface_Width = giScreenWidth/16;
34         
35         // Set root window to no-border
36         AxWin_SetFlags(NULL, 0);
37         
38         // -- Create Sidebar (Menu and Window List) --
39         gpInterface_Sidebar = AxWin_CreateElement(NULL, ELETYPE_TOOLBAR, ELEFLAG_VERTICAL, "Sidebar");
40         AxWin_SetSize( gpInterface_Sidebar, giInterface_Width );
41         
42         // > System Menu Button
43         btn = AxWin_CreateElement(gpInterface_Sidebar, ELETYPE_BUTTON, ELEFLAG_NOSTRETCH, "SystemMenu");
44         AxWin_SetSize(btn, giInterface_Width-4);
45         //text = AxWin_CreateElement(btn, ELETYPE_IMAGE, ELEFLAG_SCALE, "MenuLogo");
46         text = AxWin_CreateElement(btn, ELETYPE_IMAGE, 0, "MenuLogo");
47         //AxWin_SetText(text, "file:///LogoSmall.sif");
48         AxWin_SetText(text, csLogoSmall);
49         
50         // > Plain <hr/> style spacer
51         ele = AxWin_CreateElement(gpInterface_Sidebar, ELETYPE_SPACER, ELEFLAG_NOSTRETCH, "SideBar Spacer Top");
52         AxWin_SetSize(ele, 4);
53         
54         // > Application List (Window list on most OSs)
55         gpInterface_ProgramList = AxWin_CreateElement(gpInterface_Sidebar, ELETYPE_BOX, ELEFLAG_VERTICAL, "ProgramList");
56         
57         // > Plain <hr/> style spacer
58         ele = AxWin_CreateElement(gpInterface_Sidebar, ELETYPE_SPACER, ELEFLAG_NOSTRETCH, "SideBar Spacer Bottom");
59         AxWin_SetSize(ele, 4);
60         
61         // > Version/Time
62         text = AxWin_CreateElement(gpInterface_Sidebar, ELETYPE_TEXT, ELEFLAG_NOSTRETCH, "Version String");
63         AxWin_SetSize(text, 20);
64         AxWin_SetText(text, "2.0");
65         
66         // --
67         // -- Create Main Area and regions within --
68         // --
69         // > Righthand Area
70         gpInterface_MainArea = AxWin_CreateElement(NULL, ELETYPE_BOX, ELEFLAG_VERTICAL, "MainArea");
71         //  > Header Bar (Title)
72         gpInterface_HeaderBar = AxWin_CreateElement(gpInterface_MainArea, ELETYPE_BOX, 0, "HeaderBar");
73         AxWin_SetSize(gpInterface_HeaderBar, giInterface_HeaderBarSize);
74         text = AxWin_CreateElement(gpInterface_HeaderBar, ELETYPE_TEXT, 0, NULL);
75         AxWin_SetText(text, "Acess2 GUI - By thePowersGang (John Hodge)");
76         //  > Tab Bar (Current windows)
77         gpInterface_TabBar = AxWin_CreateElement(gpInterface_MainArea, ELETYPE_TABBAR, 0, "TabBar");
78         AxWin_SetSize(gpInterface_TabBar, giInterface_TabBarSize);
79         //  > Application Space
80         gpInterface_TabContent = AxWin_CreateElement(gpInterface_MainArea, ELETYPE_BOX, 0, "TabContent");
81 }
82
83 void Interface_Update(void)
84 {
85         giInterface_Width = giScreenWidth/16;
86         AxWin_SetSize( gpInterface_Sidebar, giInterface_Width );
87 }
88
89 void Interface_Render(void)
90 {
91         
92         Video_FillRect(
93                 0, 0,
94                 giInterface_Width, giScreenHeight,
95                 0xDDDDDD);
96         
97         Video_Update();
98 }

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