protected override void OnRealized()
{
DebugHelper.WriteLine ("OnRealized");
SetFlag (WidgetFlags.Realized);
Gdk.WindowAttr attributes = new WindowAttr();
attributes.WindowType = Gdk.WindowType.Toplevel;
attributes.X = this.Allocation.X;
attributes.Y = this.Allocation.Y;
attributes.Width = this.Allocation.Width;
attributes.Height = this.Allocation.Height;
attributes.Wclass = WindowClass.InputOutput;
attributes.Visual = this.Visual;
attributes.Colormap = this.Colormap;
attributes.EventMask = (int)this.Events;
attributes.EventMask |= (int)(Gdk.EventMask.AllEventsMask);
this.GdkWindow = new Gdk.Window(this.ParentWindow, attributes,
(Gdk.WindowAttributesType.X |
Gdk.WindowAttributesType.Y |
Gdk.WindowAttributesType.Visual |
Gdk.WindowAttributesType.Colormap));
this.GdkWindow.UserData = this.Handle;
this.Style.Attach (this.GdkWindow);
this.Style.SetBackground (this.GdkWindow, StateType.Normal);
ParentWindow.Events = (Gdk.EventMask) (GdkEventMask.StructureNotifyMask | GdkEventMask.SubstructureNotifyMask);
}