ThemeFactory.cs
1 /*=============================================================================
2 *
3 * (C) Copyright 2011, Michael Carlisle (mike.carlisle@thecodeking.co.uk)
4 *
5 * http://www.TheCodeKing.co.uk
6 *
7 * All rights reserved.
8 * The code and information is provided "as-is" without waranty of any kind,
9 * either expresed or implied.
10 *
11 *-----------------------------------------------------------------------------
12 * History:
13 * 01/09/2007 Michael Carlisle Version 1.0
14 *=============================================================================
15 */
16 using System.Windows.Forms;
18 
19 namespace sage.ew.formul.ButtonTittle.Themes
20 {
21  internal class ThemeFactory
22  {
23  private readonly Form form;
24 
25  public ThemeFactory(Form form)
26  {
27  this.form = form;
28  }
29 
30  public ITheme GetTheme()
31  {
32  if (Win32.osversion.Major == 10)
33  {
34  // Windows 10
35  return new Aero10(form);
36  }
37  else if (Win32.osversion.Major > 6 || (Win32.osversion.Major == 6 && Win32.osversion.Minor > 1))
38  {
39  // Windows 8
40  return new Aero8(form);
41  }
42  else if (Win32.DwmIsCompositionEnabled)
43  {
44  // Vista
45  return new Aero(form);
46  }
47  else if (Application.RenderWithVisualStyles && Win32.version > 6)
48  {
49  // Vista basic
50  return new Styled(form);
51  }
52  else if (Application.RenderWithVisualStyles)
53  {
54  // XP
55  return new XPStyle(form);
56  }
57  else
58  {
59  return new Standard(form);
60  }
61  }
62  }
63 }