forked from MonoGame/MonoGame
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Styles.Windows.cs
executable file
·46 lines (39 loc) · 1.5 KB
/
Styles.Windows.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// MonoGame - Copyright (C) The MonoGame Team
// This file is subject to the terms and conditions defined in
// file 'LICENSE.txt', which is part of this source code package.
using Eto;
using Eto.Wpf.Forms;
using Eto.Wpf.Forms.Menu;
using Eto.Wpf.Forms.ToolBar;
namespace MonoGame.Tools.Pipeline
{
public static class Styles
{
public static void Load()
{
Style.Add<MenuBarHandler>("MenuBar", h =>
{
h.Control.Background = System.Windows.SystemColors.ControlLightLightBrush;
});
Style.Add<ToolBarHandler>("ToolBar", h =>
{
h.Control.Background = System.Windows.SystemColors.ControlLightLightBrush;
h.Control.Loaded += delegate
{
var overflowGrid = h.Control.Template.FindName("OverflowGrid", h.Control) as System.Windows.FrameworkElement;
if (overflowGrid != null)
overflowGrid.Visibility = System.Windows.Visibility.Collapsed;
foreach(var item in h.Control.Items)
{
var i = item as System.Windows.Controls.Button;
if (i != null)
{
i.Opacity = i.IsEnabled ? 1.0 : 0.2;
i.IsEnabledChanged += (sender, e) => i.Opacity = i.IsEnabled ? 1.0 : 0.2;
}
}
};
});
}
}
}