コード例 #1
0
        private static bool GetInheritedValue(this Gtk.Widget visual, string property, out object propertyValue)
        {
            bool gotValue = false;

            propertyValue = null;
            Gtk.Widget window = visual as Gtk.Window;
            Gtk.Widget widget = visual;
            var        root   = window;

            if (root == null)
            {
                if (widget != null)
                {
                    root = widget.Toplevel;
                }
                if (root == null)
                {
                    root = INTV.Shared.Utility.SingleInstanceApplication.Current.MainWindow;
                }
            }
            while ((visual != null) && !gotValue)
            {
                gotValue = visual.TryGetAttachedValue(property, out propertyValue);
                if (!gotValue)
                {
                    if (widget != null)
                    {
                        window = widget.Toplevel as Gtk.Window;
                        widget = widget.Parent;
                        if (widget == null)
                        {
                            visual = window;
                        }
                        if (visual == null)
                        {
                            visual = INTV.Shared.Utility.SingleInstanceApplication.Current.MainWindow;
                        }
                    }
                    else if (window != null)
                    {
                        visual = INTV.Shared.Utility.SingleInstanceApplication.Current.MainWindow;
                        window = null;
                    }
                    else
                    {
                        visual = null;
                    }
                }
            }
            return(gotValue);
        }