6 #ifndef _INC_WinTypes_H
7 #define _INC_WinTypes_H
12 #include "../GrayLibBase.h"
23 typedef void* HBITMAP;
25 typedef void* HCURSOR;
27 typedef INT_PTR LRESULT;
30 typedef const char* ATOM;
37 #define WINMSGDEF(a,b,c) WM_##a = b,
44 typedef struct tagSIZE
50 typedef struct tagPOINT
56 typedef struct tagPOINTS
62 typedef struct tagRECT
83 #define LF_FACESIZE 32
84 typedef struct tagLOGFONTA
98 BYTE lfPitchAndFamily;
99 CHAR lfFaceName[LF_FACESIZE];
103 struct WINDOWPLACEMENT
117 #ifndef WM_MOUSEWHEEL
118 #define WM_MOUSEWHEEL 0x020A
141 *
static_cast<SIZE*
>(
this) = rsize;
145 return(rsize.cx == this->cx && rsize.cy == this->cy);
149 if (x < 0 || x >= this->cx)
151 if (y < 0 || y >= this->cy)
157 return(cx == 0 && cy == 0);
173 typedef _GTN(LOGFONT) SUPER_t;
182 ref_LogFont() = fontcfg;
186 return *
static_cast<SUPER_t*
>(
this);
190 return *
static_cast<const SUPER_t*
>(
this);
194 cMem::Zero(
static_cast<SUPER_t*
>(
this),
sizeof(SUPER_t));
199 return StrT::CopyLen<GChar_t>(this->lfFaceName, pszFaceName,
_countof(this->lfFaceName));
203 return !::memcmp(
static_cast<const SUPER_t*
>(
this), &rFont,
sizeof(SUPER_t));
208 return this->lfHeight;
214 if (this->lfHeight == 0)
218 return ABS(this->lfHeight);
223 if (this->lfWidth == 0)
227 return ABS(this->lfWidth);
238 typedef ::WINDOWPLACEMENT SUPER_t;
243 cMem::Zero(
static_cast<SUPER_t*
>(
this),
sizeof(SUPER_t));
245 this->ptMinPosition.x = -1;
246 this->ptMinPosition.y = -1;
247 this->ptMaxPosition.x = -1;
248 this->ptMaxPosition.y = -1;
254 UpdatePlacement(hWnd);
256 bool UpdatePlacement(HWND hWnd)
258 return ::GetWindowPlacement(hWnd,
static_cast<SUPER_t*
>(
this));
265 this->length =
sizeof(SUPER_t);
270 return this->length ==
sizeof(SUPER_t);
274 return (SHOWWINDOW_t)(this->showCmd);
278 return (get_ShowWindowwMode() == SW_SHOWMINIMIZED || get_ShowWindowwMode() == SW_SHOWMINNOACTIVE);
284 return this->rcNormalPosition;
288 #if defined(_DEBUG) && defined(_WIN32)
#define GRAYCALL
declare calling convention for static functions so everyone knows the arg passing scheme....
Definition: GrayCore.h:36
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
#define _GTN(c)
_WIN32 name has a A or W for UTF8 or UNICODE (like _FNF)
Definition: StrConst.h:28
#define ABS(n)
Definition: SysTypes.h:460
UINT WINMSG_t
Supplement _WIN32 "windows.h".
Definition: WinTypes.h:111
#define _countof(a)
Definition: cKernel.h:35
Definition: WinTypes.h:168
bool IsSameFont(const SUPER_t &rFont) const noexcept
Definition: WinTypes.h:201
int get_FontSize() const noexcept
Definition: WinTypes.h:205
SUPER_t & ref_LogFont() noexcept
Definition: WinTypes.h:184
const SUPER_t & ref_LogFont() const noexcept
Definition: WinTypes.h:188
cWinFontCfg() noexcept
Definition: WinTypes.h:176
cWinFontCfg(const SUPER_t &fontcfg) noexcept
Definition: WinTypes.h:180
void InitZero() noexcept
Definition: WinTypes.h:192
int get_FontWidthA() const noexcept
Definition: WinTypes.h:220
int get_FontSizeA() const noexcept
Definition: WinTypes.h:210
StrLen_t put_FaceName(const GChar_t *pszFaceName) noexcept
Definition: WinTypes.h:196
Definition: WinTypes.h:128
float get_AspectRatio() const noexcept
Definition: WinTypes.cpp:12
cWinSize(LONG _cx=0, LONG _cy=0) noexcept
Definition: WinTypes.h:134
void SetMaxAspect(int maxx, int maxy)
Definition: WinTypes.cpp:19
cWinSize(const SIZE &rsize) noexcept
Definition: WinTypes.h:139
bool isZero() const noexcept
Definition: WinTypes.h:155
void SetZero() noexcept
Definition: WinTypes.h:159
bool operator==(const SIZE &rsize) const noexcept
Definition: WinTypes.h:143
bool PtInRect(int x, int y) const noexcept
Definition: WinTypes.h:147
Definition: WinTypes.h:232
SHOWWINDOW_t get_ShowWindowwMode() const noexcept
Definition: WinTypes.h:272
void InitPlacement() noexcept
Definition: WinTypes.h:262
const RECT & get_NormalRect() const noexcept
Definition: WinTypes.h:281
bool isShowIconic() const noexcept
Definition: WinTypes.h:276
bool isInitPlacement() const noexcept
Definition: WinTypes.h:267
cWindowPlacement() noexcept
Definition: WinTypes.h:241
int StrLen_t
the length of a string in chars (bytes for UTF8, wchar_t for UNICODE). or offset in characters....
Definition: StrConst.h:32
char GChar_t
My version of TCHAR, _TCHAR.
Definition: StrConst.h:26
static void Zero(void *pData, size_t nSizeBlock) noexcept
Definition: cMem.h:100