Make GuiView a widget

This commit is contained in:
simon.kagstrom 2009-12-20 09:31:46 +00:00
parent b4f133036a
commit 2e768d0c67
5 changed files with 23 additions and 19 deletions

18
gui.hh
View File

@ -6,24 +6,11 @@
#include "menu.hh"
#include "font.hh"
#include "timer.hh"
#include "gui_view.hh"
class Gui;
class MainView;
class DiscView;
class GuiView
{
public:
GuiView();
virtual void pushEvent(SDL_Event *ev) = 0;
virtual void runLogic() = 0;
virtual void updateTheme() = 0;
virtual void draw(SDL_Surface *where) = 0;
};
class KeyboardView;
class Gui
{
@ -83,6 +70,7 @@ public:
MainView *mv;
DiscView *dv;
KeyboardView *kv;
GuiView **views;
int n_views;

View File

@ -70,7 +70,7 @@ static const char *shifted_names[KEY_COLS * KEY_ROWS] = {
NULL, NULL, NULL, NULL, NULL, NULL, "f2", "f4", "f6", "f8", "Ins", NULL, NULL, NULL, NULL,
};
VirtualKeyboard::VirtualKeyboard(Font *font) : Widget()
VirtualKeyboard::VirtualKeyboard(Font *font) : GuiView()
{
this->font = font;
this->sel_x = 0;
@ -349,5 +349,13 @@ void VirtualKeyboard::runLogic()
}
}
void VirtualKeyboard::draw(SDL_Surface *where)
{
}
void VirtualKeyboard::updateTheme()
{
}
/* The singleton */
VirtualKeyboard *VirtualKeyboard::kbd;

View File

@ -15,6 +15,7 @@
#include <SDL.h>
#include "widget.hh"
#include "gui_view.hh"
#include "font.hh"
struct virtkey;
@ -32,7 +33,7 @@ public:
virtual void stringCallback(const char *str) = 0;
};
class VirtualKeyboard : public Widget
class VirtualKeyboard : public GuiView
{
public:
VirtualKeyboard(Font *font);
@ -65,6 +66,10 @@ public:
return this->is_active;
}
virtual void updateTheme();
void draw(SDL_Surface *where);
void runLogic();
void draw(SDL_Surface *where, int x, int y, int w, int h);
@ -88,5 +93,4 @@ private:
unsigned buf_head;
};
#endif /* __VIRTUAL_KEYBORD_HH__ */

View File

@ -70,3 +70,7 @@ void Widget::pushEvent(SDL_Event *ev)
}
}
void Widget::draw(SDL_Surface *where, int x, int y, int w, int h)
{
}

View File

@ -30,7 +30,7 @@ public:
virtual void runLogic() = 0;
virtual void draw(SDL_Surface *where,
int x, int y, int w, int h) = 0;
int x, int y, int w, int h);
virtual event_t popEvent();