-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathGLContextMenu.cs
More file actions
37 lines (33 loc) · 864 Bytes
/
GLContextMenu.cs
File metadata and controls
37 lines (33 loc) · 864 Bytes
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
using System;
using System.Drawing;
using System.Linq;
namespace GLGUI
{
public class GLContextMenu : GLFlowLayout
{
public GLContextMenu(GLGui gui) : base(gui)
{
FlowDirection = GLFlowDirection.TopDown;
AutoSize = true;
Skin = Gui.Skin.ContextMenu;
}
protected override void UpdateLayout()
{
if (Controls.Count() > 0)
{
int maxWidth = 0;
foreach (var entry in Controls)
{
entry.AutoSize = true;
maxWidth = Math.Max(maxWidth, entry.Width);
}
foreach (var entry in Controls)
{
entry.AutoSize = false;
entry.Size = new Size(maxWidth, entry.Height);
}
}
base.UpdateLayout();
}
}
}