blob: d0a1cfda72d0e962bf669838b16b4f611a4fcd75 [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}
Ethan Yonkerfbb43532015-12-28 21:54:50 +010023#include "../minuitwrp/minui.h"
Dees_Troy51a0e822012-09-05 15:24:24 -040024
25#include "rapidxml.hpp"
26#include "objects.hpp"
27
Vojtech Bocekede51c52014-02-07 23:58:09 +010028GUIFill::GUIFill(xml_node<>* node) : GUIObject(node)
Dees_Troy51a0e822012-09-05 15:24:24 -040029{
Ethan Yonker21ff02a2015-02-18 14:35:00 -060030 bool has_color = false;
31 mColor = LoadAttrColor(node, "color", &has_color);
32 if (!has_color) {
Dees_Troy2673cec2013-04-02 20:22:16 +000033 LOGERR("No color specified for fill\n");
Vojtech Bocekfafb0c52013-07-25 22:53:02 +020034 return;
Dees_Troya13d74f2013-03-24 08:54:55 -050035 }
Dees_Troy51a0e822012-09-05 15:24:24 -040036
Vojtech Bocekfafb0c52013-07-25 22:53:02 +020037 // Load the placement
Ethan Yonker21ff02a2015-02-18 14:35:00 -060038 LoadPlacement(FindNode(node, "placement"), &mRenderX, &mRenderY, &mRenderW, &mRenderH);
Dees_Troy51a0e822012-09-05 15:24:24 -040039
Vojtech Bocekfafb0c52013-07-25 22:53:02 +020040 return;
Dees_Troy51a0e822012-09-05 15:24:24 -040041}
42
43int GUIFill::Render(void)
44{
Vojtech Bocekede51c52014-02-07 23:58:09 +010045 if(!isConditionTrue())
46 return 0;
47
Vojtech Bocekfafb0c52013-07-25 22:53:02 +020048 gr_color(mColor.red, mColor.green, mColor.blue, mColor.alpha);
49 gr_fill(mRenderX, mRenderY, mRenderW, mRenderH);
50 return 0;
Dees_Troy51a0e822012-09-05 15:24:24 -040051}
52