From: John Hodge Date: Tue, 9 Oct 2012 04:47:18 +0000 (+0800) Subject: AxWin3 - More RichText work X-Git-Tag: rel0.15~687 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=d02a9dd1f6752a65efe6a8326a86a288a4165c94;p=tpg%2Facess2.git AxWin3 - More RichText work --- diff --git a/Usermode/Applications/axwin3_src/WM/Makefile b/Usermode/Applications/axwin3_src/WM/Makefile index fae6cbef..b39f68b2 100644 --- a/Usermode/Applications/axwin3_src/WM/Makefile +++ b/Usermode/Applications/axwin3_src/WM/Makefile @@ -13,6 +13,7 @@ OBJ += decorator.o OBJ += renderers/passthru.o OBJ += renderers/background.o OBJ += renderers/menu.o +OBJ += renderers/richtext.o # TODO: Move to a lower makefile OBJ += renderers/widget.o OBJ += renderers/widget/button.o diff --git a/Usermode/Applications/axwin3_src/WM/main.c b/Usermode/Applications/axwin3_src/WM/main.c index 0996f909..f1774a89 100644 --- a/Usermode/Applications/axwin3_src/WM/main.c +++ b/Usermode/Applications/axwin3_src/WM/main.c @@ -18,6 +18,7 @@ extern int Renderer_Menu_Init(void); extern int Renderer_Widget_Init(void); extern int Renderer_Background_Init(void); extern int Renderer_Framebuffer_Init(void); +extern int Renderer_RichText_Init(void); extern void WM_Update(void); extern void WM_Hotkey_Register(int nKeys, uint32_t *Keys, const char *ActionName); @@ -64,6 +65,7 @@ int main(int argc, char *argv[]) Renderer_Widget_Init(); Renderer_Background_Init(); Renderer_Framebuffer_Init(); + Renderer_RichText_Init(); WM_Initialise(); // TODO: Config diff --git a/Usermode/Applications/axwin3_src/WM/renderers/richtext.c b/Usermode/Applications/axwin3_src/WM/renderers/richtext.c new file mode 100644 index 00000000..35fd5ef9 --- /dev/null +++ b/Usermode/Applications/axwin3_src/WM/renderers/richtext.c @@ -0,0 +1,51 @@ +/* + * Acess2 Window Manager v3 + * - By John Hodge (thePowersGang) + * + * render/richtext.c + * - Formatted Line Editor + */ +#include +#include +#include + +// === PROTOTYPES === + int Renderer_RichText_Init(void); +tWindow *Renderer_RichText_Create(int Flags); +void Renderer_RichText_Redraw(tWindow *Window); + int Renderer_RichText_HandleMessage(tWindow *Target, int Msg, int Len, const void *Data); + +// === GLOBALS === +tWMRenderer gRenderer_RichText = { + .Name = "RichText", + .CreateWindow = Renderer_RichText_Create, + .Redraw = Renderer_RichText_Redraw, + .HandleMessage = Renderer_RichText_HandleMessage +}; + +// === CODE === +int Renderer_RichText_Init(void) +{ + WM_RegisterRenderer(&gRenderer_RichText); + return 0; +} + +tWindow *Renderer_RichText_Create(int Flags) +{ + return NULL; +} + +void Renderer_RichText_Redraw(tWindow *Window) +{ + return; +} + +int Renderer_RichText_HandleMessage(tWindow *Target, int Msg, int Len, const void *Data) +{ + switch(Msg) + { + case MSG_RICHTEXT_SETATTR: + break; + } + return 0; +} diff --git a/Usermode/Applications/axwin3_src/include/richtext_messages.h b/Usermode/Applications/axwin3_src/include/richtext_messages.h index 6dcf9a2c..a440592c 100644 --- a/Usermode/Applications/axwin3_src/include/richtext_messages.h +++ b/Usermode/Applications/axwin3_src/include/richtext_messages.h @@ -28,9 +28,15 @@ enum MSG_RICHTEXT_ADDLINE, // Events - - MSG_RICHTEXT_SENDLINE, // Bi-directional - MSG_RICHTEXT_REQLINE // Bi-directional + MSG_RICHTEXT_KEYPRESS, + MSG_RICHTEXT_MOUSEBTN, + + // Bi-directional messages + // - Sent by server to get a line that is not cached + // - Sent by client to read line contents + MSG_RICHTEXT_REQLINE, + // - Response to _REQLINE + MSG_RICHTEXT_SENDLINE, }; struct sRichTextMsg_SetAttr diff --git a/Usermode/Libraries/libaxwin3.so_src/include_exp/axwin3/richtext.h b/Usermode/Libraries/libaxwin3.so_src/include_exp/axwin3/richtext.h index a50f4639..2a6c5aec 100644 --- a/Usermode/Libraries/libaxwin3.so_src/include_exp/axwin3/richtext.h +++ b/Usermode/Libraries/libaxwin3.so_src/include_exp/axwin3/richtext.h @@ -12,8 +12,10 @@ typedef int (*tAxWin3_RichText_KeyHandler)(tHWND Window, int bPress, uint32_t Sym, uint32_t Unicode); typedef int (*tAxWin3_RichText_MouseHandler)(tHWND Window, int bPress, int Button, int Row, int Col); +typedef int (*tAxWin3_RichText_LineHandler)(tHWND Window, int Row); -#define AXWIN3_RICHTEXT_NOSCROLL 0x0001 +#define AXWIN3_RICHTEXT_NOSCROLL 0x0001 // Disables server-side scrolling +#define AXWIN3_RICHTEXT_READONLY 0x0002 // Disables automatic insertion of translated characters enum eAxWin3_RichText_CursorType { AXWIN3_RICHTEXT_CURSOR_NONE, AXWIN3_RICHTEXT_CURSOR_VLINE, // Vertical line @@ -24,6 +26,10 @@ enum eAxWin3_RichText_CursorType { extern tHWND AxWin3_RichText_CreateWindow(tHWND Parent, int Flags); extern void AxWin3_RichText_SetKeyHandler(tHWND Window, tAxWin3_RichText_KeyHandler Handler); extern void AxWin3_RichText_SetMouseHandler(tHWND Window, tAxWin3_RichText_MouseHandler Handler); +/** + * \brief Sets the function called when the server requests an update on a line's contents + */ +extern void AxWin3_RichText_SetLineHandler(tHWND Window, tAxWin3_RichText_LineHandler Handler); extern void AxWin3_RichText_EnableScroll(tHWND Window, int bEnable); extern void AxWin3_RichText_SetLineCount(tHWND Window, int Lines); extern void AxWin3_RichText_SetColCount(tHWND Window, int Cols);