Usermode - Removed SpiderScript
[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 BORDER_EVERYTHING       1
11
12 #define BOX_BGCOLOUR    0xC0C0C0
13 #define BOX_BORDER      0xA0A0A0
14 #define BUTTON_BGCOLOUR 0xD0D0D0
15 #define BUTTON_BORDER   0xF0F0F0
16 #define TEXT_COLOUR     0x000000
17
18 // === CODE ===
19 void Decorator_RenderWidget(tElement *Element)
20 {
21         _SysDebug("Decorator_RenderWidget: (Element={Type:%i,(%i,%i) %ix%i})",
22                 Element->Type,
23                 Element->CachedX, Element->CachedY,
24                 Element->CachedW, Element->CachedH
25                 );
26         
27         #if BORDER_EVERYTHING
28         Video_DrawRect(Element->CachedX, Element->CachedY,
29                         Element->CachedW, Element->CachedH,
30                         0
31                         );
32         #endif
33         
34         switch(Element->Type)
35         {
36         case ELETYPE_NONE:
37         case ELETYPE_BOX:       break;  // Box is a meta-element
38         
39         case ELETYPE_TABBAR:    // Tab Bar
40                 Video_DrawRect(
41                         Element->CachedX, Element->CachedY,
42                         Element->CachedW, Element->CachedH,
43                         BOX_BORDER
44                         );
45                 Video_FillRect(
46                         Element->CachedX+1, Element->CachedY+1,
47                         Element->CachedW-2, Element->CachedH-2,
48                         BOX_BGCOLOUR
49                         );
50                 // Enumerate Items.
51                 break;
52         case ELETYPE_TOOLBAR:   // Tool Bar
53                 Video_DrawRect(
54                         Element->CachedX, Element->CachedY,
55                         Element->CachedW, Element->CachedH,
56                         BOX_BORDER
57                         );
58                 Video_FillRect(
59                         Element->CachedX+1, Element->CachedY+1,
60                         Element->CachedW-2, Element->CachedH-2,
61                         BOX_BGCOLOUR
62                         );
63                 break;
64         
65         case ELETYPE_SPACER:    // Spacer (subtle line)
66                 Video_FillRect(
67                         Element->CachedX+3, Element->CachedY+3,
68                         Element->CachedW-6, Element->CachedH-6,
69                         BOX_BORDER
70                         );
71                 break;
72         
73         case ELETYPE_BUTTON:    // Button
74                 Video_FillRect(
75                         Element->CachedX+1, Element->CachedY+1,
76                         Element->CachedW-2, Element->CachedH-2,
77                         BUTTON_BGCOLOUR
78                         );
79                 Video_DrawRect(
80                         Element->CachedX, Element->CachedY,
81                         Element->CachedW-1, Element->CachedH-1,
82                         BUTTON_BORDER
83                         );
84                 break;
85         
86         case ELETYPE_TEXT:
87                 Video_DrawText(
88                         Element->CachedX+1, Element->CachedY+1,
89                         Element->CachedW-2, Element->CachedH-2,
90                         NULL,
91                         TEXT_COLOUR,
92                         Element->Text
93                         );
94                 break;
95         
96         case ELETYPE_IMAGE:
97                 Video_DrawImage(
98                         Element->CachedX, Element->CachedY,
99                         Element->CachedW, Element->CachedH,
100                         Element->Data
101                         );
102                 break;
103                 
104         default:
105                 _SysDebug(" ERROR: Unknown type %i", Element->Type);
106                 break;
107         }
108 }

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