terminal/src/host/utils.hpp
Josh Soref a13ccfd0f5
Fix a bunch of spelling errors across the project (#4295)
Generated by https://github.com/jsoref/spelling `f`; to maintain your repo, please consider `fchurn`

I generally try to ignore upstream bits. I've accidentally included some items from the `deps/` directory. I expect someone will give me a list of items to drop, I'm happy to drop whole files/directories, or to split the PR into multiple items (E.g. comments/locals/public).

Closes #4294
2020-02-10 20:40:01 +00:00

45 lines
1.4 KiB
C++

/*++
Copyright (c) Microsoft Corporation
Licensed under the MIT license.
Module Name:
- utils.hpp
Abstract:
- This module contains utility math functions that help perform calculations elsewhere in the console
Author(s):
- Paul Campbell (PaulCam) 2014
- Michael Niksa (MiNiksa) 2014
--*/
#pragma once
#include "conapi.h"
#include "server.h"
#include "..\server\ObjectHandle.h"
#define RECT_WIDTH(x) ((x)->right - (x)->left)
#define RECT_HEIGHT(x) ((x)->bottom - (x)->top)
short CalcWindowSizeX(const SMALL_RECT& rect) noexcept;
short CalcWindowSizeY(const SMALL_RECT& rect) noexcept;
short CalcCursorYOffsetInPixels(const short sFontSizeY, const ULONG ulSize) noexcept;
WORD ConvertStringToDec(_In_ PCWSTR pwchToConvert, _Out_opt_ PCWSTR* const ppwchEnd) noexcept;
std::wstring _LoadString(const UINT id);
static UINT s_LoadStringEx(_In_ HINSTANCE hModule,
_In_ UINT wID,
_Out_writes_(cchBufferMax) LPWSTR lpBuffer,
_In_ UINT cchBufferMax,
_In_ WORD wLangId);
class Utils
{
public:
static int s_CompareCoords(const COORD bufferSize, const COORD first, const COORD second) noexcept;
static int s_CompareCoords(const COORD coordFirst, const COORD coordSecond) noexcept;
static COORD s_GetOppositeCorner(const SMALL_RECT srRectangle, const COORD coordCorner) noexcept;
};