Change Details
src/browsedialog.cpp |
232 | 232 | writeTitle(title); |
233 | 233 | writeSubTitle(subtitle); |
234 | 234 | |
235 | | buttonBox.paint(5); |
| 235 | buttonBox.paint(gmenu2x->s, 5); |
236 | 236 | |
237 | 237 | // TODO(MtH): I have no idea what the right value of firstElement would be, |
238 | 238 | // but originally it was undefined and that is never a good idea. |
src/buttonbox.cpp |
22 | 22 | buttons.clear(); |
23 | 23 | } |
24 | 24 | |
25 | | void ButtonBox::paint(unsigned int posX) |
| 25 | void ButtonBox::paint(Surface *s, unsigned int posX) |
26 | 26 | { |
27 | 27 | for (auto button : buttons) |
28 | | posX = gmenu2x->drawButton(button, posX); |
| 28 | posX = gmenu2x->drawButton(s, button, posX); |
29 | 29 | } |
30 | 30 | |
31 | 31 | void ButtonBox::handleTS() |
src/buttonbox.h |
5 | 5 | |
6 | 6 | class GMenu2X; |
7 | 7 | class IconButton; |
| 8 | class Surface; |
8 | 9 | |
9 | 10 | class ButtonBox |
10 | 11 | { |
... | ... | |
15 | 16 | void add(IconButton *button); |
16 | 17 | void clear(); |
17 | 18 | |
18 | | void paint(unsigned int posX); |
| 19 | void paint(Surface *s, unsigned int posX); |
19 | 20 | void handleTS(); |
20 | 21 | |
21 | 22 | private: |
src/gmenu2x.cpp |
1177 | 1177 | return df; |
1178 | 1178 | } |
1179 | 1179 | |
1180 | | int GMenu2X::drawButton(IconButton *btn, int x, int y) { |
| 1180 | int GMenu2X::drawButton(Surface *s, IconButton *btn, int x, int y) { |
1181 | 1181 | if (y<0) y = resY+y; |
1182 | 1182 | btn->setPosition(x, y-7); |
1183 | | btn->paint(); |
| 1183 | btn->paint(s); |
1184 | 1184 | return x+btn->getRect().w+6; |
1185 | 1185 | } |
1186 | 1186 | |
src/gmenu2x.h |
212 | 212 | void renameSection(); |
213 | 213 | void deleteSection(); |
214 | 214 | |
215 | | int drawButton(IconButton *btn, int x=5, int y=-10); |
| 215 | int drawButton(Surface *s, IconButton *btn, int x=5, int y=-10); |
216 | 216 | int drawButton(Surface *s, const std::string &btn, const std::string &text, int x=5, int y=-10); |
217 | 217 | int drawButtonRight(Surface *s, const std::string &btn, const std::string &text, int x=5, int y=-10); |
218 | 218 | void drawScrollBar(uint pageSize, uint totalSize, uint pagePos); |
src/iconbutton.cpp |
65 | 65 | return false; |
66 | 66 | } |
67 | 67 | |
68 | | void IconButton::paint() { |
| 68 | void IconButton::paint(Surface *s) { |
69 | 69 | if (iconSurface) { |
70 | | iconSurface->blit(gmenu2x->s, iconRect); |
| 70 | iconSurface->blit(s, iconRect); |
71 | 71 | } |
72 | 72 | if (!label.empty()) { |
73 | | gmenu2x->s->write(gmenu2x->font, label, labelRect.x, labelRect.y, |
| 73 | s->write(gmenu2x->font, label, labelRect.x, labelRect.y, |
74 | 74 | Font::HAlignLeft, Font::VAlignMiddle); |
75 | 75 | } |
76 | 76 | } |
src/iconbutton.h |
2 | 2 | #define ICONBUTTON_H |
3 | 3 | |
4 | 4 | #include "delegate.h" |
| 5 | #include "gmenu2x.h" |
5 | 6 | |
6 | 7 | #include <SDL.h> |
7 | 8 | #include <string> |
8 | 9 | |
9 | | class GMenu2X; |
10 | 10 | class Surface; |
11 | 11 | class Touchscreen; |
12 | 12 | |
... | ... | |
23 | 23 | |
24 | 24 | bool handleTS(); |
25 | 25 | |
26 | | void paint(); |
| 26 | void paint(Surface *s); |
| 27 | void paint() { paint(gmenu2x->s); } |
27 | 28 | |
28 | 29 | private: |
29 | 30 | void recalcRects(); |
src/inputdialog.cpp |
159 | 159 | writeSubTitle(text); |
160 | 160 | drawTitleIcon(icon); |
161 | 161 | |
162 | | buttonbox->paint(5); |
| 162 | buttonbox->paint(gmenu2x->s, 5); |
163 | 163 | |
164 | 164 | box.w = gmenu2x->font->getTextWidth(input) + 18; |
165 | 165 | box.x = 160 - box.w / 2; |
src/menusetting.cpp |
51 | 51 | |
52 | 52 | void MenuSetting::drawSelected(int /*y*/) |
53 | 53 | { |
54 | | buttonBox.paint(5); |
| 54 | buttonBox.paint(gmenu2x->s, 5); |
55 | 55 | } |
src/wallpaperdialog.cpp |
95 | 95 | writeTitle("Wallpaper selection"); |
96 | 96 | writeSubTitle("Select an image from the list, to use as a wallpaper"); |
97 | 97 | |
98 | | buttonbox.paint(5); |
| 98 | buttonbox.paint(gmenu2x->s, 5); |
99 | 99 | |
100 | 100 | //Selection |
101 | 101 | iY = selected-firstElement; |
Download the corresponding diff file