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

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