Kernel/debug - Clean up Debug() method, bind to #define config
[tpg/acess2.git] / Usermode / Applications / axwin3_src / WM / renderers / classes.c
1 /*
2  * Acess2 Window Manager v3
3  * - By John Hodge (thePowersGang)
4  *
5  * render_classes.c
6  * - Simple class based window renderer
7  */
8 #include <common.h>
9 #include <wm_renderer.h>
10 #include <renderer_classful.h>
11
12 // === TYPES ===
13 typedef struct sClassfulInfo
14 {
15         tColour BGColour;
16 } tClassfulInfo;
17
18 // === PROTOTYPES ===
19 tWindow *Renderer_Class_Create(int Flags);
20 void    Renderer_Class_Redraw(tWindow *Window);
21 int     Renderer_Class_HandleMessage(tWindow *Target, int Msg, int Len, void *Data);
22
23 // === GLOBALS ===
24 tWMRenderer     gRenderer_Class = {
25         .Name = "Classful",
26         .CreateWindow = Renderer_Class_Create,
27         .Redraw = Renderer_Class_Redraw,
28         .HandleMessage = Renderer_Class_HandleMessage
29 };
30
31 // === CODE ===
32 int Renderer_Class_Init(void)
33 {
34         WM_RegisterRenderer(&gRenderer_Class);  
35
36         return 0;
37 }
38
39 tWindow *Renderer_Class_Create(int Flags)
40 {
41         return WM_CreateWindowStruct(sizeof(tClassfulInfo));
42 }
43
44 void Renderer_Class_Redraw(tWindow *Window)
45 {
46         tClassfulInfo   *info = Window->RendererInfo;
47         WM_Render_FillRect(Window, 0, 0, Window->W, Window->H, info->BGColour);
48 }
49
50 int Renderer_Class_HandleMessage(tWindow *Target, int Msg, int Len, void *Data)
51 {
52         tClassfulInfo   *info = Target->RendererInfo;
53         switch(Msg)
54         {
55         case MSG_CLASSFUL_SETBGCOLOUR:
56                 if( Len != sizeof(uint32_t) ) return -1;
57                 info->BGColour = *(uint32_t*)Data;
58                 return 0;
59
60         case MSG_CLASSFUL_SETTEXT:
61                 
62                 return -1;
63         
64         // Anything else is unhandled
65         default:
66                 return 1;
67         }
68 }
69

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