How can I tell if the "Gizmos" button has been checked in the Game view?

I've got some lines that I'm rendering using the GL.* functions (I need to do this because I need the lines that I'm rendering to be depth tested). However, I'd like these lines to respect the "gizmos" option on the game view so I can use that to turn them on/off.

Is there any way to find out whether or not this button is pressed?

Well, here's one way:

bool AreGizmosVisible()
    Assembly asm = Assembly.GetAssembly(typeof(UnityEditor.Editor));
    Type type = asm.GetType("UnityEditor.GameView");
    if (type != null)
        EditorWindow window = EditorWindow.GetWindow(type);
        FieldInfo gizmosField = type.GetField("m_Gizmos", BindingFlags.NonPublic | BindingFlags.Instance);
        if(gizmosField != null)
            return (bool)gizmosField.GetValue(window);
    return false;

Of course, it could break if Unity changes, but it works in 3.1, and shouldn't go horribly wrong if the relevant private field is removed.