diff options
Diffstat (limited to 'utils/scenemanager/basedialogparams.cpp')
| -rw-r--r-- | utils/scenemanager/basedialogparams.cpp | 65 |
1 files changed, 65 insertions, 0 deletions
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 <mxtk/mx.h> +#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 |