AxWin2 - Cleaned out messy code
[tpg/acess2.git] / Usermode / Applications / axwin2_src / WM / wm.h
1 /*
2  * Acess2 Window Manager (AxWin2)
3  */
4 #ifndef _WM_H_
5 #define _WM_H_
6
7 #include <axwin2/axwin.h>
8 #include "common.h"
9
10 /**
11  * \brief Number of elements that can be owned by each application
12  */
13 // TODO: Fine tune these values
14 #define MAX_ELEMENTS_PER_APP    1024
15 #define DEFAULT_ELEMENTS_PER_APP        128
16
17 typedef struct sAxWin_Element   tElement;
18 typedef struct sApplication     tApplication;
19
20 struct sAxWin_Element
21 {
22         enum eElementTypes      Type;
23         
24         // Element Tree
25         tElement        *Parent;
26         tElement        *FirstChild;
27         tElement        *LastChild;
28         tElement        *NextSibling;
29         
30         // Application
31         tApplication    *Owner; //!< Owning application
32         uint16_t        ApplicationID;  //!< Index into sApplication::EleIndex
33
34         // User modifiable attributes   
35         short   PaddingL, PaddingR;
36         short   PaddingT, PaddingB;
37         short   GapSize;
38         
39         uint32_t        Flags;
40         
41         short   FixedWith;      //!< Fixed Long Size attribute (height)
42         short   FixedCross;     //!< Fixed Cross Size attribute (width)
43         
44         char    *Text;
45         
46         // -- Attributes maitained by the element code
47         // Not touched by the user
48         short   MinWith;        //!< Minimum long size
49         short   MinCross;       //!< Minimum cross size
50         void    *Data;  //!< Per-type data
51         
52         // -- Render Cache
53         short   CachedX, CachedY;
54         short   CachedW, CachedH;
55         
56         char    DebugName[];
57 };
58
59 struct sApplication
60 {
61         tApplication    *Next;
62
63         tIPC_Type       *IPCType;
64         void    *Ident; //!< Client Identifier
65         
66         char    *Name;  //!< Application name
67         
68          int    MaxElementIndex;        //!< Number of entries in \a EleIndex
69         tElement        **EleIndex;     //!< Array of pointers to elements owned by this application
70         
71         tElement        MetaElement;    //!< Windows child off this
72 };
73
74 // === FUNCTIONS ===
75
76 // --- Render
77 extern void     WM_UpdateMinDims(tElement *Element);
78 extern void     WM_UpdateDimensions(tElement *Element, int Pass);
79 extern void     WM_UpdatePosition(tElement *Element);
80 extern void     WM_RenderWidget(tElement *Element);
81 extern void     WM_Update(void);
82
83 #endif

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