mirror of
https://github.com/Oibaf66/frodo-wii.git
synced 2024-11-22 11:29:24 +01:00
Forgot these
This commit is contained in:
parent
292d107d72
commit
5f11ca70fa
22
gui_view.hh
Normal file
22
gui_view.hh
Normal file
@ -0,0 +1,22 @@
|
||||
#ifndef __GUI_VIEW_HH__
|
||||
#define __GUI_VIEW_HH__
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
#include "widget.hh"
|
||||
|
||||
class GuiView : public Widget
|
||||
{
|
||||
public:
|
||||
GuiView();
|
||||
|
||||
virtual void updateTheme();
|
||||
|
||||
virtual void viewPushCallback();
|
||||
|
||||
virtual void viewPopCallback();
|
||||
|
||||
virtual void draw(SDL_Surface *where) = 0;
|
||||
};
|
||||
|
||||
#endif /* __GUI_VIEW_HH__ */
|
38
listener.cpp
Normal file
38
listener.cpp
Normal file
@ -0,0 +1,38 @@
|
||||
#include "listener.hh"
|
||||
#include "utils.hh"
|
||||
|
||||
ListenerManager::ListenerManager()
|
||||
{
|
||||
printf("Flushing listeners\n");
|
||||
this->flushListeners();
|
||||
}
|
||||
|
||||
void ListenerManager::registerListener(Listener *kl)
|
||||
{
|
||||
int n_listeners = sizeof(this->listeners) / sizeof(*this->listeners);
|
||||
int i;
|
||||
|
||||
/* Don't register already registered listeners */
|
||||
for (i = 0; i < n_listeners; i++)
|
||||
if (this->listeners[i] == kl)
|
||||
return;
|
||||
/* Find a free spot */
|
||||
for (i = 0; i < n_listeners; i++)
|
||||
if (!this->listeners[i])
|
||||
break;
|
||||
|
||||
panic_if(i == n_listeners,
|
||||
"No free listeners!\n");
|
||||
this->listeners[i] = kl;
|
||||
}
|
||||
|
||||
void ListenerManager::unregisterListener(Listener *kl)
|
||||
{
|
||||
int n_listeners = sizeof(this->listeners) / sizeof(*this->listeners);
|
||||
|
||||
for (int i = 0; i < n_listeners; i++)
|
||||
{
|
||||
if (this->listeners[i] == kl)
|
||||
this->listeners[i] = NULL;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user