[ElmSharp] Fix SetNextFocusObject issue (#401)
[platform/core/csapi/tizenfx.git] / external / src / OpenTK / OpenTK / Platform / DisplayDeviceBase.cs
1 //
2 // The Open Toolkit Library License
3 //
4 // Copyright (c) 2006 - 2010 the Open Toolkit library.
5 //
6 // Permission is hereby granted, free of charge, to any person obtaining a copy
7 // of this software and associated documentation files (the "Software"), to deal
8 // in the Software without restriction, including without limitation the rights to
9 // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
10 // the Software, and to permit persons to whom the Software is furnished to do
11 // so, subject to the following conditions:
12 //
13 // The above copyright notice and this permission notice shall be included in all
14 // copies or substantial portions of the Software.
15 //
16 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 // OTHER DEALINGS IN THE SOFTWARE.
24 //
25
26 using System.Collections.Generic;
27
28 namespace OpenTK.Platform
29 {
30     internal abstract class DisplayDeviceBase : IDisplayDeviceDriver
31     {
32         protected readonly List<DisplayDevice> AvailableDevices = new List<DisplayDevice>();
33         protected DisplayDevice Primary;
34
35         public abstract bool TryChangeResolution(DisplayDevice device, DisplayResolution resolution);
36         public abstract bool TryRestoreResolution(DisplayDevice device);
37
38         // Gets the DisplayDevice that corresponds to the specified index.
39         public virtual DisplayDevice GetDisplay(DisplayIndex index)
40         {
41             if (index == DisplayIndex.Primary)
42             {
43                 return Primary;
44             }
45             else if ((int)index >= 0 && (int)index < AvailableDevices.Count)
46             {
47                 return AvailableDevices[(int)index];
48             }
49             else
50             {
51                 return null;
52             }
53         }
54     }
55 }