2 * AxWin3 Interface Library
3 * - By John Hodge (thePowersGang)
6 * - Formatted Text window type
8 #include <axwin3/axwin.h>
9 #include <axwin3/richtext.h>
10 #include "include/internal.h"
11 #include <richtext_messages.h>
14 typedef struct sRichText_Window
16 tAxWin3_RichText_KeyHandler KeyCallback;
17 tAxWin3_RichText_MouseHandler MouseCallback;
18 // tAxWin3_RichText_LineHandler LineHandler;
22 int AxWin3_RichText_MessageHandler(tHWND Window, int MessageID, int Size, void *Data)
27 static void _SendAttrib(tHWND Window, int Attr, uint32_t Value)
29 struct sRichTextMsg_SetAttr msg;
32 AxWin3_SendMessage(Window, Window, MSG_RICHTEXT_SETATTR, sizeof(msg), &msg);
35 tHWND AxWin3_RichText_CreateWindow(tHWND Parent, int Flags)
37 tHWND ret = AxWin3_CreateWindow(Parent, "RichText", Flags, sizeof(tRichText_Window), AxWin3_RichText_MessageHandler);
38 // tRichText_Window *info = AxWin3_int_GetDataPtr(ret);
42 void AxWin3_RichText_SetKeyHandler(tHWND Window, tAxWin3_RichText_KeyHandler Handler)
44 tRichText_Window *info = AxWin3_int_GetDataPtr(Window);
45 info->KeyCallback = Handler;
48 void AxWin3_RichText_SetMouseHandler(tHWND Window, tAxWin3_RichText_MouseHandler Handler)
50 tRichText_Window *info = AxWin3_int_GetDataPtr(Window);
51 info->MouseCallback = Handler;
54 void AxWin3_RichText_EnableScroll(tHWND Window, int bEnable)
56 _SendAttrib(Window, _ATTR_SCROLL, bEnable);
58 void AxWin3_RichText_SetLineCount(tHWND Window, int Lines)
60 _SendAttrib(Window, _ATTR_LINECOUNT, Lines);
62 void AxWin3_RichText_SetColCount(tHWND Window, int Cols)
64 _SendAttrib(Window, _ATTR_COLCOUNT, Cols);
66 void AxWin3_RichText_SetBackground(tHWND Window, uint32_t ARGB_Colour)
68 _SendAttrib(Window, _ATTR_DEFBG, ARGB_Colour);
70 void AxWin3_RichText_SetDefaultColour(tHWND Window, uint32_t ARGB_Colour)
72 _SendAttrib(Window, _ATTR_DEFFG, ARGB_Colour);
74 void AxWin3_RichText_SetFont(tHWND Window, const char *FontName, int PointSize)
78 void AxWin3_RichText_SetCursorType(tHWND Window, int Type)
80 _SendAttrib(Window, _ATTR_CURSOR, Type);
82 void AxWin3_RichText_SetCursorBlink(tHWND Window, int bBlink)
84 _SendAttrib(Window, _ATTR_CURSORBLINK, bBlink);
86 void AxWin3_RichText_SetCursorPos(tHWND Window, int Row, int Column)
88 if(Row < 0 || Row > 0xFFFFF || Column > 0xFFF || Column < 0)
90 _SendAttrib(Window, _ATTR_CURSORPOS, ((Row & 0xFFFFF) << 12) | (Column & 0xFFF));