-
+/*
+ * Acess2 Window Manager (AxWin2)
+ */
#ifndef _WM_H_
#define _WM_H_
-typedef struct sElement
+#include <axwin2/axwin.h>
+#include "common.h"
+
+/**
+ * \brief Number of elements that can be owned by each application)
+ */
+// TODO: Fine tune these values
+#define MAX_ELEMENTS_PER_APP 1024
+#define DEFAULT_ELEMENTS_PER_APP 128
+
+typedef struct sAxWin_Element tElement;
+typedef struct sApplication tApplication;
+
+struct sAxWin_Element
{
- int Type;
+ enum eElementTypes Type;
- struct sElement *Parent;
- struct sElement *FirstChild;
- struct sElement *LastChild;
- struct sElement *NextSibling;
+ // Element Tree
+ tElement *Parent;
+ tElement *FirstChild;
+ tElement *LastChild;
+ tElement *NextSibling;
+ // Application
+ tApplication *Owner; //!< Owning application
+ uint16_t ApplicationID; //!< Index into sApplication::EleIndex
+
+ // User modifiable attributes
+ short PaddingL, PaddingR;
+ short PaddingT, PaddingB;
+ short GapSize;
- short CachedX;
- short CachedY;
- short CachedW;
- short CachedH;
+ uint32_t Flags;
- short Size; // Size attribute
+ short FixedWith; //!< Fixed Long Size attribute (height)
+ short FixedCross; //!< Fixed Cross Size attribute (width)
char *Text;
- void *Data;
-
- uint32_t Flags;
-} tElement;
-
-typedef struct sTab
-{
- int Type; // Should be zero, allows a tab to be the parent of an element
- struct sElement *Parent;
- struct sElement *FirstChild;
- struct sElement *LastChild;
+ // -- Attributes maitained by the element code
+ // Not touched by the user
+ short MinWith; //!< Minimum long size
+ short MinCross; //!< Minimum cross size
+ void *Data; //!< Per-type data
- char *Name;
+ // -- Render Cache
+ short CachedX, CachedY;
+ short CachedW, CachedH;
- tElement *RootElement;
-} tTab;
+ char DebugName[];
+};
-typedef struct sApplication
+struct sApplication
{
- pid_t PID;
-
- int nTabs;
- tTab *Tabs;
-
- char Name[];
-} tApplication;
+ tApplication *Next;
-// === CONSTANTS ===
-enum eElementFlags
-{
- ELEFLAG_VISIBLE = 0x001, ELEFLAG_INVISIBLE = 0x000,
- ELEFLAG_VERTICAL = 0x002, ELEFLAG_HORIZONTAL = 0x000,
- ELEFLAG_WRAP = 0x004, ELEFLAG_NOWRAP = 0x000,
-};
-/**
- */
-enum eElementTypes
-{
- ELETYPE_NONE,
-
- ELETYPE_BOX, //!< Content box
- ELETYPE_TABBAR, //!< Tab Bar
- ELETYPE_TOOLBAR, //!< Tool Bar
+ void *Ident; //!< Client Identifier
+ tMessages_Handle_Callback *SendMessage;
- ELETYPE_BUTTON, //!< Push Button
- ELETYPE_TEXT, //!< Text
+ char *Name; //!< Application name
- ELETYPE_SPACER, //!< Visual Spacer
- ELETYPE_GAP, //!< Alignment Gap
+ int MaxElementIndex; //!< Number of entries in \a EleIndex
+ tElement **EleIndex; //!< Array of pointers to elements owned by this application
- NUM_ELETYPES
+ tElement MetaElement; //!< Windows child off this
};
// === FUNCTIONS ===
-/**
- * \brief Create a new element as a child of \a Parent
- */
-extern tElement *WM_CreateElement(tElement *Parent, int Type, int Flags);
-extern void WM_SetFlags(tElement *Element, int Flags);
-extern void WM_SetSize(tElement *Element, int Size);
-extern void WM_SetText(tElement *Element, char *Text);
+
+// --- Render
+extern void WM_UpdateMinDims(tElement *Element);
+extern void WM_UpdateDimensions(tElement *Element, int Pass);
+extern void WM_UpdatePosition(tElement *Element);
+extern void WM_RenderWidget(tElement *Element);
+extern void WM_Update(void);
#endif