3 * Copyright (c) 2007-2010 SlimDX Group
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26 #include "OutputDescription.h"
27 #include "../Utilities.h"
29 using namespace System;
35 OutputDescription::OutputDescription( const DXGI_OUTPUT_DESC& native )
37 m_DeviceName = gcnew String( native.DeviceName );
38 m_DesktopCoordinates = Utilities::ConvertRect( native.DesktopCoordinates );
39 m_AttachedToDesktop = native.AttachedToDesktop ? true : false;
40 m_Rotation = static_cast<DisplayModeRotation>( native.Rotation );
41 m_Monitor = IntPtr( native.Monitor );
44 String^ OutputDescription::Name::get()
49 Drawing::Rectangle OutputDescription::DesktopBounds::get()
51 return m_DesktopCoordinates;
54 bool OutputDescription::IsAttachedToDesktop::get()
56 return m_AttachedToDesktop;
59 DisplayModeRotation OutputDescription::Rotation::get()
64 IntPtr OutputDescription::MonitorHandle::get()
69 bool OutputDescription::operator == ( OutputDescription left, OutputDescription right )
71 return OutputDescription::Equals( left, right );
74 bool OutputDescription::operator != ( OutputDescription left, OutputDescription right )
76 return !OutputDescription::Equals( left, right );
79 int OutputDescription::GetHashCode()
81 return m_DeviceName->GetHashCode() + m_DesktopCoordinates.GetHashCode() + m_AttachedToDesktop.GetHashCode()
82 + m_Rotation.GetHashCode() + m_Monitor.GetHashCode();
85 bool OutputDescription::Equals( Object^ value )
87 if( value == nullptr )
90 if( value->GetType() != GetType() )
93 return Equals( safe_cast<OutputDescription>( value ) );
96 bool OutputDescription::Equals( OutputDescription value )
98 return ( m_DeviceName == value.m_DeviceName && m_DesktopCoordinates == value.m_DesktopCoordinates && m_AttachedToDesktop == value.m_AttachedToDesktop
99 && m_Rotation == value.m_Rotation && m_Monitor == value.m_Monitor );
102 bool OutputDescription::Equals( OutputDescription% value1, OutputDescription% value2 )
104 return ( value1.m_DeviceName == value2.m_DeviceName && value1.m_DesktopCoordinates == value2.m_DesktopCoordinates && value1.m_AttachedToDesktop == value2.m_AttachedToDesktop
105 && value1.m_Rotation == value2.m_Rotation && value1.m_Monitor == value2.m_Monitor );