AxWin2 - Huge changes, getting to the working point
[tpg/acess2.git] / Usermode / include / axwin2 / messages.h
1 /**
2  * \file messages.h
3  * \author John Hodge (thePowersGang)
4  * \brief AxWin Control Messages and structures
5  */
6 #ifndef _AXWIN_MESSAGES_H
7 #define _AXWIN_MESSAGES_H
8
9 #include <stdint.h>
10
11 typedef struct sAxWin_Message   tAxWin_Message;
12 typedef struct sAxWin_RetMsg    tAxWin_RetMsg;
13
14 // Higherarchy:
15 // - HANDLE
16 //  + ELEMENT
17 //   > DIALOG
18 //   > TAB
19
20 /**
21  * \brief Message IDs
22  */
23 enum eAxWin_Messages
24 {
25         // Client->Server Requests
26         MSG_SREQ_PING,
27         // - Windows
28         MSG_SREQ_REGISTER,      // bool (char[] Name) - Registers this PID with the Window Manager
29         
30         MSG_SREQ_ADDTAB,        // TAB (char[] Name) - Adds a tab to the window
31         MSG_SREQ_DELTAB,        // void (TAB Tab)       - Closes a tab
32         
33         MSG_SREQ_SETICON        // void (TAB Tab, char[] IconURI)       - Set the icon of a tab (or application)
34
35         MSG_SREQ_NEWDIALOG,     // DIALOG (TAB Parent, char[] Name)     - Creates a dialog
36         MSG_SREQ_DELDIALOG,     // void (DIALOG Dialog) - Closes a dialog
37         
38         MSG_SREQ_SETNAME,       // void (ELEMENT Element, char[] Name)
39         MSG_SREQ_GETNAME,       // char[] (ELEMENT Element)
40         
41         // - Builtin Elements
42         MSG_SREQ_INSERT,        // void (ELEMENT Parent, eAxWin_Controls Type, u32 Flags)
43         
44         // - Drawing
45         //  All drawing functions take an ELEMENT as their first parameter.
46         //  This must be either a Tab, Dialog or Canvas control
47         MSG_SREQ_SETCOL,
48         MSG_SREQ_PSET,
49         MSG_SREQ_LINE,  MSG_SREQ_CURVE,
50         MSG_SREQ_RECT,  MSG_SREQ_FILLRECT,
51         MSG_SREQ_RIMG,  MSG_SREQ_SIMG,  // Register/Set Image
52         MSG_SREQ_SETFONT,       MSG_SREQ_PUTTEXT,
53         
54         // Server->Client Responses
55         MSG_SRSP_VERSION,
56         MSG_SRSP_RETURN,        // {int RequestID, void[] Return Value} - Returns a value from a server request
57         
58         NUM_MSG
59 };
60
61 // --- Server Requests (Requests from the client of the server)
62 /**
63  * \brief Server Request - Ping (Get Server Version)
64  */
65 struct sAxWin_SReq_Ping
66 {
67 };
68
69 /**
70  * \brief Server Request - New Window
71  * \see eAxWin_Messages.MSG_SREQ_NEWWINDOW
72  */
73 struct sAxWin_SReq_NewWindow
74 {
75         uint16_t        X, Y, W, H;
76         uint32_t        Flags;
77 };
78
79
80 // --- Server Responses
81 /**
82  * \brief Server Response - Pong
83  * \see eAxWin_Messages.MSG_SRSP_PONG
84  */
85 struct sAxWin_SRsp_Version
86 {
87         uint8_t Major;
88         uint8_t Minor;
89         uint16_t        Build;
90 };
91
92 /**
93  * \brief Server Response - New Window
94  * \see eAxWin_Messages.MSG_SRSP_NEWWINDOW
95  */
96 struct sAxWin_SRsp_NewWindow
97 {
98         uint32_t        Handle;
99 };
100
101
102 // === Core Message Structure
103 /**
104  * \brief Overarching Message Structure
105  * \note sizeof(tAxWin_Message) is never valid
106  */
107 struct sAxWin_Message
108 {
109         uint32_t        Source;
110         uint16_t        ID;
111         uint16_t        Size;   // Size of data
112         char    Data[];
113 };
114
115 struct sAxWin_RetMsg
116 {
117         uint16_t        ReqID;
118         uint16_t        Rsvd;
119         union
120         {
121                  uint8_t        Bool;
122                 uint32_t        Handle;
123                  int    Integer;
124         };
125 };
126
127 #endif

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