Added sanity checking to kernel vnsprintf
[tpg/acess2.git] / Usermode / Applications / axwin2_src / WM / decorator.c
1 /*
2  * Acess GUI (AxWin) Version 2
3  * By John Hodge (thePowersGang)
4  * 
5  * Widget Decorator
6  */
7 #include "common.h"
8 #include "wm.h"
9
10 #define BOX_BGCOLOUR    0xC0C0C0
11 #define BOX_BORDER      0xA0A0A0
12 #define BUTTON_BGCOLOUR 0xD0D0D0
13 #define BUTTON_BORDER   0xF0F0F0
14 #define TEXT_COLOUR     0x000000
15
16 // === CODE ===
17 void Decorator_RenderWidget(tElement *Element)
18 {
19         _SysDebug("Decorator_RenderWidget: (Element={Type:%i,(%i,%i) %ix%i})",
20                 Element->Type,
21                 Element->CachedX, Element->CachedY,
22                 Element->CachedW, Element->CachedH
23                 );
24         
25         switch(Element->Type)
26         {
27         case ELETYPE_NONE:
28         case ELETYPE_BOX:       break;
29         
30         case ELETYPE_TABBAR:    // TODO: Moar
31         case ELETYPE_TOOLBAR:
32                 Video_DrawRect(
33                         Element->CachedX, Element->CachedY,
34                         Element->CachedW, Element->CachedH,
35                         BOX_BORDER
36                         );
37                 Video_FillRect(
38                         Element->CachedX+1, Element->CachedY+1,
39                         Element->CachedW-2, Element->CachedH-2,
40                         BOX_BGCOLOUR
41                         );
42                 break;
43         
44         case ELETYPE_SPACER:
45                 Video_FillRect(
46                         Element->CachedX+3, Element->CachedY+3,
47                         Element->CachedW-6, Element->CachedH-6,
48                         BOX_BORDER
49                         );
50                 break;
51         
52         case ELETYPE_BUTTON:
53                 Video_FillRect(
54                         Element->CachedX+1, Element->CachedY+1,
55                         Element->CachedW-2, Element->CachedH-2,
56                         BUTTON_BORDER
57                         );
58                 Video_DrawRect(
59                         Element->CachedX, Element->CachedY,
60                         Element->CachedW-1, Element->CachedH-1,
61                         BUTTON_BORDER
62                         );
63                 break;
64         
65         case ELETYPE_TEXT:
66                 Video_DrawText(
67                         Element->CachedX+1, Element->CachedY+1,
68                         Element->CachedW-2, Element->CachedH-2,
69                         NULL,
70                         TEXT_COLOUR,
71                         Element->Text
72                         );
73                 break;
74         
75         case ELETYPE_IMAGE:
76                 Video_DrawImage(
77                         Element->CachedX, Element->CachedY,
78                         Element->CachedW, Element->CachedH,
79                         Element->Data
80                         );
81                 break;
82         }
83 }

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