/// <summary> /// Called when the window is realized (shown). /// </summary> protected override void OnRealized() { WidgetFlags |= WidgetFlags.Realized; var attributes = new WindowAttr(); attributes.WindowType = WindowType.Child; attributes.X = Allocation.X; attributes.Y = Allocation.Y; attributes.Width = Allocation.Width; attributes.Height = Allocation.Height; attributes.Wclass = WindowClass.InputOutput; attributes.Visual = Visual; attributes.Colormap = Colormap; attributes.EventMask = (int)(Events | EventMask.ExposureMask); attributes.Mask = Events | EventMask.ExposureMask; const WindowAttributesType mask = WindowAttributesType.X | WindowAttributesType.Y | WindowAttributesType.Colormap | WindowAttributesType.Visual; GdkWindow = new Window(ParentWindow, attributes, mask); GdkWindow.UserData = Raw; Style = Style.Attach(GdkWindow); WidgetFlags &= ~WidgetFlags.NoWindow; }
// we can't override Initialize () or use the default constructor for this, // because a valid Gdk.Window is required for full Gtk.Style initialization static void InitializeStyle (Gtk.Widget container) { if (style == null && container.GdkWindow != null) { Gtk.CheckButton cb = new BooleanEditor (); // use the BooleanEditor style for the checks cb.GdkWindow = container.GdkWindow; cb.Parent = container; cb.Realize (); style = cb.Style; style.Attach (container.GdkWindow); indicatorSize = (int)cb.StyleGetProperty ("indicator-size"); indicatorSpacing = (int)cb.StyleGetProperty ("indicator-spacing"); style.Detach (); cb.Dispose (); } }
// we can't override Initialize () or use the default constructor for this, // because a valid Gdk.Window is required for full Gtk.Style initialization static void InitializeStyle(Gtk.Widget container) { if (style == null && container.GdkWindow != null) { Gtk.CheckButton cb = new BooleanEditor(); // use the BooleanEditor style for the checks cb.GdkWindow = container.GdkWindow; cb.Parent = container; cb.Realize(); style = cb.Style; style.Attach(container.GdkWindow); indicatorSize = (int)cb.StyleGetProperty("indicator-size"); indicatorSpacing = (int)cb.StyleGetProperty("indicator-spacing"); style.Detach(); cb.Dispose(); } }