// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
#pragma once
#include "Window.h"
#include "CriticalSection.h"
///
/// Window objects manager service.
///
class WindowsManager
{
public:
///
/// The window objects collection mutex.
///
static CriticalSection WindowsLocker;
///
/// The window objects collection.
///
static Array Windows;
public:
///
/// Gets the window by native handle.
///
/// The native window handle.
/// Found window or null if cannot find it.
static Window* GetByNativePtr(void* handle);
///
/// Calculates the position for window that has given size and should be placed in the center of the primary screen.
///
/// The size.
/// window location.
static Vector2 CalcCenteredWinPos(const Vector2& size);
public:
// Used by WindowBase
static void Register(Window* win);
static void Unregister(Window* win);
};