Browse Source

Fixing popup placement

pull/68/head
Nelson Carrillo 11 years ago
parent
commit
6ea6afe81d
  1. 8
      Gtk/Perspex.Gtk/PopupImpl.cs
  2. 9
      Gtk/Perspex.Gtk/WindowImpl.cs
  3. 4
      Perspex.Controls/ToolTip.cs

8
Gtk/Perspex.Gtk/PopupImpl.cs

@ -14,13 +14,9 @@ namespace Perspex.Gtk
{
public PopupImpl()
: base(WindowType.Popup)
{
this.DefaultSize = new Gdk.Size(640, 480);
this.Events = Gdk.EventMask.PointerMotionMask |
Gdk.EventMask.ButtonPressMask |
Gdk.EventMask.ButtonReleaseMask;
{
}
public void SetPosition(Point p)
{
this.Move((int)p.X, (int)p.Y);

9
Gtk/Perspex.Gtk/WindowImpl.cs

@ -35,13 +35,12 @@ namespace Perspex.Gtk
public WindowImpl(Gtk.WindowType type)
: base(type)
{
this.DefaultSize = new Gdk.Size(640, 480);
this.Events = Gdk.EventMask.PointerMotionMask |
Gdk.EventMask.ButtonPressMask |
Gdk.EventMask.ButtonReleaseMask;
this.windowHandle = new PlatformHandle(this.Handle, "GtkWindow");
}
public Size ClientSize
{
get;
@ -79,8 +78,10 @@ namespace Perspex.Gtk
public Point PointToScreen(Point point)
{
// TODO: Implement.
return new Point();
int x, y;
this.GdkWindow.GetDeskrelativeOrigin(out x, out y);
return new Point(point.X + x, point.Y + y);
}
public void SetOwner(TopLevel owner)

4
Perspex.Controls/ToolTip.cs

@ -116,8 +116,8 @@ namespace Perspex.Controls
((ISetLogicalParent)popup).SetParent(control);
}
var cp = MouseDevice.Instance.GetPosition(control);
var position = control.PointToScreen(cp) + new Vector(0, 22);
var cp = MouseDevice.Instance?.GetPosition(control);
var position = control.PointToScreen(cp.HasValue ? cp.Value : new Point(0, 0)) + new Vector(0, 22);
((ToolTip)popup.Content).Content = GetTip(control);
popup.SetPosition(position);

Loading…
Cancel
Save