From 3bf9df6b2785fa6d951086978a3e66f49427166a Mon Sep 17 00:00:00 2001 From: FluorescentCIAAfricanAmerican <0934gj3049fk@protonmail.com> Date: Wed, 22 Apr 2020 12:56:21 -0400 Subject: 1 --- utils/scenemanager/basedialogparams.cpp | 65 +++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 utils/scenemanager/basedialogparams.cpp (limited to 'utils/scenemanager/basedialogparams.cpp') diff --git a/utils/scenemanager/basedialogparams.cpp b/utils/scenemanager/basedialogparams.cpp new file mode 100644 index 0000000..4287981 --- /dev/null +++ b/utils/scenemanager/basedialogparams.cpp @@ -0,0 +1,65 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +//=============================================================================// +#include "cbase.h" +#include +#include "tier0/dbg.h" +#include "basedialogparams.h" + +//----------------------------------------------------------------------------- +// Purpose: +// Input : self - +//----------------------------------------------------------------------------- +void CBaseDialogParams::PositionSelf( void *self ) +{ + RECT rcDlg; + HWND dlgWindow = (HWND)self; + GetWindowRect( dlgWindow, &rcDlg ); + + // Get relative to primary monitor instead of actual window parent + RECT rcParent; + rcParent.left = 0; + rcParent.right = rcParent.left + GetSystemMetrics( SM_CXFULLSCREEN ); + rcParent.top = 0; + rcParent.bottom = rcParent.top + GetSystemMetrics( SM_CYFULLSCREEN ); + + int dialogw, dialogh; + int parentw, parenth; + + parentw = rcParent.right - rcParent.left; + parenth = rcParent.bottom - rcParent.top; + dialogw = rcDlg.right - rcDlg.left; + dialogh = rcDlg.bottom - rcDlg.top; + + int dlgleft, dlgtop; + dlgleft = ( parentw - dialogw ) / 2; + dlgtop = ( parenth - dialogh ) / 2; + + if ( m_bPositionDialog ) + { + int top = m_nTop - dialogh - 5; + int left = m_nLeft; + + MoveWindow( dlgWindow, + left, + top, + dialogw, + dialogh, + TRUE ); + } + else + { + + MoveWindow( dlgWindow, + dlgleft, + dlgtop, + dialogw, + dialogh, + TRUE + ); + } + +} \ No newline at end of file -- cgit v1.2.3