AcessNative - Better error reporting in NativeFS
[tpg/acess2.git] / Usermode / Applications / axwin3_src / WM / include / wm.h
1 /*
2  * Acess2 Window Manager v3 (axwin3)
3  * - By John Hodge (thePowersGang)
4  *
5  * include/wm.h
6  * - Window management functions
7  */
8 #ifndef _WM_H_
9 #define _WM_H_
10
11 #include <stdint.h>
12 #include <stdlib.h>
13
14 #include "image.h"
15
16 // === CONSTANTS ===
17 /**
18  * \brief Window Flags
19  * \{
20  */
21 //! Render the window
22 #define WINFLAG_SHOW            0x00000001
23 //! Don't decoratate even if root
24 #define WINFLAG_NODECORATE      0x00000002
25 //! Window takes up all of screen
26 #define WINFLAG_MAXIMIZED       0x00000004
27 //! Window is contained within the parent
28 #define WINFLAG_RELATIVE        0x00000008
29 //! Window contents are valid
30 #define WINFLAG_CLEAN           0x00000040
31 //! All child windows are un-changed
32 #define WINFLAG_CHILDCLEAN      0x00000080
33
34 #define WINFLAG_RENDER_MASK     0x00FFFF00
35 #define WINFLAG_USR_MASK        0xFF000000
36 /**
37  * \}
38  */
39
40 // === TYPES ===
41 typedef struct sWindow  tWindow;
42 typedef struct sWMRenderer      tWMRenderer;
43 typedef uint32_t        tColour;
44 typedef struct sFont    tFont;
45 typedef struct sIPC_Client      tIPC_Client;
46
47 // === FUNCTIONS ===
48 // --- Management
49 extern tWindow  *WM_CreateWindow(tWindow *Parent, tIPC_Client *Client, uint32_t ID, int Flags, const char *Renderer);
50 extern void     WM_DestroyWindow(tWindow *Window);
51 extern tWindow  *WM_GetWindowByID(tWindow *Requester, uint32_t ID);
52 extern void     WM_Invalidate(tWindow *Window);
53 extern void     WM_SetWindowTitle(tWindow *Window, const char *Title);
54 extern void     WM_FocusWindow(tWindow *Destination);
55 extern void     WM_RaiseWindow(tWindow *Window);
56 extern void     WM_ShowWindow(tWindow *Window, int bShow);
57 extern void     WM_DecorateWindow(tWindow *Window, int bDecorate);
58 extern void     WM_SetRelative(tWindow *Window, int bRelativeToParent);
59 extern int      WM_ResizeWindow(tWindow *Window, int W, int H);
60 extern int      WM_MoveWindow(tWindow *Window, int X, int Y);
61 extern int      WM_SendMessage(tWindow *Source, tWindow *Dest, int MessageID, int Length, const void *Data);
62 // --- Rendering
63 extern void     WM_Render_FillRect(tWindow *Window, int X, int Y, int W, int H, tColour Colour);
64 extern void     WM_Render_DrawRect(tWindow *Window, int X, int Y, int W, int H, tColour Colour);
65 /**
66  * \brief Draw text to a window
67  * \param Window        Destination Window
68  * \param X     X coordinate (Left)
69  * \param Y     Y coordinate (Top)
70  * \param W     Width of destination region
71  * \param H     Height of destination region
72  * \param Font  Font to use
73  * \param Colour        Text foreground colour
74  * \param Text  UTF-8 string to render
75  * \param MaxLen        Number of bytes in \a Text to read (Note: A final multi-byte sequence can exceed this count)
76  *
77  * \note As as noted in the \a MaxLen parameter, up to 3 more bytes may be read
78  *       if the final character is a multi-byte UTF-8 sequence. This allows 1
79  *       to be passed to only render a single character.
80  */
81 extern int      WM_Render_DrawText(tWindow *Window, int X, int Y, int W, int H, tFont *Font, tColour Colour, const char *Text, int MaxLen);
82 /**
83  * \brief Get the dimensions of a string if it was rendered
84  * \param Font  Font to use
85  * \param Text  UTF-8 string to be processed
86  * \param MaxLen        Number of bytes in \a Text to read (same caveat as WM_Render_DrawText applies)
87  * \param W     Pointer to an integer to store the width of the rendered text
88  * \param H     Pointer to an integer to store the height of the rendered text
89  */
90 extern void     WM_Render_GetTextDims(tFont *Font, const char *Text, int MaxLen, int *W, int *H);
91 extern void     WM_Render_DrawImage(tWindow *Window, int X, int Y, int W, int H, tImage *Image);
92 extern void     WM_Render_SetTextCursor(tWindow *Window, int X, int Y, int W, int H, tColour Colour);
93 // NOTE: Should really be elsewhere
94 extern tColour  Video_AlphaBlend(tColour _orig, tColour _new, uint8_t _alpha);
95 #endif
96

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