}
}
+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();
}
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 {
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;
}
#define DEFAULT_ELEMENTS_PER_APP 128
typedef struct sAxWin_Element tElement;
+typedef struct sWindow tWindow;
typedef struct sApplication tApplication;
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;
char DebugName[];
};
+struct sWindow
+{
+ int X, Y, W, H;
+ tImage *Icon;
+
+ tWindow *OrderNext; // Render order
+
+ tElement Element;
+};
+
struct sApplication
{
tApplication *Next;