#pragma once
#include "SignalSlot.h"
#include "Widget.h"
#include "Common.h"
BEGIN_NAMESPACE
enum WindowFlags
{
WF_Normal = 0,
WF_NoTitle = 1
};
class Window : public Widget
{
public:
Window(const char* a_title, bool a_fullscreen = false, WindowFlags a_flags = WF_Normal);
~Window();
// TODO: Some of these seem to be private impl details, not something to be called by client code
// Possibly timer functions belong in widget class
// Definately HWND stuff doesn't belong here
// Everything can move to inside WindowData* m_data
Rectangle worldGeometry() override;
void setWorldGeometry(Rectangle a_rect) override
{
setNewSize(a_rect.m_width, a_rect.m_height);
setPosition(a_rect.m_x, a_rect.m_y);
//setGeometry(0, 0, a_rect.m_width, a_rect.m_height);
}
// TODO: for consistency resize -> sizeUpdate
void reshape();
void resize(int a_newW, int a_newH);
void setNewSize(int a_newW, int a_newH) override;
void setPosition(int a_x, int a_y);
void mouseUpdate(int a_x, int a_y, int a_buttonMask, MouseButtons a_mouseButton, MouseState a_mouseState);
void wheelUpdate(int a_wheelVal);
void keyUpdate(int a_keyCode, bool a_keyDown);
void paintUpdate();
void update(Rectangle& a_rectangle) override;
void sizeOptions(SizeOptions& a_sizeOptions) override;
void timerUpdate(TimerId a_timerId);
TimerId startTimer(int a_milliSeconds) override;
void killTimer(TimerId a_timerId) override;
PixelBuffer& targetBuffer() override;
void deactivate();
typedef struct HWND__ *HWND;
void initialize(HWND a_hwnd); // TODO: this is ugly
void paintGL(HWND a_hwnd);
void destroy(HWND a_hwnd); // TODO: this is ugly
private:
struct WindowData* m_data;
};
END_NAMESPACE