development/Common/Utility/source/Win32/ProcHandler.cpp
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
// these are helper functions to create default appearances for various types
these are helper functions to create default appearances for various types
these are helper functions to create default appearances for various types
yaget::app::WindowAppearance MakeWindowDefault(HWND hWnd, int resX, int resY, int monitorIndex)
    {
        using namespace yaget;
        const app::SysDisplays sysDisplays;
        resX = resX <= 0 ? SafeResolutionX : resX;
        resY = resY <= 0 ? SafeResolutionY : resY;
        monitorIndex = monitorIndex == 0 ? sysDisplays.FindPrimary().mIndex : monitorIndex;
        app::WindowAppearance appearance{ app::Appearance::Window, resX, resY, monitorIndex };
        const auto& monitor = sysDisplays.Find(appearance.mMonitorIndex);
        const auto& frameSize = CalculateWindowFrame(hWnd, appearance.mResX, appearance.mResY);
        appearance.mLeft = (monitor.WorkWidth()/2) - (std::get<0>(frameSize)/2);
        appearance.mTop = (monitor.WorkHeight()/2) - (std::get<1>(frameSize)/2);
        appearance.mRight = appearance.mLeft + std::get<0>(frameSize);
        appearance.mBottom = appearance.mTop + std::get<1>(frameSize);
        return appearance;
    }
yaget :: app :: WindowAppearance MakeWindowDefault ( HWND hWnd , int resX , int resY , int monitorIndex ) { using namespace yaget ; const app :: SysDisplays sysDisplays ; resX = resX <= 0 ? SafeResolutionX : resX ; resY = resY <= 0 ? SafeResolutionY : resY ; monitorIndex = monitorIndex == 0 ? sysDisplays . FindPrimary ( ) . mIndex : monitorIndex ; app :: WindowAppearance appearance { app :: Appearance :: Window , resX , resY , monitorIndex } ; const auto & monitor = sysDisplays . Find ( appearance . mMonitorIndex ) ; const auto & frameSize = CalculateWindowFrame ( hWnd , appearance . mResX , appearance . mResY ) ; appearance . mLeft = ( monitor . WorkWidth ( ) / 2 ) - ( std :: get < 0 > ( frameSize ) / 2 ) ; appearance . mTop = ( monitor . WorkHeight ( ) / 2 ) - ( std :: get < 1 > ( frameSize ) / 2 ) ; appearance . mRight = appearance . mLeft + std :: get < 0 > ( frameSize ) ; appearance . mBottom = appearance . mTop + std :: get < 1 > ( frameSize ) ; return appearance ; }
these are helper functions to create default appearances for various types
these are helper functions to create default appearances for various types