AxWin2 - More fiddling, working in windows
authorJohn Hodge <[email protected]>
Mon, 6 Jun 2011 06:03:09 +0000 (14:03 +0800)
committerJohn Hodge <[email protected]>
Mon, 6 Jun 2011 06:03:09 +0000 (14:03 +0800)
Usermode/Applications/axwin2_src/WM/render.c
Usermode/Applications/axwin2_src/WM/wm.c
Usermode/Applications/axwin2_src/WM/wm.h

index 21237e0..50eca9e 100644 (file)
@@ -269,16 +269,39 @@ void WM_RenderWidget(tElement *Element)
        }
 }
 
+void WM_UpdateWindow(tElement *Ele)
+{      
+       WM_UpdateDimensions( Ele, 0 );
+       WM_UpdatePosition( Ele );
+       WM_RenderWidget( Ele );
+}
+
 void WM_Update(void)
 {
-       gWM_RootElement.CachedX = 0;    gWM_RootElement.CachedY = 0;
+       tApplication    *app;
+       tElement        *ele;
+       
+       for( app = gWM_Applications; app; app = app->Next )
+       {
+               for( ele = app->MetaElement.FirstChild; ele; ele = ele->NextSibling ) {
+                       if( ele->Flags & ELEFLAG_WINDOW_MAXIMISED ) {
+                               ele->CachedX = giWM_MaxAreaX;
+                               ele->CachedY = giWM_MaxAreaY;
+                               ele->CachedW = giWM_MaxAreaW;
+                               ele->CachedH = giWM_MaxAreaH;
+                       }
+                       ele->Flags |= ELEFLAG_NOEXPAND|ELEFLAG_ABSOLUTEPOS|ELEFLAG_FIXEDSIZE;
+                       WM_UpdateWindow(ele);
+               }
+       }
+       
+       gWM_RootElement.CachedX = 0;
+       gWM_RootElement.CachedY = 0;
        gWM_RootElement.CachedW = giScreenWidth;
        gWM_RootElement.CachedH = giScreenHeight;
        gWM_RootElement.Flags |= ELEFLAG_NOEXPAND|ELEFLAG_ABSOLUTEPOS|ELEFLAG_FIXEDSIZE;
        
-       WM_UpdateDimensions( &gWM_RootElement, 0 );
-       WM_UpdatePosition( &gWM_RootElement );
-       WM_RenderWidget( &gWM_RootElement );
+       WM_UpdateWindow( &gWM_RootElement );
        
        Video_Update();
 }
index 8b70936..1bc8db2 100644 (file)
@@ -28,7 +28,13 @@ void AxWin_SetText(tElement *Element, const char *Text);
 tElement       gWM_RootElement = {
        .DebugName = "ROOT"
 };
+tWindow        *gWM_WindowFirst;
+tWindow        *gWM_WindowLast;
 tApplication   *gWM_Applications;
+ int   giWM_MaxAreaX = 0;
+ int   giWM_MaxAreaY = 0;
+ int   giWM_MaxAreaW = -1;
+ int   giWM_MaxAreaH = -1;
 
 // --- Element type flags
 struct {
@@ -128,9 +134,25 @@ tApplication *AxWin_GetClient(tIPC_Type *Method, void *Ident)
 tElement *AxWin_CreateAppWindow(tApplication *App, const char *Name)
 {
        tElement        *ret;
+       tWindow *win;
+       
+       win = calloc(sizeof(tWindow) + 1);
+       if(!win)        return NULL;
+       
+       ret = &win->Element;
+       ret->Type = ELETYPE_WINDOW;
+       ret->Data = win;
+       ret->Parent = &App->MetaElement;
+       
+       // Add to parent list
+       if(ret->Parent->LastChild)
+               ret->Parent->LastChild->NextSibling = ret;
+       ret->Parent->LastChild = ret;
+       if(!ret->Parent->FirstChild)
+               ret->Parent->FirstChild = ret;
        
-       ret = AxWin_CreateElement(&App->MetaElement, ELETYPE_WINDOW, 0, NULL);
        ret->Text = strdup(Name);
+       
        return ret;
 }
 
index ab2a629..df4f860 100644 (file)
@@ -15,6 +15,7 @@
 #define DEFAULT_ELEMENTS_PER_APP       128
 
 typedef struct sAxWin_Element  tElement;
+typedef struct sWindow tWindow;
 typedef struct sApplication    tApplication;
 
 struct sAxWin_Element
@@ -38,7 +39,7 @@ struct sAxWin_Element
        
        uint32_t        Flags;
        
-       short   FixedWith;      //!< Fixed Long Size attribute (height)
+       short   FixedWith;      //!< Fixed lengthways Size attribute (height)
        short   FixedCross;     //!< Fixed Cross Size attribute (width)
        
        char    *Text;
@@ -56,6 +57,16 @@ struct sAxWin_Element
        char    DebugName[];
 };
 
+struct sWindow
+{
+        int    X, Y, W, H;
+       tImage  *Icon;
+       
+       tWindow *OrderNext;     // Render order
+       
+       tElement        Element;
+};
+
 struct sApplication
 {
        tApplication    *Next;

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