Stetic.PluggableWidget.PrepareUpdateWidget C# (CSharp) Method

PrepareUpdateWidget() protected method

protected PrepareUpdateWidget ( ) : void
return void
        protected void PrepareUpdateWidget()
        {
            // This method is called when the child widget is going to be changed.
            // It takes a 'screenshot' of the widget. This image will be shown until
            // UpdateWidget is called.

            if (book.NPages == 1) {
                Gtk.Widget w = book.GetNthPage (0);
                Gdk.Window win = w.GdkWindow;
                if (win != null && win.IsViewable) {
                    Gdk.Pixbuf img = Gdk.Pixbuf.FromDrawable (win, win.Colormap, w.Allocation.X, w.Allocation.Y, 0, 0, w.Allocation.Width, w.Allocation.Height);
                    Gtk.Image oldImage = new Gtk.Image (img);
                    oldImage.Show ();
                    book.AppendPage (oldImage, null);
                    book.Page = 1;
                    book.RemovePage (0);
                }
            }
        }