The-Powder-Toy/src/Activity.h

42 lines
656 B
C
Raw Normal View History

2012-08-01 16:29:22 -05:00
#pragma once
#include "interface/Window.h"
class Activity
{
public:
virtual void Exit() {}
virtual void Show() {}
virtual void Hide() {}
virtual ~Activity() {}
};
class WindowActivity: public ui::Window, public Activity
{
public:
WindowActivity(ui::Point position, ui::Point size) :
ui::Window(position, size)
{
Show();
}
virtual void Exit()
{
Hide();
SelfDestruct();
}
virtual void Show()
{
if(ui::Engine::Ref().GetWindow() != this)
{
ui::Engine::Ref().ShowWindow(this);
}
}
virtual void Hide()
{
if(ui::Engine::Ref().GetWindow() == this)
{
ui::Engine::Ref().CloseWindow();
}
}
virtual ~WindowActivity() {}
};