Merge branch 'master' of git://git.ucc.asn.au/tpg/acess2
[tpg/acess2.git] / Usermode / Applications / axwin3_src / libaxwin3.so_src / r_widget.c
index 43eef70..875f14b 100644 (file)
@@ -2,12 +2,13 @@
  * AxWin3 Interface Library
  * - By John Hodge (thePowersGang)
  *
- * main.c
- * - Entrypoint and setup
+ * r_widget.c
+ * - Widget window type interface
  */
 #include <axwin3/axwin.h>
 #include <axwin3/widget.h>
 #include "include/internal.h"
+#include "include/ipc.h"
 #include <stdlib.h>
 #include <widget_messages.h>
 #include <string.h>
@@ -227,6 +228,30 @@ void AxWin3_Widget_SetText(tAxWin3_Widget *Widget, const char *Text)
        AxWin3_SendMessage(Widget->Window, Widget->Window, MSG_WIDGET_SETTEXT, sizeof(buf), buf);
 }
 
+char *AxWin3_Widget_GetText(tAxWin3_Widget *Widget)
+{
+       char    buf[sizeof(tWidgetMsg_SetText)];
+       tWidgetMsg_SetText      *msg = (void*)buf;
+       tAxWin_IPCMessage       *retmsg;
+       char    *ret;
+       
+       msg->WidgetID = Widget->ID;
+
+       AxWin3_SendMessage(Widget->Window, Widget->Window, MSG_WIDGET_GETTEXT, sizeof(buf), buf);
+
+       retmsg = AxWin3_int_WaitIPCMessage(MSG_WIDGET_GETTEXT);
+       msg = (void*)retmsg->Data;
+
+       if( retmsg->Size < sizeof(*msg) ) {
+               free(retmsg);
+               return NULL;
+       }
+
+       ret = strndup(msg->Text, retmsg->Size - sizeof(*msg));
+       free(retmsg);
+       return ret;
+}
+
 void AxWin3_Widget_SetColour(tAxWin3_Widget *Widget, int Index, tAxWin3_Colour Colour)
 {
        tWidgetMsg_SetColour    msg;

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