2020-02-25 00:44:40 +01:00
|
|
|
#pragma once
|
2020-03-05 11:43:38 +01:00
|
|
|
#include "GraphicsResources.h"
|
|
|
|
|
#include "View.h"
|
2020-02-25 00:44:40 +01:00
|
|
|
namespace Seele {
|
2020-03-02 19:07:49 +01:00
|
|
|
|
|
|
|
|
// A window is divided into 5 sections, using a border layout
|
|
|
|
|
// +--------------TOP------------------+
|
|
|
|
|
// | |
|
|
|
|
|
// L R
|
|
|
|
|
// E I
|
|
|
|
|
// F CENTER G
|
|
|
|
|
// T H
|
|
|
|
|
// | T
|
|
|
|
|
// +-------------BOTTOM----------------+
|
|
|
|
|
// In every section, there can be any number
|
|
|
|
|
// of views, when there are multiple, they stack to tabs
|
2020-03-05 11:43:38 +01:00
|
|
|
class Section
|
2020-02-25 00:44:40 +01:00
|
|
|
{
|
2020-03-05 11:43:38 +01:00
|
|
|
public:
|
|
|
|
|
Section()
|
|
|
|
|
{}
|
|
|
|
|
void resizeArea(Rect area)
|
|
|
|
|
{
|
|
|
|
|
this->area = area;
|
|
|
|
|
}
|
|
|
|
|
void beginFrame()
|
|
|
|
|
{
|
|
|
|
|
views[0]->beginFrame();
|
|
|
|
|
}
|
|
|
|
|
void endFrame()
|
|
|
|
|
{
|
|
|
|
|
views[0]->endFrame();
|
|
|
|
|
}
|
|
|
|
|
void addView(PView view)
|
|
|
|
|
{
|
|
|
|
|
view->applyArea(area);
|
|
|
|
|
views.add(view);
|
|
|
|
|
}
|
|
|
|
|
void clearViews(PView view)
|
|
|
|
|
{
|
|
|
|
|
views.clear();
|
|
|
|
|
}
|
|
|
|
|
void removeView(PView view)
|
|
|
|
|
{
|
|
|
|
|
views.remove(views.find(view));
|
|
|
|
|
}
|
|
|
|
|
private:
|
|
|
|
|
Rect area;
|
|
|
|
|
Array<PView> views;
|
2020-02-25 00:44:40 +01:00
|
|
|
};
|
2020-03-02 19:07:49 +01:00
|
|
|
DECLARE_REF(Section)
|
2020-03-05 11:43:38 +01:00
|
|
|
class Graphics;
|
2020-02-25 00:44:40 +01:00
|
|
|
class Window
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
Window(const WindowCreateInfo& createInfo);
|
|
|
|
|
~Window();
|
2020-03-05 11:43:38 +01:00
|
|
|
void beginFrame();
|
|
|
|
|
void endFrame();
|
2020-02-25 00:44:40 +01:00
|
|
|
private:
|
2020-03-02 19:07:49 +01:00
|
|
|
void* windowHandle;
|
2020-03-05 11:43:38 +01:00
|
|
|
PSection center;
|
2020-02-25 00:44:40 +01:00
|
|
|
uint32 width;
|
|
|
|
|
uint32 height;
|
2020-03-02 19:07:49 +01:00
|
|
|
Graphics* graphics;
|
2020-02-25 00:44:40 +01:00
|
|
|
};
|
2020-03-02 19:07:49 +01:00
|
|
|
DECLARE_REF(Window)
|
2020-02-25 00:44:40 +01:00
|
|
|
}
|