2017-01-20 08:36:52 -05:00
|
|
|
#pragma once
|
|
|
|
|
2017-01-19 16:23:59 -05:00
|
|
|
namespace Components
|
|
|
|
{
|
|
|
|
class Window : public Component
|
|
|
|
{
|
|
|
|
public:
|
2022-04-29 10:26:14 -04:00
|
|
|
typedef BOOL(WndProcCallback)(WPARAM wParam, LPARAM lParam);
|
|
|
|
typedef void(CreateCallback)();
|
|
|
|
|
2017-01-19 16:23:59 -05:00
|
|
|
Window();
|
|
|
|
|
|
|
|
static int Width();
|
|
|
|
static int Height();
|
|
|
|
static int Width(HWND window);
|
|
|
|
static int Height(HWND window);
|
|
|
|
static void Dimension(RECT* rect);
|
|
|
|
static void Dimension(HWND window, RECT* rect);
|
|
|
|
|
|
|
|
static bool IsCursorWithin(HWND window);
|
|
|
|
|
2017-02-10 03:50:08 -05:00
|
|
|
static HWND GetWindow();
|
|
|
|
|
2022-04-29 10:26:14 -04:00
|
|
|
static void OnWndMessage(UINT Msg, Utils::Slot<WndProcCallback> callback);
|
|
|
|
|
|
|
|
static void OnCreate(Utils::Slot<CreateCallback> callback);
|
2017-01-19 16:23:59 -05:00
|
|
|
private:
|
|
|
|
static BOOL CursorVisible;
|
|
|
|
static Dvar::Var NoBorder;
|
|
|
|
static Dvar::Var NativeCursor;
|
2022-04-29 10:26:14 -04:00
|
|
|
static std::unordered_map<UINT, Utils::Slot<WndProcCallback>> WndMessageCallbacks;
|
|
|
|
static Utils::Signal<CreateCallback> CreateSignals;
|
2017-01-19 16:23:59 -05:00
|
|
|
|
|
|
|
static HWND MainWindow;
|
|
|
|
|
2017-06-06 16:13:08 -04:00
|
|
|
static void ApplyCursor();
|
|
|
|
|
2017-01-19 16:23:59 -05:00
|
|
|
static int IsNoBorder();
|
|
|
|
|
2017-06-06 16:13:08 -04:00
|
|
|
static BOOL WINAPI MessageHandler(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
|
|
|
|
|
2017-01-19 16:23:59 -05:00
|
|
|
static int WINAPI ShowCursorHook(BOOL show);
|
2022-04-15 08:50:22 -04:00
|
|
|
static void DrawCursorStub(Game::ScreenPlacement* scrPlace, float x, float y, float w, float h, int horzAlign, int vertAlign, const float* color, Game::Material* material);
|
2017-01-19 16:23:59 -05:00
|
|
|
|
|
|
|
static void StyleHookStub();
|
|
|
|
static HWND WINAPI CreateMainWindow(DWORD dwExStyle, LPCSTR lpClassName, LPCSTR lpWindowName, DWORD dwStyle, int X, int Y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam);
|
2022-04-29 10:26:14 -04:00
|
|
|
|
|
|
|
static void EnableDpiAwareness();
|
2017-01-19 16:23:59 -05:00
|
|
|
};
|
|
|
|
}
|