TODO
[tpg/acess2.git] / Usermode / Applications / axwin2_src / WM / interface.c
index 52030f3..91396ee 100644 (file)
 /*
  * Acess GUI (AxWin) Version 2
  * By John Hodge (thePowersGang)
+ * 
+ * interface.c
+ * > Main Overarching UI
  */
 #include "common.h"
+#include "resources/LogoSmall.sif.res.h"
 
 // === GLOBALS ==
  int   giInterface_Width = 0;
+ int   giInterface_HeaderBarSize = 20;
+ int   giInterface_TabBarSize = 20;
 tElement       *gpInterface_Sidebar;
+tElement       *gpInterface_ProgramList;
 tElement       *gpInterface_MainArea;
 tElement       *gpInterface_HeaderBar;
 tElement       *gpInterface_TabBar;
 tElement       *gpInterface_TabContent;
+const char     csLogoSmall[] = "base64:///"RESOURCE_LogoSmall_sif;
+tApplication   *gpInterface_CurrentApp;
+
+typedef struct sApplicationLink        tApplicationLink;
+
+struct sApplicationLink {
+       tApplication    *App;
+       tElement        *Button;
+       char    Name[];
+};
 
 // === CODE ===
+/**
+ * \brief Initialise the UI
+ */
 void Interface_Init(void)
 {
-       tElement        *area;
        tElement        *btn, *text;
-       
+       tElement        *ele;
+
+       // Calculate sizes
        giInterface_Width = giScreenWidth/16;
        
-       WM_SetFlags(NULL, 0);
+       // Set root window to no-border
+       AxWin_SetFlags(NULL, 0);
        
-       // -- Create Sidebar --
-       gpInterface_Sidebar = WM_CreateElement(NULL, ELETYPE_TOOLBAR, ELEFLAG_VERTICAL);
-       WM_SetSize( gpInterface_Sidebar, giInterface_Width );
+       // -- Create Sidebar (Menu and Window List) --
+       gpInterface_Sidebar = AxWin_CreateElement(NULL, ELETYPE_TOOLBAR, ELEFLAG_VERTICAL, "Sidebar");
+       AxWin_SetSize( gpInterface_Sidebar, giInterface_Width );
        
-       // --- Top segment ---
-       area = WM_CreateElement(gpInterface_Sidebar, ELETYPE_BOX, ELEFLAG_VERTICAL);
-       // ---- Menu Button ----
-       btn = WM_CreateElement(area, ELETYPE_BUTTON, ELEFLAG_NOSTRETCH);
-       WM_SetSize(btn, giInterface_Width);
-       //text = WM_CreateElement(btn, ELETYPE_IMAGE, ELEFLAG_SCALE);
-       //WM_SetText(text, "asset://LogoSmall.sif");
-       text = WM_CreateElement(btn, ELETYPE_TEXT, 0);
-       WM_SetText(text, "Acess");
+       // > System Menu Button
+       btn = AxWin_CreateElement(gpInterface_Sidebar, ELETYPE_BUTTON, ELEFLAG_NOSTRETCH, "SystemMenu");
+       AxWin_SetSize(btn, giInterface_Width-4);
+       //text = AxWin_CreateElement(btn, ELETYPE_IMAGE, ELEFLAG_SCALE, "MenuLogo");
+       text = AxWin_CreateElement(btn, ELETYPE_IMAGE, 0, "MenuLogo");
+       //AxWin_SetText(text, "file:///LogoSmall.sif");
+       AxWin_SetText(text, csLogoSmall);
        
-       // ---- Plain <hr/> style spacer ----
-       WM_CreateElement(area, ELETYPE_SPACER, 0);
+       // > Plain <hr/> style spacer
+       ele = AxWin_CreateElement(gpInterface_Sidebar, ELETYPE_SPACER, ELEFLAG_NOSTRETCH, "SideBar Spacer Top");
+       AxWin_SetSize(ele, 4);
        
-       // Windows Go Here
+       // > Application List (Window list on most OSs)
+       gpInterface_ProgramList = AxWin_CreateElement(gpInterface_Sidebar, ELETYPE_BOX, ELEFLAG_VERTICAL, "ProgramList");
        
-       // --- Bottom Segment ---
-       area = WM_CreateElement(gpInterface_Sidebar, ELETYPE_BOX, ELEFLAG_VERTICAL|ELEFLAG_ALIGN_END);
+       // > Plain <hr/> style spacer
+       ele = AxWin_CreateElement(gpInterface_Sidebar, ELETYPE_SPACER, ELEFLAG_NOSTRETCH, "SideBar Spacer Bottom");
+       AxWin_SetSize(ele, 4);
        
-       // ---- Plain <hr/> style spacer ----
-       WM_CreateElement(area, ELETYPE_SPACER, 0);
-       
-       // ---- Version String ----
-       text = WM_CreateElement(area, ELETYPE_TEXT, ELEFLAG_WRAP);
-       WM_SetText(text, "AxWin 1.0");
+       // > Version/Time
+       text = AxWin_CreateElement(gpInterface_Sidebar, ELETYPE_TEXT, ELEFLAG_NOSTRETCH, "Version String");
+       AxWin_SetSize(text, 20);
+       AxWin_SetText(text, "2.0");
        
+       // --
        // -- Create Main Area and regions within --
-       gpInterface_MainArea = WM_CreateElement(NULL, ELETYPE_BOX, ELEFLAG_VERTICAL);
-       gpInterface_HeaderBar = WM_CreateElement(gpInterface_MainArea, ELETYPE_BOX, 0);
-       gpInterface_TabBar = WM_CreateElement(gpInterface_MainArea, ELETYPE_TABBAR, 0);
-       gpInterface_TabContent = WM_CreateElement(gpInterface_MainArea, ELETYPE_BOX, 0);
+       // --
+       // > Righthand Area
+       gpInterface_MainArea = AxWin_CreateElement(NULL, ELETYPE_BOX, ELEFLAG_VERTICAL, "MainArea");
+       //  > Header Bar (Title)
+       gpInterface_HeaderBar = AxWin_CreateElement(gpInterface_MainArea, ELETYPE_BOX, 0, "HeaderBar");
+       AxWin_SetSize(gpInterface_HeaderBar, giInterface_HeaderBarSize);
+       text = AxWin_CreateElement(gpInterface_HeaderBar, ELETYPE_TEXT, 0, NULL);
+       AxWin_SetText(text, "Acess2 GUI - By thePowersGang (John Hodge)");
+       //  > Tab Bar (Current windows)
+       gpInterface_TabBar = AxWin_CreateElement(gpInterface_MainArea, ELETYPE_TABBAR, 0, "TabBar");
+       AxWin_SetSize(gpInterface_TabBar, giInterface_TabBarSize);
+       //  > Application Space
+       gpInterface_TabContent = AxWin_CreateElement(gpInterface_MainArea, ELETYPE_BOX, 0, "TabContent");
 }
 
 void Interface_Update(void)
 {
+//     tApplication    *app;
+//     tApplicationLink        *lnk;
        giInterface_Width = giScreenWidth/16;
-       WM_SetSize( gpInterface_Sidebar, giInterface_Width );
+       AxWin_SetSize( gpInterface_Sidebar, giInterface_Width );
+
+       // Scan application list for changes
+       // - HACK for now, just directly access it
+//     for( app = gWM_Applications; app; app = app->Next )
+//     {
+//             AxWin_CreateElement();
+//     }
+
+       // Update current tab list
 }
 
 void Interface_Render(void)
 {
-       
        Video_FillRect(
                0, 0,
                giInterface_Width, giScreenHeight,

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