Usermode/axwin3 - Working on things
authorJohn Hodge <[email protected]>
Wed, 17 Aug 2011 13:34:58 +0000 (21:34 +0800)
committerJohn Hodge <[email protected]>
Wed, 17 Aug 2011 13:34:58 +0000 (21:34 +0800)
Usermode/Applications/axwin3_src/WM/include/wm_renderer.h
Usermode/Applications/axwin3_src/WM/renderer_classes.c
Usermode/Applications/axwin3_src/WM/renderer_passthru.c

index f870290..ba8ce04 100644 (file)
@@ -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;
 
index 8e58193..8737ed1 100644 (file)
@@ -8,17 +8,51 @@
 #include <common.h>
 #include <wm_renderer.h>
 
+// === 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;
+       }
+}
 
index 4eefd7c..a75484c 100644 (file)
@@ -10,6 +10,7 @@
 
 // === GLOBALS ===
 tWMRenderer    gRenderer_Passthru = {
+       .Name = "Passthru",
        .CreateWindow = Renderer_Passthru_Create,
        .Redraw = Renderer_Passthru_Redraw,
        .SendMessage = Renderer_Passthru_SendMessage

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