AxWin2 - More fiddling, working in windows
[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 sWindow  tWindow;
19 typedef struct sApplication     tApplication;
20
21 struct sAxWin_Element
22 {
23         enum eElementTypes      Type;
24         
25         // Element Tree
26         tElement        *Parent;
27         tElement        *FirstChild;
28         tElement        *LastChild;
29         tElement        *NextSibling;
30         
31         // Application
32         tApplication    *Owner; //!< Owning application
33         uint16_t        ApplicationID;  //!< Index into sApplication::EleIndex
34
35         // User modifiable attributes   
36         short   PaddingL, PaddingR;
37         short   PaddingT, PaddingB;
38         short   GapSize;
39         
40         uint32_t        Flags;
41         
42         short   FixedWith;      //!< Fixed lengthways Size attribute (height)
43         short   FixedCross;     //!< Fixed Cross Size attribute (width)
44         
45         char    *Text;
46         
47         // -- Attributes maitained by the element code
48         // Not touched by the user
49         short   MinWith;        //!< Minimum long size
50         short   MinCross;       //!< Minimum cross size
51         void    *Data;  //!< Per-type data
52         
53         // -- Render Cache
54         short   CachedX, CachedY;
55         short   CachedW, CachedH;
56         
57         char    DebugName[];
58 };
59
60 struct sWindow
61 {
62          int    X, Y, W, H;
63         tImage  *Icon;
64         
65         tWindow *OrderNext;     // Render order
66         
67         tElement        Element;
68 };
69
70 struct sApplication
71 {
72         tApplication    *Next;
73
74         tIPC_Type       *IPCType;
75         void    *Ident; //!< Client Identifier
76         
77         char    *Name;  //!< Application name
78         
79          int    MaxElementIndex;        //!< Number of entries in \a EleIndex
80         tElement        **EleIndex;     //!< Array of pointers to elements owned by this application
81         
82         tElement        MetaElement;    //!< Windows child off this
83 };
84
85 // === FUNCTIONS ===
86
87 // --- Render
88 extern void     WM_UpdateMinDims(tElement *Element);
89 extern void     WM_UpdateDimensions(tElement *Element, int Pass);
90 extern void     WM_UpdatePosition(tElement *Element);
91 extern void     WM_RenderWidget(tElement *Element);
92 extern void     WM_Update(void);
93
94 #endif

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