Dees_Troy | 51a0e82 | 2012-09-05 15:24:24 -0400 | [diff] [blame] | 1 | // 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 | |
| 20 | extern "C" { |
Dees_Troy | 2673cec | 2013-04-02 20:22:16 +0000 | [diff] [blame] | 21 | #include "../twcommon.h" |
Dees_Troy | 51a0e82 | 2012-09-05 15:24:24 -0400 | [diff] [blame] | 22 | } |
Ethan Yonker | fbb4353 | 2015-12-28 21:54:50 +0100 | [diff] [blame] | 23 | #include "../minuitwrp/minui.h" |
Dees_Troy | 51a0e82 | 2012-09-05 15:24:24 -0400 | [diff] [blame] | 24 | |
| 25 | #include "rapidxml.hpp" |
| 26 | #include "objects.hpp" |
| 27 | |
Vojtech Bocek | ede51c5 | 2014-02-07 23:58:09 +0100 | [diff] [blame] | 28 | GUIFill::GUIFill(xml_node<>* node) : GUIObject(node) |
Dees_Troy | 51a0e82 | 2012-09-05 15:24:24 -0400 | [diff] [blame] | 29 | { |
Ethan Yonker | 21ff02a | 2015-02-18 14:35:00 -0600 | [diff] [blame] | 30 | bool has_color = false; |
| 31 | mColor = LoadAttrColor(node, "color", &has_color); |
| 32 | if (!has_color) { |
Dees_Troy | 2673cec | 2013-04-02 20:22:16 +0000 | [diff] [blame] | 33 | LOGERR("No color specified for fill\n"); |
Vojtech Bocek | fafb0c5 | 2013-07-25 22:53:02 +0200 | [diff] [blame] | 34 | return; |
Dees_Troy | a13d74f | 2013-03-24 08:54:55 -0500 | [diff] [blame] | 35 | } |
Dees_Troy | 51a0e82 | 2012-09-05 15:24:24 -0400 | [diff] [blame] | 36 | |
Vojtech Bocek | fafb0c5 | 2013-07-25 22:53:02 +0200 | [diff] [blame] | 37 | // Load the placement |
Ethan Yonker | 21ff02a | 2015-02-18 14:35:00 -0600 | [diff] [blame] | 38 | LoadPlacement(FindNode(node, "placement"), &mRenderX, &mRenderY, &mRenderW, &mRenderH); |
Dees_Troy | 51a0e82 | 2012-09-05 15:24:24 -0400 | [diff] [blame] | 39 | |
Vojtech Bocek | fafb0c5 | 2013-07-25 22:53:02 +0200 | [diff] [blame] | 40 | return; |
Dees_Troy | 51a0e82 | 2012-09-05 15:24:24 -0400 | [diff] [blame] | 41 | } |
| 42 | |
| 43 | int GUIFill::Render(void) |
| 44 | { |
Vojtech Bocek | ede51c5 | 2014-02-07 23:58:09 +0100 | [diff] [blame] | 45 | if(!isConditionTrue()) |
| 46 | return 0; |
| 47 | |
Vojtech Bocek | fafb0c5 | 2013-07-25 22:53:02 +0200 | [diff] [blame] | 48 | gr_color(mColor.red, mColor.green, mColor.blue, mColor.alpha); |
| 49 | gr_fill(mRenderX, mRenderY, mRenderW, mRenderH); |
| 50 | return 0; |
Dees_Troy | 51a0e82 | 2012-09-05 15:24:24 -0400 | [diff] [blame] | 51 | } |
| 52 | |