public virtual void Popup() { if (editor.GdkWindow == null) { editor.Realized += HandleRealized; return; } bounds = CalculateInitialBounds(); //GTK uses integer position coords, so round fractions down, we'll add them back later as draw offsets int x = (int)System.Math.Floor(bounds.X); int y = (int)System.Math.Floor(bounds.Y); //capture any lost fractions to pass as an offset to Draw userspaceArea = new Cairo.Rectangle(bounds.X - x, bounds.Y - y, bounds.Width, bounds.Height); //lose half-pixels on the expansion, it's not a big deal xExpandedOffset = (int)(System.Math.Floor(ExpandWidth / 2d)); yExpandedOffset = (int)(System.Math.Floor(ExpandHeight / 2d)); //round the width/height up to make sure we have room for restored fractions int width = System.Math.Max(1, (int)(System.Math.Ceiling(bounds.Width) + ExpandWidth)); int height = System.Math.Max(1, (int)(System.Math.Ceiling(bounds.Height) + ExpandHeight)); this.SetSizeRequest(width, height); editor.TextArea.AddTopLevelWidget(this, x - xExpandedOffset, y - yExpandedOffset); stage.AddOrReset(this, Duration); stage.Play(); Show(); }
public virtual void Popup() { rect = editor.ParentWindow.ScreenBounds; bounds = CalculateInitialBounds(); rect.X = rect.X + bounds.X - (int)(ExpandWidth / 2); rect.Y = rect.Y + bounds.Y - (int)(ExpandHeight / 2); Location = rect.Location; rect.Width = System.Math.Max(1, bounds.Width + (int)ExpandWidth); rect.Height = System.Math.Max(1, bounds.Height + (int)ExpandHeight); Size = rect.Size; stage.AddOrReset(this, Duration); stage.Play(); ListenToEvents(); Show(); }
public virtual void Popup() { editor.GdkWindow.GetOrigin(out x, out y); bounds = CalculateInitialBounds(); x = x + bounds.X - (int)(ExpandWidth / 2); y = y + bounds.Y - (int)(ExpandHeight / 2); Move(x, y); width = bounds.Width + (int)ExpandWidth; height = bounds.Height + (int)ExpandHeight; Resize(width, height); stage.AddOrReset(this, Duration); stage.Play(); ListenToEvents(); Show(); }
public virtual void Popup() { /* * if (editor.GdkWindow == null){ * editor.Realized += HandleRealized; * return; * }*/ //editor.GdkWindow.GetOrigin (out x, out y); bounds = CalculateInitialBounds(); X += bounds.X - (int)(ExpandWidth / 2); Y += bounds.Y - (int)(ExpandHeight / 2); Width = System.Math.Max(1, bounds.Width + (int)ExpandWidth); Height = System.Math.Max(1, bounds.Height + (int)ExpandHeight); stage.AddOrReset(this, Duration); stage.Play(); ListenToEvents(); Show(); }
public virtual void Popup() { if (editor.GdkWindow == null) { editor.Realized += HandleRealized; return; } editor.GdkWindow.GetOrigin(out x, out y); bounds = CalculateInitialBounds(); x = x + bounds.X - (int)(ExpandWidth / 2); y = y + bounds.Y - (int)(ExpandHeight / 2); Move(x, y); width = System.Math.Max(1, bounds.Width + (int)ExpandWidth); height = System.Math.Max(1, bounds.Height + (int)ExpandHeight); Resize(width, height); stage.AddOrReset(this, Duration); stage.Play(); ListenToEvents(); Show(); }