From: John Hodge Date: Wed, 17 Aug 2011 13:34:58 +0000 (+0800) Subject: Usermode/axwin3 - Working on things X-Git-Tag: rel0.11~149 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=502dcca4366b381b9ce07f41961fbb8754260b2b;p=tpg%2Facess2.git Usermode/axwin3 - Working on things --- diff --git a/Usermode/Applications/axwin3_src/WM/include/wm_renderer.h b/Usermode/Applications/axwin3_src/WM/include/wm_renderer.h index f870290e..ba8ce04d 100644 --- a/Usermode/Applications/axwin3_src/WM/include/wm_renderer.h +++ b/Usermode/Applications/axwin3_src/WM/include/wm_renderer.h @@ -8,10 +8,47 @@ #ifndef _WM_RENDERER_H_ #define _WM_RENDERER_H_ -typedef struct +typedef struct sWMRenderer { + /** + * \brief Internal pointer to next loaded renderer + */ + struct sWMRenderer *Next; + + /** + * \brief Renderer name / identifier + */ + const char *Name; + + /** + * \brief Initialise a window structure for the renderer + * \param W Width of the new window + * \param H Height of the new window + * \param Flags Flags for the window + * \return malloc()'d window structure, or NULL on error + * \note Only the fields \a W and \a H need be filled in the window + * structure, the rest will be filled by the caller. + */ tWindow (*InitWindow)(int W, int H, int Flags); + + /** + * \brief Redraw a window on the screen + * \param Window Window to render + * + * Called when a window needs to be re-rendered, e.g. when it is uncovered or + * repositioned. + * + * \todo List all conditions for Redraw + */ void (*Redraw)(tWindow *Window); + + /** + * \brief Handle a message sent to the window using WM_SendMessage + * \param Window Target window + * \param MessageID Implementation defined message ID (usually the command) + * \param Length Length of the buffer \a Data + * \param Data Implementation defined data buffer + */ int (*SendMessage)(tWindow *Window, int MessageID, int Length, void *Data); } tWMRenderer; diff --git a/Usermode/Applications/axwin3_src/WM/renderer_classes.c b/Usermode/Applications/axwin3_src/WM/renderer_classes.c index 8e581935..8737ed10 100644 --- a/Usermode/Applications/axwin3_src/WM/renderer_classes.c +++ b/Usermode/Applications/axwin3_src/WM/renderer_classes.c @@ -8,17 +8,51 @@ #include #include +// === PROTOTYPES === +tWindow *Renderer_Class_Create(int Width, int Height, int Flags); +void Renderer_Class_Redraw(tWindow *Window); +int Renderer_Class_HandleMessage(tWindow *Target, int Msg, int Len, void *Data); + // === GLOBALS === tWMRenderer gRenderer_Class = { + .Name = "Classful", .CreateWindow = Renderer_Class_Create, .Redraw = Renderer_Class_Redraw, - .SendMessage = Renderer_Class_SendMessage + .HandleMessage = Renderer_Class_HandleMessage }; // === CODE === int Renderer_Class_Init(void) { + WM_RegisterRenderer(&gRenderer_Class); + return 0; } +tWindow *Renderer_Class_Create(int Width, int Height, int Flags) +{ + // TODO: Add info + return WM_CreateWindowStruct(0); +} + +void Renderer_Class_Redraw(tWindow *Window) +{ + +} + +int Renderer_Class_HandleMessage(tWindow *Target, int Msg, int Len, void *Data) +{ + tClassfulInfo *info = Target->RendererInfo; + switch(Msg) + { + case MSG_CLASSFUL_SETBGCOLOUR: + if( Len != sizeof(uint32_t) ) return -1; + info->BGColour = *(uint32_t*)Data; + break; + + case MSG_CLASSFUL_SETTEXT: + + break; + } +} diff --git a/Usermode/Applications/axwin3_src/WM/renderer_passthru.c b/Usermode/Applications/axwin3_src/WM/renderer_passthru.c index 4eefd7cd..a75484cf 100644 --- a/Usermode/Applications/axwin3_src/WM/renderer_passthru.c +++ b/Usermode/Applications/axwin3_src/WM/renderer_passthru.c @@ -10,6 +10,7 @@ // === GLOBALS === tWMRenderer gRenderer_Passthru = { + .Name = "Passthru", .CreateWindow = Renderer_Passthru_Create, .Redraw = Renderer_Passthru_Redraw, .SendMessage = Renderer_Passthru_SendMessage