axwin2 - Working on GUI, implemented image loading
[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;
38         
39         case ELETYPE_TABBAR:    // TODO: Moar
40         case ELETYPE_TOOLBAR:
41                 Video_DrawRect(
42                         Element->CachedX, Element->CachedY,
43                         Element->CachedW, Element->CachedH,
44                         BOX_BORDER
45                         );
46                 Video_FillRect(
47                         Element->CachedX+1, Element->CachedY+1,
48                         Element->CachedW-2, Element->CachedH-2,
49                         BOX_BGCOLOUR
50                         );
51                 break;
52         
53         case ELETYPE_SPACER:
54                 Video_FillRect(
55                         Element->CachedX+3, Element->CachedY+3,
56                         Element->CachedW-6, Element->CachedH-6,
57                         BOX_BORDER
58                         );
59                 break;
60         
61         case ELETYPE_BUTTON:
62                 Video_FillRect(
63                         Element->CachedX+1, Element->CachedY+1,
64                         Element->CachedW-2, Element->CachedH-2,
65                         BUTTON_BORDER
66                         );
67                 Video_DrawRect(
68                         Element->CachedX, Element->CachedY,
69                         Element->CachedW-1, Element->CachedH-1,
70                         BUTTON_BORDER
71                         );
72                 break;
73         
74         case ELETYPE_TEXT:
75                 Video_DrawText(
76                         Element->CachedX+1, Element->CachedY+1,
77                         Element->CachedW-2, Element->CachedH-2,
78                         NULL,
79                         TEXT_COLOUR,
80                         Element->Text
81                         );
82                 break;
83         
84         case ELETYPE_IMAGE:
85                 Video_DrawImage(
86                         Element->CachedX, Element->CachedY,
87                         Element->CachedW, Element->CachedH,
88                         Element->Data
89                         );
90                 break;
91         }
92 }

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