Window API refactor

This commit is contained in:
elasota
2020-05-20 17:20:50 -04:00
parent 49c438b088
commit f53dc21475
26 changed files with 137 additions and 127 deletions

View File

@@ -91,13 +91,17 @@ struct Window
{
Window();
DrawSurface *GetDrawSurface() const;
void SetPosition(const PortabilityLayer::Vec2i &pos);
PortabilityLayer::Vec2i GetPosition() const;
// Convenience method to convert a mouse event to local point
Point MouseToLocal(const GpMouseInputEvent &evt) const;
// Convenience method that returns a 16-bit precision X/Y
Point TopLeftCoord() const;
Point GetTopLeftCoord() const;
// Returns the bounds rect of the draw surface (which is always 0,0 based
Rect GetSurfaceRect() const;
bool AddWidget(PortabilityLayer::Widget *widget);
ArrayView<PortabilityLayer::Widget*> GetWidgets() const;
@@ -112,15 +116,9 @@ struct Window
void OnTick();
DrawSurface *GetDrawSurface() const;
DrawSurface *GetChromeSurface(WindowChromeSide_t aChromeSide) const;
DrawSurface m_surface; // Must be the first item until the immediate mode draw API is completely removed
// The port is always at 0,0
// These are the WM coordinates
int32_t m_wmX;
int32_t m_wmY;
protected:
~Window();
@@ -130,6 +128,13 @@ protected:
size_t m_numWidgets;
size_t m_numTickReceivingWidgets;
DrawSurface m_surface;
// The surface is always at 0,0
// These are the WM coordinates
int32_t m_wmX;
int32_t m_wmY;
PortabilityLayer::Widget *m_widgetWithFocus;
};