blob: 901eee140c30a897ea38dd79d28518344bab05bf [file] [log] [blame]
Dees_Troy51a0e822012-09-05 15:24:24 -04001// fill.cpp - GUIFill object
2
3#include <stdarg.h>
4#include <stdio.h>
5#include <stdlib.h>
6#include <string.h>
7#include <fcntl.h>
8#include <sys/reboot.h>
9#include <sys/stat.h>
10#include <sys/time.h>
11#include <sys/mman.h>
12#include <sys/types.h>
13#include <sys/ioctl.h>
14#include <time.h>
15#include <unistd.h>
16#include <stdlib.h>
17
18#include <string>
19
20extern "C" {
Dees_Troy2673cec2013-04-02 20:22:16 +000021#include "../twcommon.h"
Dees_Troy51a0e822012-09-05 15:24:24 -040022#include "../minuitwrp/minui.h"
Dees_Troy51a0e822012-09-05 15:24:24 -040023}
24
25#include "rapidxml.hpp"
26#include "objects.hpp"
27
28GUIFill::GUIFill(xml_node<>* node)
29{
30 xml_attribute<>* attr;
31 xml_node<>* child;
32
33 if (!node)
34 return;
35
36 attr = node->first_attribute("color");
Dees_Troya13d74f2013-03-24 08:54:55 -050037 if (!attr) {
Dees_Troy2673cec2013-04-02 20:22:16 +000038 LOGERR("No color specified for fill\n");
Dees_Troy51a0e822012-09-05 15:24:24 -040039 return;
Dees_Troya13d74f2013-03-24 08:54:55 -050040 }
Dees_Troy51a0e822012-09-05 15:24:24 -040041
42 std::string color = attr->value();
43 ConvertStrToColor(color, &mColor);
44
45 // Load the placement
46 LoadPlacement(node->first_node("placement"), &mRenderX, &mRenderY, &mRenderW, &mRenderH);
47
48 return;
49}
50
51int GUIFill::Render(void)
52{
53 gr_color(mColor.red, mColor.green, mColor.blue, mColor.alpha);
54 gr_fill(mRenderX, mRenderY, mRenderW, mRenderH);
55 return 0;
56}
57