Usermode - Removed SpiderScript
[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 tApplication    *gpInterface_CurrentApp;
23
24 typedef struct sApplicationLink tApplicationLink;
25
26 struct sApplicationLink {
27         tApplication    *App;
28         tElement        *Button;
29         char    Name[];
30 };
31
32 // === CODE ===
33 /**
34  * \brief Initialise the UI
35  */
36 void Interface_Init(void)
37 {
38         tElement        *btn, *text;
39         tElement        *ele;
40
41         // Calculate sizes
42         giInterface_Width = giScreenWidth/16;
43         
44         // Set root window to no-border
45         AxWin_SetFlags(NULL, 0);
46         
47         // -- Create Sidebar (Menu and Window List) --
48         gpInterface_Sidebar = AxWin_CreateElement(NULL, ELETYPE_TOOLBAR, ELEFLAG_VERTICAL, "Sidebar");
49         AxWin_SetSize( gpInterface_Sidebar, giInterface_Width );
50         
51         // > System Menu Button
52         btn = AxWin_CreateElement(gpInterface_Sidebar, ELETYPE_BUTTON, ELEFLAG_NOSTRETCH, "SystemMenu");
53         AxWin_SetSize(btn, giInterface_Width-4);
54         //text = AxWin_CreateElement(btn, ELETYPE_IMAGE, ELEFLAG_SCALE, "MenuLogo");
55         text = AxWin_CreateElement(btn, ELETYPE_IMAGE, 0, "MenuLogo");
56         //AxWin_SetText(text, "file:///LogoSmall.sif");
57         AxWin_SetText(text, csLogoSmall);
58         
59         // > Plain <hr/> style spacer
60         ele = AxWin_CreateElement(gpInterface_Sidebar, ELETYPE_SPACER, ELEFLAG_NOSTRETCH, "SideBar Spacer Top");
61         AxWin_SetSize(ele, 4);
62         
63         // > Application List (Window list on most OSs)
64         gpInterface_ProgramList = AxWin_CreateElement(gpInterface_Sidebar, ELETYPE_BOX, ELEFLAG_VERTICAL, "ProgramList");
65         
66         // > Plain <hr/> style spacer
67         ele = AxWin_CreateElement(gpInterface_Sidebar, ELETYPE_SPACER, ELEFLAG_NOSTRETCH, "SideBar Spacer Bottom");
68         AxWin_SetSize(ele, 4);
69         
70         // > Version/Time
71         text = AxWin_CreateElement(gpInterface_Sidebar, ELETYPE_TEXT, ELEFLAG_NOSTRETCH, "Version String");
72         AxWin_SetSize(text, 20);
73         AxWin_SetText(text, "2.0");
74         
75         // --
76         // -- Create Main Area and regions within --
77         // --
78         // > Righthand Area
79         gpInterface_MainArea = AxWin_CreateElement(NULL, ELETYPE_BOX, ELEFLAG_VERTICAL, "MainArea");
80         //  > Header Bar (Title)
81         gpInterface_HeaderBar = AxWin_CreateElement(gpInterface_MainArea, ELETYPE_BOX, 0, "HeaderBar");
82         AxWin_SetSize(gpInterface_HeaderBar, giInterface_HeaderBarSize);
83         text = AxWin_CreateElement(gpInterface_HeaderBar, ELETYPE_TEXT, 0, NULL);
84         AxWin_SetText(text, "Acess2 GUI - By thePowersGang (John Hodge)");
85         //  > Tab Bar (Current windows)
86         gpInterface_TabBar = AxWin_CreateElement(gpInterface_MainArea, ELETYPE_TABBAR, 0, "TabBar");
87         AxWin_SetSize(gpInterface_TabBar, giInterface_TabBarSize);
88         //  > Application Space
89         gpInterface_TabContent = AxWin_CreateElement(gpInterface_MainArea, ELETYPE_BOX, 0, "TabContent");
90 }
91
92 void Interface_Update(void)
93 {
94 //      tApplication    *app;
95 //      tApplicationLink        *lnk;
96         giInterface_Width = giScreenWidth/16;
97         AxWin_SetSize( gpInterface_Sidebar, giInterface_Width );
98
99         // Scan application list for changes
100         // - HACK for now, just directly access it
101 //      for( app = gWM_Applications; app; app = app->Next )
102 //      {
103 //              AxWin_CreateElement();
104 //      }
105
106         // Update current tab list
107 }
108
109 void Interface_Render(void)
110 {
111         Video_FillRect(
112                 0, 0,
113                 giInterface_Width, giScreenHeight,
114                 0xDDDDDD);
115         
116         Video_Update();
117 }

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