Add parent ptr

This commit is contained in:
simon.kagstrom 2009-11-29 14:11:21 +00:00
parent dc9418ab4c
commit 601ea56ffb

View File

@ -8,10 +8,12 @@
extern SDL_Surface *screen; extern SDL_Surface *screen;
class Gui;
class MainMenu : public Menu class MainMenu : public Menu
{ {
public: public:
MainMenu(Font *font) : Menu(font) MainMenu(Font *font, Gui *parent) : Menu(font)
{ {
static const char *messages[] = { static const char *messages[] = {
/*00*/ "File", /*00*/ "File",
@ -31,6 +33,7 @@ public:
}; };
this->setText(messages); this->setText(messages);
this->parent = parent;
} }
virtual void selectCallback(int which) virtual void selectCallback(int which)
@ -44,6 +47,9 @@ public:
{ {
printf("entry %d escaped: %s\n", which, this->pp_msgs[which]); printf("entry %d escaped: %s\n", which, this->pp_msgs[which]);
} }
private:
Gui *parent;
}; };
@ -61,7 +67,7 @@ Gui::Gui()
this->main_menu_bg = NULL; this->main_menu_bg = NULL;
this->main_font = NULL; this->main_font = NULL;
this->main_menu = new MainMenu(NULL); this->main_menu = new MainMenu(NULL, this);
} }