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 is contained within the parent
28 #define WINFLAG_RELATIVE 0x00000008
29 //! Window needs to be reblitted (child moved or contents changed)
30 #define WINFLAG_NEEDREBLIT 0x00000020
31 //! Window contents are valid
32 #define WINFLAG_CLEAN 0x00000040
33 //! All child windows are un-changed
34 #define WINFLAG_CHILDCLEAN 0x00000080
36 #define WINFLAG_RENDER_MASK 0x00FFFF00
37 #define WINFLAG_USR_MASK 0xFF000000
43 typedef struct sWindow tWindow;
44 typedef struct sWMRenderer tWMRenderer;
45 typedef uint32_t tColour;
46 typedef struct sFont tFont;
47 typedef struct sIPC_Client tIPC_Client;
51 extern tWindow *WM_CreateWindow(tWindow *Parent, tIPC_Client *Client, uint32_t ID, int Flags, const char *Renderer);
52 extern void WM_DestroyWindow(tWindow *Window);
53 extern tWindow *WM_GetWindowByID(tWindow *Requester, uint32_t ID);
54 extern void WM_Invalidate(tWindow *Window, int bClearClean);
55 extern void WM_SetWindowTitle(tWindow *Window, const char *Title);
56 extern void WM_FocusWindow(tWindow *Destination);
57 extern void WM_RaiseWindow(tWindow *Window);
58 extern void WM_ShowWindow(tWindow *Window, int bShow);
59 extern void WM_DecorateWindow(tWindow *Window, int bDecorate);
60 extern void WM_SetRelative(tWindow *Window, int bRelativeToParent);
61 extern int WM_ResizeWindow(tWindow *Window, int W, int H);
62 extern int WM_MoveWindow(tWindow *Window, int X, int Y);
63 extern int WM_SendMessage(tWindow *Source, tWindow *Dest, int MessageID, int Length, const void *Data);
65 extern void WM_Render_FillRect(tWindow *Window, int X, int Y, int W, int H, tColour Colour);
66 extern void WM_Render_DrawRect(tWindow *Window, int X, int Y, int W, int H, tColour Colour);
68 * \brief Draw text to a window
69 * \param Window Destination Window
70 * \param X X coordinate (Left)
71 * \param Y Y coordinate (Top)
72 * \param W Width of destination region
73 * \param H Height of destination region
74 * \param Font Font to use
75 * \param Colour Text foreground colour
76 * \param Text UTF-8 string to render
77 * \param MaxLen Number of bytes in \a Text to read (Note: A final multi-byte sequence can exceed this count)
79 * \note As as noted in the \a MaxLen parameter, up to 3 more bytes may be read
80 * if the final character is a multi-byte UTF-8 sequence. This allows 1
81 * to be passed to only render a single character.
83 extern int WM_Render_DrawText(tWindow *Window, int X, int Y, int W, int H, tFont *Font, tColour Colour, const char *Text, int MaxLen);
85 * \brief Get the dimensions of a string if it was rendered
86 * \param Font Font to use
87 * \param Text UTF-8 string to be processed
88 * \param MaxLen Number of bytes in \a Text to read (same caveat as WM_Render_DrawText applies)
89 * \param W Pointer to an integer to store the width of the rendered text
90 * \param H Pointer to an integer to store the height of the rendered text
92 extern void WM_Render_GetTextDims(tFont *Font, const char *Text, int MaxLen, int *W, int *H);
93 extern void WM_Render_DrawImage(tWindow *Window, int X, int Y, int W, int H, tImage *Image);
94 extern void WM_Render_SetTextCursor(tWindow *Window, int X, int Y, int W, int H, tColour Colour);
95 // NOTE: Should really be elsewhere
96 extern tColour Video_AlphaBlend(tColour _orig, tColour _new, uint8_t _alpha);