Exemplo n.º 1
0
 protected override void OnRealized()
 {
     base.OnRealized();
     nsview = GtkMacInterop.GetNSView(this);
     containers [nsview] = this;
     ConnectSubviews(nsview);
 }
Exemplo n.º 2
0
        void WatchForFocus(Widget widget)
        {
            widget.FocusInEvent += (o, args) => {
                var view = GtkMacInterop.GetNSView(widget);
                if (view != null)
                {
                    view.Window.MakeFirstResponder(view);
                }
            };

            if (widget is Container)
            {
                Container c = (Container)widget;
                foreach (Widget w in c.Children)
                {
                    WatchForFocus(w);
                }
            }
        }
Exemplo n.º 3
0
        protected override void OnRealized()
        {
            WidgetFlags |= WidgetFlags.Realized;

            Gdk.WindowAttr attributes = new Gdk.WindowAttr();
            attributes.X          = Allocation.X;
            attributes.Y          = Allocation.Y;
            attributes.Height     = Allocation.Height;
            attributes.Width      = Allocation.Width;
            attributes.WindowType = Gdk.WindowType.Child;
            attributes.Wclass     = Gdk.WindowClass.InputOutput;
            attributes.Visual     = Visual;
            attributes.TypeHint   = (Gdk.WindowTypeHint) 100;          // Custom value which means the this gdk window has to use a native window
            attributes.Colormap   = Colormap;
            attributes.EventMask  = (int)(Events |
                                          Gdk.EventMask.ExposureMask |
                                          Gdk.EventMask.Button1MotionMask |
                                          Gdk.EventMask.ButtonPressMask |
                                          Gdk.EventMask.ButtonReleaseMask |
                                          Gdk.EventMask.KeyPressMask |
                                          Gdk.EventMask.KeyReleaseMask);

            Gdk.WindowAttributesType attributes_mask =
                Gdk.WindowAttributesType.X |
                Gdk.WindowAttributesType.Y |
                Gdk.WindowAttributesType.Colormap |
                Gdk.WindowAttributesType.Visual;
            GdkWindow          = new Gdk.Window(ParentWindow, attributes, (int)attributes_mask);
            GdkWindow.UserData = Handle;

            Style = Style.Attach(GdkWindow);
            Style.SetBackground(GdkWindow, State);
            this.WidgetFlags &= ~WidgetFlags.NoWindow;

            // Remove the gdk window from the original location and move it to the GtkEmbed view that contains it
            var gw = GtkMacInterop.GetNSView(this);

            gw.RemoveFromSuperview();
            embedParent.AddSubview(gw);
            gw.Frame = new CoreGraphics.CGRect(0, 0, embedParent.Frame.Width, embedParent.Frame.Height);
        }
Exemplo 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);
        }