Пример #1
0
        public void Show(Widget reference)
        {
            Gdk.Window    parentWindow = reference.ParentWindow;
            Xwt.Rectangle rectangle1   = new Xwt.Rectangle(this.ConvertToScreenCoordinates(reference, new Xwt.Point(0.0, 0.0)), new Xwt.Size((double)reference.Allocation.Width, (double)reference.Allocation.Height));
            Xwt.Rectangle rectangle2   = new Xwt.Rectangle(Xwt.Point.Zero, rectangle1.Size);
            rectangle2 = rectangle2.Offset(rectangle1.Location);
            Xwt.Point position = rectangle2.Location;
            this.ShowAll();
            int width;
            int height;

            this.GetSize(out width, out height);
            this.Move((int)(position.X + this.margin.Left), (int)(position.Y + this.margin.Top));
            this.SizeAllocated += (SizeAllocatedHandler)((o, args) => this.Move((int)position.X, (int)position.Y));
        }
Пример #2
0
		public Rectangle ToScreenBounds (Window w, Rectangle r)
		{
			r = AdjustedRect (r);
			var wb = w.ScreenBounds;
			return r.Offset (wb.Location);
		}
Пример #3
0
        protected override void OnDraw(Context ctx, Rectangle dirtyRect)
        {
            base.OnDraw (ctx, dirtyRect);

            if (!pset) {
                ParentWindow.BoundsChanged += delegate {
                    QueueDraw ();
                };
                pset = true;
            }

            ctx.Rectangle (Bounds);
            ctx.SetColor (Colors.LightGray);
            ctx.Fill ();

            var size = Size;
            size.Width--;
            size.Height--;
            var fx = size.Width / Desktop.Bounds.Width;

            if (Desktop.Bounds.Height * fx > size.Height)
                fx = size.Height / Desktop.Bounds.Height;

            if (Desktop.Bounds.X < 0)
                ctx.Translate (-Desktop.Bounds.X * fx, 0);
            if (Desktop.Bounds.Y < 0)
                ctx.Translate (0, -Desktop.Bounds.Y * fx);

            ctx.SetLineWidth (1);
            foreach (var s in Desktop.Screens) {
                if (s.Bounds != s.VisibleBounds) {
                    var vr = new Rectangle ((int)(s.Bounds.X * fx), (int)(s.Bounds.Y * fx), (int)(s.Bounds.Width * fx), (int)(s.Bounds.Height * fx));
                    vr = vr.Offset (0.5, 0.5);
                    ctx.Rectangle (vr);
                    ctx.SetColor (Colors.White);
                    ctx.FillPreserve ();
                    ctx.SetColor (Colors.Black);
                    ctx.Stroke ();
                }
                var r = new Rectangle ((int)(s.VisibleBounds.X * fx), (int)(s.VisibleBounds.Y * fx), (int)(s.VisibleBounds.Width * fx), (int)(s.VisibleBounds.Height * fx));
                r = r.Offset (0.5, 0.5);
                ctx.Rectangle (r);
                ctx.SetColor (new Color (0.4, 0.62, 0.83));
                ctx.FillPreserve ();
                ctx.SetColor (Colors.Black);
                ctx.Stroke ();

                TextLayout tl = new TextLayout (ctx);
                tl.Text = s.DeviceName;
                tl.Font = Font;
                ctx.DrawTextLayout (tl, r.Center.X - tl.Width / 2, r.Center.Y - tl.Height / 2);
            }

            var wr = ParentWindow.ScreenBounds;
            wr = new Rectangle ((int)(wr.X * fx), (int)(wr.Y * fx), (int)(wr.Width * fx), (int)(wr.Height * fx));
            ctx.Rectangle (wr);
            ctx.SetColor (Colors.Azure.WithAlpha (0.5));
            ctx.FillPreserve ();
            ctx.SetColor (Colors.Azure);
            ctx.Stroke ();
        }