//for this method to work, the widget(w)'s preffered size must be set
        public static void parentOffset(out int offX, out int offY, Widget w)
        {
            try {
                int w1, h1, w2, h2;
                w.GetSizeRequest (out w1, out h1);
                w.Parent.GdkWindow.GetSize (out w2, out h2);

                //halve the results as the container is centered
                offX = (w2 - w1) /2;	offY = (h2 - h1) /2;
            }
            catch (NullReferenceException e) {
                Console.WriteLine ("Parent offset:" + e.Message);
                offX = offY = 0;
            }
        }