Merge branch 'master' of git://localhost/acess2
[tpg/acess2.git] / Usermode / Applications / axwin3_src / libaxwin3.so_src / r_richtext.c
index b1620dd..1ac98fe 100644 (file)
@@ -10,6 +10,7 @@
 #include "include/internal.h"
 #include <richtext_messages.h>
 #include <string.h>
+#include <wm_messages.h>
 //#include <alloca.h>
 
 // === TYPES ===
@@ -23,15 +24,32 @@ typedef struct sRichText_Window
 // === CODE ===
 int AxWin3_RichText_MessageHandler(tHWND Window, int MessageID, int Size, void *Data)
 {
+       tRichText_Window        *info = AxWin3_int_GetDataPtr(Window);
+       struct sWndMsg_KeyAction        *keyaction = Data;
+       switch(MessageID)
+       {
+       case WNDMSG_KEYFIRE:
+               if(Size < sizeof(*keyaction))   return -1;
+               info->KeyCallback(Window, 2, keyaction->KeySym, keyaction->UCS32);
+               return 1;
+       case WNDMSG_KEYDOWN:
+               if(Size < sizeof(*keyaction))   return -1;
+               info->KeyCallback(Window, 1, keyaction->KeySym, keyaction->UCS32);
+               return 1;
+       case WNDMSG_KEYUP:
+               if(Size < sizeof(*keyaction))   return -1;
+               info->KeyCallback(Window, 0, keyaction->KeySym, 0);
+               return 1;
+       }
        return 0;
 }
 
 static void _SendAttrib(tHWND Window, int Attr, uint32_t Value)
 {
-       struct sRichTextMsg_SetAttr     msg;
+       struct sRichTextIPC_SetAttr     msg;
        msg.Attr = Attr;
        msg.Value = Value;
-       AxWin3_SendMessage(Window, Window, MSG_RICHTEXT_SETATTR, sizeof(msg), &msg);
+       AxWin3_SendIPC(Window, IPC_RICHTEXT_SETATTR, sizeof(msg), &msg);
 }
 
 tHWND AxWin3_RichText_CreateWindow(tHWND Parent, int Flags)
@@ -95,12 +113,12 @@ void AxWin3_RichText_SetCursorPos(tHWND Window, int Row, int Column)
 void AxWin3_RichText_SendLine(tHWND Window, int Line, const char *Text)
 {
        // TODO: Local sanity check on `Line`?
-       struct sRichTextMsg_SendLine    *msg;
+       struct sRichTextIPC_WriteLine   *msg;
        size_t  len = sizeof(*msg) + strlen(Text) + 1;
        char    buffer[len];
                msg = (void*)buffer;
        msg->Line = Line;
        strcpy(msg->LineData, Text);
-       AxWin3_SendMessage(Window, Window, MSG_RICHTEXT_SENDLINE, len, msg);
+       AxWin3_SendIPC(Window, IPC_RICHTEXT_WRITELINE, len, msg);
 }
 

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