1 //---------------------------------------------------------------------------
2 #include "stdafx.h"
3
4 #include <cassert>
5
6 #include "panel.h"
7 #include "game.h"
8 #include "utils.h"
9 #include "sector.h"
10 #include "screen.h"
11 #include "image.h"
12 #include "sound.h"
13
14 //---------------------------------------------------------------------------
15
registerClick()16 void registerClick() {
17 //LOG("registerClick()\n");
18 // call for gui items to be registered as a mouse click, rather than continuous press
19 playSample(game_g->s_guiclick, SOUND_CHANNEL_FX);
20 game_g->s_guiclick->setVolume(0.125f);
21 }
22
PanelPage(int offset_x,int offset_y)23 PanelPage::PanelPage(int offset_x,int offset_y) {
24 init_panelpage();
25 this->offset_x = offset_x;
26 this->offset_y = offset_y;
27 }
28
PanelPage(int offset_x,int offset_y,const char * infoLMB)29 PanelPage::PanelPage(int offset_x,int offset_y,const char *infoLMB) {
30 init_panelpage();
31 this->offset_x = offset_x;
32 this->offset_y = offset_y;
33 this->setInfoLMB(infoLMB);
34 }
35
PanelPage(int offset_x,int offset_y,int w,int h)36 PanelPage::PanelPage(int offset_x,int offset_y,int w,int h) {
37 init_panelpage();
38 this->offset_x = offset_x;
39 this->offset_y = offset_y;
40 this->w = w;
41 this->h = h;
42 }
43
~PanelPage()44 PanelPage::~PanelPage() {
45 if( owner != NULL )
46 owner->remove(this);
47 free(true);
48 delete children;
49 }
50
init_panelpage()51 void PanelPage::init_panelpage() {
52 this->owner = NULL;
53 this->modal_child = NULL;
54 this->offset_x = 0;
55 this->offset_y = 0;
56 this->w = 0;
57 this->h = 0;
58 this->has_background = false;
59 for(int i=0;i<4;i++)
60 this->background[i] = 0;
61 this->tolerance = game_g->isMobileUI() ? 2 : 0;
62 this->visible = true;
63 this->enabled = true;
64 this->children = new vector<PanelPage *>();
65 this->popup_item = false;
66 this->popup_x = 0;
67 this->popup_y = 0;
68 this->is_inside_area = false;
69 this->inside_area_time = 0;
70 this->survive_owner = false;
71 this->helpTextOn = true;
72 }
73
add(PanelPage * panel)74 void PanelPage::add(PanelPage *panel) {
75 this->children->push_back(panel);
76 panel->owner = this;
77 }
78
remove(PanelPage * panel)79 void PanelPage::remove(PanelPage *panel) {
80 if( panel == this->modal_child )
81 this->modal_child = NULL;
82 panel->owner = NULL;
83 remove_vec(this->children, panel);
84 }
85
getLeft() const86 int PanelPage::getLeft() const {
87 int parent_left = owner != NULL ? owner->getLeft() : 0;
88 return parent_left + offset_x;
89 }
90
getTop() const91 int PanelPage::getTop() const {
92 int parent_top = owner != NULL ? owner->getTop() : 0;
93 return parent_top + offset_y;
94 }
95
getRight() const96 int PanelPage::getRight() const {
97 return owner->getLeft() + offset_x + w;
98 }
99
getXCentre() const100 int PanelPage::getXCentre() const {
101 return owner->getLeft() + offset_x + w/2;
102 }
103
getYCentre() const104 int PanelPage::getYCentre() const {
105 return owner->getTop() + offset_y + h/2;
106 }
107
getBottom() const108 int PanelPage::getBottom() const {
109 return owner->getTop() + offset_y + h;
110 }
111
findById(const string & id)112 PanelPage *PanelPage::findById(const string &id) {
113 if( this->id == id )
114 return this;
115 for(int i=0;i<nChildren();i++) {
116 PanelPage *panel = get(i);
117 PanelPage *found = panel->findById(id);
118 if( found != NULL )
119 return found;
120 }
121 return NULL;
122 }
123
setVisible(bool visible)124 void PanelPage::setVisible(bool visible) {
125 this->visible = visible;
126 for(int i=0;i<nChildren();i++) {
127 PanelPage *panel = get(i);
128 panel->setVisible(visible);
129 }
130 }
131
setEnabled(bool enabled)132 void PanelPage::setEnabled(bool enabled) {
133 this->enabled = enabled;
134 for(int i=0;i<nChildren();i++) {
135 PanelPage *panel = get(i);
136 panel->setEnabled(enabled);
137 }
138 }
139
setInfoLMB(const char * text)140 void PanelPage::setInfoLMB(const char *text) {
141 /*strncpy(infoLMB, text, GUI_MAX_STRING);
142 infoLMB[GUI_MAX_STRING] = '\0';*/
143 infoLMB = text;
144 }
145
setInfoRMB(const char * text)146 void PanelPage::setInfoRMB(const char *text) {
147 /*strncpy(infoRMB, text, GUI_MAX_STRING);
148 infoRMB[GUI_MAX_STRING] = '\0';*/
149 infoRMB = text;
150 }
151
152 /*void PanelPage::setInfoBMB(const char *text) {
153 infoBMB = text;
154 }*/
155
getInfoLMB() const156 const char *PanelPage::getInfoLMB() const {
157 //return ( *infoLMB == '\0' ) ? NULL : infoLMB;
158 return infoLMB.length() == 0 ? NULL : infoLMB.c_str();
159 }
160
getInfoRMB() const161 const char *PanelPage::getInfoRMB() const {
162 //return ( *infoRMB == '\0' ) ? NULL : infoRMB;
163 return infoRMB.length() == 0 ? NULL : infoRMB.c_str();
164 }
165
166 /*const char *PanelPage::getInfoBMB() const {
167 return infoBMB.length() == 0 ? NULL : infoBMB.c_str();
168 }*/
169
free(bool free_this)170 void PanelPage::free(bool free_this) {
171 for(unsigned int i=0;i<children->size();i++) {
172 PanelPage *panel = children->at(i);
173 // panel should be non-NULL, but to satisfy VS Code Analysis...
174 if( panel != NULL && !panel->survive_owner ) {
175 if( free_this ) {
176 panel->owner = NULL; // this must be done before deletion!
177 delete panel;
178 }
179 else
180 panel->free(true);
181 }
182 }
183 if( free_this ) {
184 children->clear();
185 }
186 if( this->modal_child != NULL && free_this ) {
187 modal_child = NULL;
188 }
189 }
190
drawPopups()191 void PanelPage::drawPopups() {
192 if( game_g->isMobileUI() ) {
193 return;
194 }
195 /*if( owner != NULL )
196 {
197 // DEBUG
198 int sx = (int)((owner->getLeft() + offset_x - tolerance) * game_g->getScaleWidth());
199 int sy = (int)((owner->getTop() + offset_y - tolerance) * game_g->getScaleHeight());
200 game_g->getScreen()->fillRect(sx, sy, (this->w+2*tolerance)*game_g->getScaleWidth(), (this->h+2*tolerance)*game_g->getScaleHeight(), 255, 0, 255);
201 }*/
202 // popup text
203 int m_x = 0, m_y = 0;
204 game_g->getScreen()->getMouseCoords(&m_x, &m_y);
205 PanelPage *panel = this;
206 const char *lmb_text = panel->getInfoLMB();
207 const char *rmb_text = panel->getInfoRMB();
208 //const char *bmb_text = panel->getInfoBMB();
209 if( is_inside_area ) {
210 if( !panel->mouseOver(m_x, m_y) ) {
211 is_inside_area = false;
212 inside_area_time = 0;
213 }
214 }
215 else {
216 if( panel->mouseOver(m_x, m_y) ) {
217 is_inside_area = true;
218 inside_area_time = game_g->getRealTime();
219 }
220 }
221 if( lmb_text != NULL || rmb_text != NULL /*|| bmb_text != NULL*/ ) {
222 if( panel->isHelpTextOn() && is_inside_area && game_g->getRealTime() < inside_area_time + 5000 ) {
223 if( !popup_item ) {
224 //LOG("create popup\n");
225 popup_item = true;
226 popup_x = (int)(m_x/game_g->getScaleWidth());
227 popup_y = (int)(m_y/game_g->getScaleHeight());
228 popup_x = (int)(popup_x*game_g->getScaleWidth());
229 popup_y = (int)(popup_y*game_g->getScaleHeight());
230 }
231 //LOG("draw popup\n");
232 {
233 int n_texts = 0;
234 /*const char *text[3] = {NULL, NULL, NULL};
235 int mice_indx[3] = {-1, -1, -1};*/
236 const char *text[3] = {NULL, NULL};
237 int mice_indx[3] = {-1, -1};
238 if( rmb_text != NULL ) {
239 text[n_texts] = rmb_text;
240 mice_indx[n_texts] = 1;
241 n_texts++;
242 }
243 if( lmb_text != NULL ) {
244 text[n_texts] = lmb_text;
245 mice_indx[n_texts] = 0;
246 n_texts++;
247 }
248 /*if( bmb_text != NULL ) {
249 text[n_texts] = bmb_text;
250 mice_indx[n_texts] = 2;
251 n_texts++;
252 }*/
253 int w = game_g->letters_small[0]->getScaledWidth();
254 int h = game_g->letters_small[0]->getScaledHeight() + 2;
255 int off_x = (int)(popup_x/game_g->getScaleWidth() + 24);
256 int gap_left = 20;
257 int gap_right = 4;
258 int gap_y = 4;
259 int between_lines_y = 2;
260 int between_texts_y = 4;
261 bool one_line[3];
262 int n_lines[3];
263 int total_lines = 0;
264 int max_wid = 0;
265 for(int j=0;j<n_texts;j++) {
266 int this_max_wid = 0;
267 textLines(&n_lines[j], &this_max_wid, text[j], w, w);
268 if( this_max_wid > max_wid )
269 max_wid = this_max_wid;
270 one_line[j] = n_lines[j] == 1;
271 if( one_line[j] )
272 n_lines[j] = 2;
273 total_lines += n_lines[j];
274 }
275
276 int rect_x = (int)(off_x * game_g->getScaleWidth());
277 int rect_y = (int)(popup_y - gap_y * game_g->getScaleHeight());
278 int rect_w = (int)(( max_wid + gap_left + gap_right ) * game_g->getScaleWidth());
279 int rect_h = (int)(( 2 * gap_y + h * total_lines +
280 between_lines_y * ( total_lines - 1 ) +
281 ( between_texts_y - between_lines_y ) * ( n_texts - 1 ) ) * game_g->getScaleHeight());
282 if( rect_x + rect_w >= default_width_c * game_g->getScaleWidth() ) {
283 off_x = (int)(default_width_c - 8 - rect_w/game_g->getScaleWidth());
284 rect_x = (int)(off_x * game_g->getScaleWidth());
285 // also adjust y
286 int new_y = (int)(panel->getBottom() * game_g->getScaleHeight());
287 if( new_y + rect_h >= default_height_c * game_g->getScaleHeight() ) {
288 new_y = (int)(panel->getTop() * game_g->getScaleHeight() - rect_h);
289 }
290 popup_y += new_y - rect_y;
291 rect_y = new_y;
292 }
293 else if( rect_y + rect_h >= default_height_c * game_g->getScaleHeight() ) {
294 int new_y = (int)(( default_height_c - 1 ) * game_g->getScaleHeight() - rect_h);
295 popup_y += new_y - rect_y;
296 rect_y = new_y;
297 }
298 rect_x++;
299 rect_y++;
300 rect_w -= 2;
301 rect_h -= 2;
302 const unsigned char panel_background_r = 128;
303 const unsigned char panel_background_g = 128;
304 const unsigned char panel_background_b = 128;
305 const unsigned char panel_background_a = 160;
306 #if SDL_MAJOR_VERSION == 1
307 Image *fill_rect = Image::createBlankImage(rect_w, rect_h, 24);
308 fill_rect->fillRect(0, 0, rect_w, rect_h, panel_background_r, panel_background_g, panel_background_b);
309 fill_rect->convertToDisplayFormat();
310 fill_rect->drawWithAlpha(rect_x, rect_y, panel_background_a);
311 delete fill_rect;
312 #else
313 game_g->getScreen()->fillRectWithAlpha(rect_x, rect_y, rect_w, rect_h, panel_background_r, panel_background_g, panel_background_b, panel_background_a);
314 #endif
315
316 int py = (int)(popup_y/game_g->getScaleHeight());
317 for(int j=0;j<n_texts;j++) {
318 game_g->icon_mice[mice_indx[j]]->draw(off_x + 4, py);
319 Image::write(off_x + gap_left, py + (one_line[j] ? h/2 : 0), game_g->letters_small, text[j], Image::JUSTIFY_LEFT);
320 py += n_lines[j] * h + between_texts_y;
321 }
322 }
323 }
324 else
325 popup_item = false;
326 }
327 else
328 popup_item = false;
329
330
331 for(unsigned int i=0;i<children->size();i++) {
332 PanelPage *panel = children->at(i);
333 panel->drawPopups();
334 }
335 }
336
drawBackground()337 void PanelPage::drawBackground() {
338 if( this->has_background && this->visible ) {
339 int rect_x = (int)(game_g->getScaleWidth()*(owner->getLeft() + offset_x));
340 int rect_y = (int)(game_g->getScaleWidth()*(owner->getTop() + offset_y));
341 int rect_w = (int)(game_g->getScaleWidth()*this->w);
342 int rect_h = (int)(game_g->getScaleHeight()*this->h);
343 #if SDL_MAJOR_VERSION == 1
344 Image *fill_rect = Image::createBlankImage(rect_w, rect_h, 24);
345 fill_rect->fillRect(0, 0, rect_w, rect_h, background[0], background[1], background[2]);
346 fill_rect->convertToDisplayFormat();
347 fill_rect->drawWithAlpha(rect_x, rect_y, background[3]);
348 delete fill_rect;
349 #else
350 game_g->getScreen()->fillRectWithAlpha((short)rect_x, (short)rect_y, (short)rect_w, (short)rect_h, background[0], background[1], background[2], background[3]);
351 #endif
352 }
353 }
354
drawForeground()355 void PanelPage::drawForeground() {
356 for(unsigned int i=0;i<children->size();i++) {
357 PanelPage *panel = children->at(i);
358 panel->draw();
359 }
360
361 this->drawPopups();
362 }
363
draw()364 void PanelPage::draw() {
365 this->drawBackground();
366 this->drawForeground();
367 }
368
mouseOver(int m_x,int m_y) const369 bool PanelPage::mouseOver(int m_x,int m_y) const {
370 if( visible && enabled &&
371 m_x >= ( this->getLeft() - tolerance ) * game_g->getScaleWidth() &&
372 m_x < ( this->getLeft() + w + tolerance ) * game_g->getScaleWidth() &&
373 m_y >= ( this->getTop() - tolerance ) * game_g->getScaleHeight() &&
374 m_y < ( this->getTop() + h + tolerance ) * game_g->getScaleHeight() ) {
375 return true;
376 }
377 return false;
378 }
379
input(int m_x,int m_y,bool m_left,bool m_middle,bool m_right,bool click)380 void PanelPage::input(int m_x,int m_y,bool m_left,bool m_middle,bool m_right,bool click) {
381 // mouseOver check disabled, as PanelPages currently have 0 width and height
382 /*if( !mouseOver(m_x, m_y) ) {
383 return;
384 }*/
385 if( this->modal_child != NULL ) {
386 this->modal_child->input(m_x, m_y, m_left, m_middle, m_right, click);
387 return;
388 }
389 for(unsigned int i=0;i<children->size();i++) {
390 PanelPage *panel = children->at(i);
391 panel->input(m_x, m_y, m_left, m_middle, m_right, click);
392 }
393 }
394
395 /*Button::Button(int x,int y,Image *image) : PanelPage(x, y) {
396 init_button();
397 this->image = image;
398 this->w = image->getScaledWidth();
399 this->h = image->getScaledHeight();
400 }
401
402 Button::Button(int x,int y,Image *image,char *infoLMB) : PanelPage(x, y, infoLMB) {
403 init_button();
404 this->image = image;
405 this->w = image->getScaledWidth();
406 this->h = image->getScaledHeight();
407 }
408
409 Button::Button(int x,int y,int w, int h,Image *image) : PanelPage(x, y) {
410 init_button();
411 this->w = w;
412 this->h = h;
413 this->image = image;
414 }*/
415
Button(int x,int y,const char * text,Image * font[])416 Button::Button(int x,int y,const char *text,Image *font[]) : PanelPage(x, y) {
417 this->text = text;
418 this->font = font;
419 this->w = font[0]->getScaledWidth() * this->text.length() + 2;
420 this->h = font[0]->getScaledHeight() + 2;
421 this->draw_offset_x = 0;
422 if( game_g->isMobileUI() ) {
423 this->tolerance += 4;
424 //this->h += 8; // useful for Android, where touches often seem to register lower than I seem to expect
425 }
426 }
427
Button(int x,int y,int h,const char * text,Image * font[])428 Button::Button(int x,int y,int h,const char *text,Image *font[]) : PanelPage(x, y) {
429 this->text = text;
430 this->font = font;
431 this->w = font[0]->getScaledWidth() * this->text.length() + 2;
432 this->h = h;
433 this->draw_offset_x = 0;
434 if( game_g->isMobileUI() ) {
435 this->tolerance += 4;
436 //this->h += 8; // useful for Android, where touches often seem to register lower than I seem to expect
437 }
438 }
439
Button(int x,int y,int draw_offset_x,int h,const char * text,Image * font[])440 Button::Button(int x,int y,int draw_offset_x,int h,const char *text,Image *font[]) : PanelPage(x, y) {
441 this->text = text;
442 this->font = font;
443 this->w = draw_offset_x + font[0]->getScaledWidth() * this->text.length() + 2;
444 this->h = h;
445 this->draw_offset_x = draw_offset_x;
446 if( game_g->isMobileUI() ) {
447 this->tolerance += 4;
448 //this->h += 8; // useful for Android, where touches often seem to register lower than I seem to expect
449 }
450 }
451
~Button()452 Button::~Button() {
453 }
454
draw()455 void Button::draw() {
456 this->drawBackground();
457 if( visible ) {
458 //LOG("write: %s\n", this->text.c_str());
459 /*{
460 // DEBUG
461 int sx = (int)((owner->getLeft() + offset_x - tolerance) * game_g->getScaleWidth());
462 int sy = (int)((owner->getTop() + offset_y - tolerance) * game_g->getScaleHeight());
463 game_g->getScreen()->fillRect(sx, sy, (this->w+2*tolerance)*game_g->getScaleWidth(), (this->h+2*tolerance)*game_g->getScaleHeight(), 255, 0, 255);
464 }*/
465 Image::writeMixedCase(owner->getLeft() + offset_x + draw_offset_x + 1, owner->getTop() + offset_y + 1, this->font, this->font, game_g->numbers_yellow, this->text.c_str(), Image::JUSTIFY_LEFT);
466 }
467 this->drawForeground();
468 }
469
ImageButton(int x,int y,const Image * image)470 ImageButton::ImageButton(int x,int y,const Image *image) : PanelPage(x, y) {
471 ASSERT(image != NULL);
472 this->image = image;
473 /*this->has_alpha = false;
474 this->alpha = 255;*/
475 this->w = image->getScaledWidth();
476 this->h = image->getScaledHeight();
477 }
478
ImageButton(int x,int y,const Image * image,const char * infoLMB)479 ImageButton::ImageButton(int x,int y,const Image *image,const char *infoLMB) : PanelPage(x, y, infoLMB) {
480 ASSERT(image != NULL);
481 this->image = image;
482 /*this->has_alpha = false;
483 this->alpha = 255;*/
484 this->w = image->getScaledWidth();
485 this->h = image->getScaledHeight();
486 }
487
ImageButton(int x,int y,int w,int h,const Image * image)488 ImageButton::ImageButton(int x,int y,int w, int h,const Image *image) : PanelPage(x, y) {
489 ASSERT(image != NULL);
490 this->image = image;
491 /*this->has_alpha = false;
492 this->alpha = 255;*/
493 this->w = w;
494 this->h = h;
495 }
496
ImageButton(int x,int y,int w,int h,const Image * image,const char * infoLMB)497 ImageButton::ImageButton(int x,int y,int w, int h,const Image *image,const char *infoLMB) : PanelPage(x, y, infoLMB) {
498 ASSERT(image != NULL);
499 this->image = image;
500 /*this->has_alpha = false;
501 this->alpha = 255;*/
502 this->w = w;
503 this->h = h;
504 }
505
~ImageButton()506 ImageButton::~ImageButton() {
507 }
508
draw()509 void ImageButton::draw() {
510 this->drawBackground();
511 if( visible && image != NULL ) {
512 //LOG("imagebutton: %d, %d\n", owner->getLeft() + offset_x, owner->getTop() + offset_y);
513 /*{
514 // DEBUG
515 int sx = (int)((owner->getLeft() + offset_x - tolerance) * game_g->getScaleWidth());
516 int sy = (int)((owner->getTop() + offset_y - tolerance) * game_g->getScaleHeight());
517 game_g->getScreen()->fillRect(sx, sy, (this->w+2*tolerance)*game_g->getScaleWidth(), (this->h+2*tolerance)*game_g->getScaleHeight(), 255, 0, 255);
518 }*/
519 /*if( has_alpha ) {
520 image->drawWithAlpha(owner->getLeft() + offset_x, owner->getTop() + offset_y, alpha);
521 }
522 else {
523 image->draw(owner->getLeft() + offset_x, owner->getTop() + offset_y, true);
524 }*/
525 image->draw(owner->getLeft() + offset_x, owner->getTop() + offset_y);
526 }
527 this->drawForeground();
528 }
529
CycleButton(int x,int y,const char * texts[],int n_texts,Image * font[])530 CycleButton::CycleButton(int x,int y,const char *texts[],int n_texts,Image *font[]) : PanelPage(x, y) {
531 ASSERT( n_texts > 0 );
532 this->n_texts = n_texts;
533 this->texts = new char *[n_texts];
534 int max_len = 0;
535 for(int i=0;i<n_texts;i++) {
536 int len = strlen(texts[i]);
537 if( len > max_len )
538 max_len = len;
539 this->texts[i] = new char[ len + 1 ];
540 strncpy(this->texts[i], texts[i], len);
541 (this->texts[i])[len] = '\0';
542 }
543 this->font = font;
544 this->w = font[0]->getScaledWidth() * max_len + 2;
545 this->h = font[0]->getScaledHeight() + 2;
546 this->active = 0;
547 if( game_g->isMobileUI() ) {
548 this->tolerance += 4;
549 //this->h += 8; // useful for Android, where touches often seem to register lower than I seem to expect
550 }
551 }
552
~CycleButton()553 CycleButton::~CycleButton() {
554 for(int i=0;i<n_texts;i++) {
555 delete [] (texts[i]);
556 }
557 delete [] texts;
558 }
559
draw()560 void CycleButton::draw() {
561 this->drawBackground();
562 if( visible ) {
563 /*{
564 // DEBUG
565 int sx = (int)((owner->getLeft() + offset_x - tolerance) * game_g->getScaleWidth());
566 int sy = (int)((owner->getTop() + offset_y - tolerance) * game_g->getScaleHeight());
567 game_g->getScreen()->fillRect(sx, sy, (this->w+2*tolerance)*game_g->getScaleWidth(), (this->h+2*tolerance)*game_g->getScaleHeight(), 255, 0, 255);
568 }*/
569 Image::write(owner->getLeft() + offset_x + 1, owner->getTop() + offset_y + 1, this->font, this->texts[ this->active ], Image::JUSTIFY_LEFT);
570 }
571 this->drawForeground();
572 }
573
setActive(int active)574 void CycleButton::setActive(int active) {
575 ASSERT( active >= 0 && active < n_texts );
576 this->active = active;
577 }
578
input(int m_x,int m_y,bool m_left,bool m_middle,bool m_right,bool click)579 void CycleButton::input(int m_x,int m_y,bool m_left,bool m_middle,bool m_right,bool click) {
580 if( this->mouseOver(m_x, m_y) && m_left && click ) {
581 registerClick();
582 this->active++;
583 if( this->active == this->n_texts )
584 this->active = 0;
585 }
586 PanelPage::input(m_x, m_y, m_left, m_middle, m_right, click);
587 }
588
MultiPanel(int n_pages,int x,int y)589 MultiPanel::MultiPanel(int n_pages, int x, int y) : PanelPage(x, y) {
590 int i;
591 //this->n_pages = n_pages;
592 //this->pages = new PanelPage *[n_pages];
593 for(i=0;i<n_pages;i++) {
594 /*this->pages[i] = new PanelPage(0, 0);
595 this->add( this->pages[i] );*/
596 this->add( new PanelPage(0, 0) );
597 //this->get(i)->owner = this;
598 }
599 this->c_page = 0;
600
601 }
602
~MultiPanel()603 MultiPanel::~MultiPanel() {
604 this->free(true);
605 //delete [] this->pages;
606 }
607
608 /*void MultiPanel::free() {
609 for(int i=0;i<this->nChildren();i++)
610 this->get(i)->free();
611 }
612 */
addToPanel(int page,PanelPage * panel)613 void MultiPanel::addToPanel(int page,PanelPage *panel) {
614 //this->pages[page]->add(panel);
615 this->get(page)->add(panel);
616 }
617
618 /*void MultiPanel::drawPopups() {
619 this->get(this->c_page)->drawPopups();
620 }*/
621
draw()622 void MultiPanel::draw() {
623 //this->pages[this->c_page]->draw();
624 this->get(this->c_page)->draw();
625 }
626
input(int m_x,int m_y,bool m_left,bool m_middle,bool m_right,bool click)627 void MultiPanel::input(int m_x,int m_y,bool m_left,bool m_middle,bool m_right,bool click) {
628 //this->pages[this->c_page]->input(m_x, m_y, m_b);
629 this->get(this->c_page)->input(m_x, m_y, m_left, m_middle, m_right, click);
630 }
631
632