Can I put extra buttons on the title area of a GUILayout window?

I want to put some extra buttons on the 'title' are of a GUILayout.Window (like the 'system buttons' close, minimize, maximize, etc.) Can this be done?

I was able to put a simple button there, and clicking it highlights it like it's being pressed, but I don't get the fact that it was pressed. Is it legal, is there a better way to do it?

windowRect = ClampToScreen(GUILayout.Window (GetInstanceID(), windowRect, DisplayData,, GUILayout.MinWidth(600)));

// this would be a texture with style to look better, but to test, just a text X
if (GUI.Button ( Rect (windowRect.x+5, windowRect.y+5, 45, 45), "X"))
  Debug.Log("I'm clickin close"); // BUT I NEVER GET THIS MESSAGE

Got it. I had this outside my 'draw' routine (DisplayData in my case) because I thought it best to get the final windowRect before placing buttons over it. But I can still do this inside that routine (with the rest of the content), and it works fine.