Size of the header of the EditorWindow

Hi there,

I just realized, that when I use Screen.height from within an editor window, it gives my not the actual space I have to draw the things inside.

The problem => the header bar is included as well in this calculation for the height!

I measured it to be around 22 pixels, on a Window 7 / Unity Pro setup.
Probably this value differs with other setting?

Is there a constant or something that gives back that value?

To get the draw area of an editor Window, use EditorWindow.position. Don't be fooled by the name. It's a Rect that indicates the draw area.

Edit: Added some example code.

// C# - The OnGUI() function in the EditorWindow.
void OnGUI()
    Rect drawArea = position;  // EditorWindow.position

    // Detecting the mouse inside the window.

    Event evt = Event.current;
    Vector2 mousePos = evt.mousePosition;

    if (drawArea.Contains(mousePos))
        // Mouse is inside the draw area.

        if (evt.type == EventType.MouseDown && evt.button == 0)
            // Clicked...

    // Draw a red rectangle that fills half of the draw area.
    // (From the draw origin.)

    Vector3[] cellVerts = new Vector3[4];

    Vector3 origin = new Vector3(drawArea.x, drawArea.y);

    cellVerts[0] = origin;

    cellVerts[1] = origin;
    cellVerts[1].x += drawArea.width / 2;

    cellVerts[2] = origin;
    cellVerts[2].x += drawArea.width / 2;
    cellVerts[2].y += drawArea.height / 2;

    cellVerts[3] = origin;
    cellVerts[3].y += drawArea.height / 2;

    Handles.DrawSolidRectangleWithOutline(cellVerts, Color.clear,;