2 * Acess2 Window Manager v3 (axwin3)
3 * - By John Hodge (thePowersGang)
6 * - Window management functions
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 contents are valid
28 #define WINFLAG_CLEAN 0x00000040
29 //! All child windows are un-changed
30 #define WINFLAG_CHILDCLEAN 0x00000080
32 #define WINFLAG_RENDER_MASK 0x00FFFF00
33 #define WINFLAG_USR_MASK 0xFF000000
39 typedef struct sWindow tWindow;
40 typedef struct sWMRenderer tWMRenderer;
41 typedef uint32_t tColour;
42 typedef struct sFont tFont;
43 typedef struct sIPC_Client tIPC_Client;
47 extern tWindow *WM_CreateWindow(tWindow *Parent, tIPC_Client *Client, uint32_t ID, int Flags, const char *Renderer);
48 extern void WM_Invalidate(tWindow *Window);
49 extern void WM_SetWindowTitle(tWindow *Window, const char *Title);
50 extern void WM_FocusWindow(tWindow *Destination);
51 extern void WM_RaiseWindow(tWindow *Window);
52 extern void WM_ShowWindow(tWindow *Window, int bShow);
53 extern void WM_DecorateWindow(tWindow *Window, int bDecorate);
54 extern int WM_ResizeWindow(tWindow *Window, int W, int H);
55 extern int WM_MoveWindow(tWindow *Window, int X, int Y);
56 extern int WM_SendMessage(tWindow *Source, tWindow *Dest, int MessageID, int Length, const void *Data);
58 extern void WM_Render_FillRect(tWindow *Window, int X, int Y, int W, int H, tColour Colour);
59 extern void WM_Render_DrawRect(tWindow *Window, int X, int Y, int W, int H, tColour Colour);
61 * \brief Draw text to a window
62 * \param Window Destination Window
63 * \param X X coordinate (Left)
64 * \param Y Y coordinate (Top)
65 * \param W Width of destination region
66 * \param H Height of destination region
67 * \param Font Font to use
68 * \param Colour Text foreground colour
69 * \param Text UTF-8 string to render
70 * \param MaxLen Number of bytes in \a Text to read (Note: A final multi-byte sequence can exceed this count)
72 * \note As as noted in the \a MaxLen parameter, up to 3 more bytes may be read
73 * if the final character is a multi-byte UTF-8 sequence. This allows 1
74 * to be passed to only render a single character.
76 extern int WM_Render_DrawText(tWindow *Window, int X, int Y, int W, int H, tFont *Font, tColour Colour, const char *Text, int MaxLen);
78 * \brief Get the dimensions of a string if it was rendered
79 * \param Font Font to use
80 * \param Text UTF-8 string to be processed
81 * \param MaxLen Number of bytes in \a Text to read (same caveat as WM_Render_DrawText applies)
82 * \param W Pointer to an integer to store the width of the rendered text
83 * \param H Pointer to an integer to store the height of the rendered text
85 extern void WM_Render_GetTextDims(tFont *Font, const char *Text, int MaxLen, int *W, int *H);
86 extern void WM_Render_DrawImage(tWindow *Window, int X, int Y, int W, int H, tImage *Image);
87 extern void WM_Render_SetTextCursor(tWindow *Window, int X, int Y, int W, int H, tColour Colour);
88 // NOTE: Should really be elsewhere
89 extern tColour Video_AlphaBlend(tColour _orig, tColour _new, uint8_t _alpha);