Ejemplo n.º 1
0
        // Methods
        protected override void OnRealized()
        {
            WidgetFlags |= WidgetFlags.Realized;
            WindowAttr attributes = default(WindowAttr);

            attributes.X          = Allocation.X;
            attributes.Y          = Allocation.Y;
            attributes.Height     = Allocation.Height;
            attributes.Width      = Allocation.Width;
            attributes.WindowType = Gdk.WindowType.Child;
            attributes.Wclass     = WindowClass.InputOutput;
            attributes.Visual     = Visual;
            attributes.TypeHint   = (WindowTypeHint)100;
            attributes.Colormap   = Colormap;
            attributes.EventMask  = (int)(Events | EventMask.ExposureMask | EventMask.Button1MotionMask | EventMask.ButtonPressMask | EventMask.ButtonReleaseMask | EventMask.KeyPressMask | EventMask.KeyReleaseMask);
            WindowAttributesType attributes_mask = WindowAttributesType.X | WindowAttributesType.Y | WindowAttributesType.Colormap | WindowAttributesType.Visual;

            GdkWindow          = new Gdk.Window(ParentWindow, attributes, (int)attributes_mask);
            GdkWindow.UserData = Handle;
            Style = Style.Attach(GdkWindow);
            Style.SetBackground(GdkWindow, State);
            WidgetFlags &= ~WidgetFlags.NoWindow;
            NSView nSView = GtkMacInterop.GetNSView(this);

            nSView.RemoveFromSuperview();
            embedParent.AddSubview(nSView);
            nSView.Frame = new CGRect(0, 0, embedParent.Frame.Width, embedParent.Frame.Height);
        }
Ejemplo n.º 2
0
        protected override void OnRealized()
        {
            base.OnRealized();
            this.nsview             = GtkMacInterop.GetNSView(this);
            containers[this.nsview] = this;

            if (child != null)
            {
                child.AutoresizingMask = NSViewResizingMask.WidthSizable | NSViewResizingMask.HeightSizable;
                child.Frame            = nsview.Bounds;
                nsview.AddSubview(child);
            }
            this.ConnectSubviews(this.nsview);
        }
Ejemplo n.º 3
0
        void WatchForFocus(Gtk.Widget widget)
        {
            widget.FocusInEvent += (o, args) =>
            {
                var view = GtkMacInterop.GetNSView(widget);
                if (view != null)
                {
                    view.Window.MakeFirstResponder(view);
                }
            };

            if (widget is Gtk.Container)
            {
                var c = (Gtk.Container)widget;
                foreach (var w in c.Children)
                {
                    WatchForFocus(w);
                }
            }
        }
Ejemplo n.º 4
0
        void UpdateAllocation()
        {
            if (container.GdkWindow == null || cw.GdkWindow == null)
            {
                return;
            }

            var gw = GtkMacInterop.GetNSView(cw);

            gw.Frame = new CGRect(0, 0, Frame.Width, Frame.Height);
            var rect = GetRelativeAllocation(GtkMacInterop.GetNSView(container), gw);

            var allocation = new Gdk.Rectangle
            {
                X      = (int)rect.Left,
                Y      = (int)rect.Top,
                Width  = (int)rect.Width,
                Height = (int)rect.Height
            };

            cw.SizeAllocate(allocation);
        }