summaryrefslogtreecommitdiff
path: root/utils/hlfaceposer/basedialogparams.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'utils/hlfaceposer/basedialogparams.cpp')
-rw-r--r--utils/hlfaceposer/basedialogparams.cpp65
1 files changed, 65 insertions, 0 deletions
diff --git a/utils/hlfaceposer/basedialogparams.cpp b/utils/hlfaceposer/basedialogparams.cpp
new file mode 100644
index 0000000..dba7bd9
--- /dev/null
+++ b/utils/hlfaceposer/basedialogparams.cpp
@@ -0,0 +1,65 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//=============================================================================//
+
+#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