3
// GNOME Do is the legal property of its developers. Please refer to the
4
// COPYRIGHT file distributed with this source distribution.
6
// This program is free software; you can redistribute it and/or modify
7
// it under the terms of the GNU General Public License as published by
8
// the Free Software Foundation; either version 2 of the License, or
9
// (at your option) any later version.
11
// This program is distributed in the hope that it will be useful,
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
// GNU General Public License for more details.
16
// You should have received a copy of the GNU General Public License
17
// along with this program; if not, write to the Free Software
18
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29
namespace Do.Interface
33
public class PositionWindow
37
public PositionWindow (Gtk.Window main, Gtk.Window results)
48
disp = w.Screen.Display;
49
disp.GetPointer(out point.X, out point.Y);
50
return w.Screen.GetMonitorAtPoint (point.X, point.Y);
53
public void UpdatePosition (int iconboxWidth, Pane currentPane, Rectangle resultsOffset)
55
UpdatePosition (iconboxWidth, currentPane, resultsOffset, new Gdk.Rectangle ());
58
public void UpdatePosition (int iconboxWidth, Pane currentPane, Rectangle resultsOffset, Rectangle normalOffset) {
59
Gtk.Application.Invoke (delegate {
60
Gdk.Rectangle geo, main, results;
62
w.GetPosition (out main.X, out main.Y);
63
w.GetSize (out main.Width, out main.Height);
65
geo = w.Screen.GetMonitorGeometry (GetMonitor ());
66
main.X = ((geo.Width - main.Width) / 2) + geo.X + normalOffset.X;
67
main.Y = (int)((geo.Height + geo.Y - main.Height) / 2.5) + geo.Y + normalOffset.Y;
68
w.Move (main.X, main.Y);
70
if (r == null) return;
71
//position resultsWindow
72
r.GetSize (out results.Width, out results.Height);
73
results.Y = main.Y + main.Height + resultsOffset.Y;
74
results.X = main.X + iconboxWidth * (int) currentPane + resultsOffset.X;
75
r.Move (results.X, results.Y);