Lookup() public static method

public static Lookup ( GLib obj ) : Widget
obj GLib
return Widget
コード例 #1
0
ファイル: Notebook.cs プロジェクト: noah1510/dotdevelop
        protected override void ReplaceChild(Gtk.Widget oldChild, Gtk.Widget newChild)
        {
            int index = tabs.IndexOf(oldChild);

            if (index != -1)
            {
                tabs[index] = newChild;
                Gtk.Widget page = notebook.GetNthPage(index);
                notebook.SetTabLabel(page, newChild);
            }
            else
            {
                Gtk.Widget tab        = notebook.GetTabLabel(oldChild);
                int        current    = notebook.CurrentPage;
                int        oldPageNum = ((Gtk.Notebook.NotebookChild)notebook [oldChild]).Position;
                base.ReplaceChild(oldChild, newChild);
                // Get the widget again because it may have changed (for example, if it is a text view
                // and has the ShowScrollbars option set.
                newChild             = notebook.GetNthPage(oldPageNum);
                notebook.CurrentPage = current;
                notebook.SetTabLabel(newChild, tab);
                Widget ww = Widget.Lookup(tab);
                if (ww != null)
                {
                    ww.RequiresUndoStatusUpdate = true;
                }
            }
        }
コード例 #2
0
ファイル: Button.cs プロジェクト: noah1510/dotdevelop
        internal protected override void GenerateBuildCode(GeneratorContext ctx, CodeExpression var)
        {
            base.GenerateBuildCode(ctx, var);

            string text = button.Label;

            if (!string.IsNullOrEmpty(text))
            {
                CodePropertyReferenceExpression cprop = new CodePropertyReferenceExpression(var, "Label");
                PropertyDescriptor prop = (PropertyDescriptor)this.ClassDescriptor ["Label"];
                bool           trans    = Type != ButtonType.StockItem && prop.IsTranslated(Wrapped);
                CodeExpression val      = ctx.GenerateValue(text, typeof(string), trans);
                ctx.Statements.Add(new CodeAssignStatement(cprop, val));
            }

            if (Type == ButtonType.TextAndIcon)
            {
                var imageWidget = (Gtk.Image)button.Image;
                if (imageWidget != null)
                {
                    Image imageWrapper = (Image)Widget.Lookup(imageWidget);
                    var   imgVar       = ctx.GenerateNewInstanceCode(imageWrapper);
                    var   imgProp      = new CodePropertyReferenceExpression(var, "Image");
                    ctx.Statements.Add(new CodeAssignStatement(imgProp, imgVar));
                }
            }
        }
コード例 #3
0
        protected override void ReplaceChild(Gtk.Widget oldChild, Gtk.Widget newChild)
        {
            Widget ww = Widget.Lookup(oldChild);

            if (ww != null && ww.ShowScrollbars && ParentWrapper != null)
            {
                // The viewport is bound to the child widget. Remove it together with the child
                ParentWrapper.ReplaceChild(Wrapped, newChild, false);
                return;
            }

            if (scrolled.Child is Gtk.Viewport && oldChild != scrolled.Child)
            {
                Gtk.Viewport vp = (Gtk.Viewport)scrolled.Child;
                vp.Remove(oldChild);
                scrolled.Remove(vp);
                vp.Destroy();
            }
            else
            {
                scrolled.Remove(scrolled.Child);
            }

            if (newChild.SetScrollAdjustments(null, null))
            {
                scrolled.Add(newChild);
            }
            else
            {
                AddWithViewport(newChild);
            }

            NotifyChildAdded(scrolled.Child);
        }
コード例 #4
0
        static void ButtonPress(object obj, Gtk.ButtonPressEventArgs args)
        {
            Gtk.Widget widget = (Gtk.Widget)map[args.Event.Window];
            if (widget == null)
            {
                return;
            }

            Widget wrapper = Widget.Lookup(widget);

            args.RetVal = wrapper.HandleClick(args.Event);
        }
コード例 #5
0
ファイル: Fixed.cs プロジェクト: noah1510/dotdevelop
        void FixedDragDrop(object obj, Gtk.DragDropArgs args)
        {
            Gtk.Widget w  = DND.Drop(args.Context, gtkfixed, args.Time);
            Widget     ww = Widget.Lookup(w);

            if (ww != null)
            {
                gtkfixed.Put(w, args.X - DND.DragHotX, args.Y - DND.DragHotY);
                NotifyChildAdded(w);
                args.RetVal = true;
                ww.Select();
            }
        }
コード例 #6
0
ファイル: Fixed.cs プロジェクト: noah1510/dotdevelop
 void DragEnd(object obj, Gtk.DragEndArgs args)
 {
     using (UndoManager.AtomicChange) {
         gtkfixed.DragEnd -= DragEnd;
         if (DND.DragWidget != null)
         {
             DND.DragWidget.Unparent();
             gtkfixed.Put(DND.DragWidget, dragX, dragY);
             NotifyChildAdded(DND.DragWidget);
             Widget ww = Widget.Lookup(DND.DragWidget);
             ww.Select();
         }
     }
 }
コード例 #7
0
        protected override void ReplaceChild(Gtk.Widget oldChild, Gtk.Widget newChild)
        {
            Widget ww = Widget.Lookup(oldChild);

            if (ww != null && ww.ShowScrollbars && (ParentWrapper is ScrolledWindow) && ParentWrapper.ParentWrapper != null)
            {
                // The viewport is bound to the child widget. Remove it together with the child
                ParentWrapper.ParentWrapper.ReplaceChild(ParentWrapper.Wrapped, newChild, false);
            }
            else
            {
                base.ReplaceChild(oldChild, newChild);
            }
        }
コード例 #8
0
ファイル: Button.cs プロジェクト: miaojiang1/monodevelop-1
        void ConstructContents()
        {
            if (button.Child != null)
            {
                button.Remove(button.Child);
            }

            if (useUnderline)
            {
                labelWidget = new Gtk.Label(label);
                labelWidget.MnemonicWidget = button;
            }
            else
            {
                labelWidget = Gtk.Label.New(label);
            }

            Gtk.Image imageWidget  = (Gtk.Image)Registry.NewInstance("Gtk.Image", proj);
            Image     imageWrapper = (Image)Widget.Lookup(imageWidget);

            imageWrapper.Unselectable = true;
            if (type != ButtonType.StockItem)
            {
                imageWrapper.Pixbuf = imageInfo;
            }

            Gtk.HBox box = new Gtk.HBox(false, 2);
            box.PackStart(imageWidget, false, false, 0);
            box.PackEnd(labelWidget, false, false, 0);

            Gtk.Alignment alignment = new Gtk.Alignment(button.Xalign, button.Yalign, 0.0f, 0.0f);
            alignment.Add(box);

            ObjectWrapper buttonWrapper = ObjectWrapper.Lookup(this);
            Widget        wrapper       = (Widget)ObjectWrapper.Create(proj, labelWidget, buttonWrapper);

            wrapper.Unselectable = true;
            wrapper = (Widget)ObjectWrapper.Create(proj, box, buttonWrapper);
            wrapper.Unselectable = true;
            wrapper = (Widget)ObjectWrapper.Create(proj, alignment, buttonWrapper);
            wrapper.Unselectable = true;

            alignment.ShowAll();
            button.Add(alignment);
        }
コード例 #9
0
ファイル: Button.cs プロジェクト: noah1510/dotdevelop
        void UpdateImage()
        {
            if (type != ButtonType.TextAndIcon)
            {
                button.Image = null;
                return;
            }
            var imageWidget = button.Image as Gtk.Image;

            if (imageWidget == null)
            {
                button.Image = imageWidget = (Gtk.Image)Registry.NewInstance("Gtk.Image", proj);
                // force them to display even if hidden by the theme
                button.Image.Show();
            }
            Image imageWrapper = (Image)Widget.Lookup(imageWidget);

            imageWrapper.Unselectable = true;
            imageWrapper.Pixbuf       = imageInfo;
        }
コード例 #10
0
        protected override void ReplaceChild(Gtk.Widget oldChild, Gtk.Widget newChild)
        {
            Widget ww = Widget.Lookup(oldChild);

            if ((oldChild is Placeholder) && (ParentWrapper is ScrolledWindow) && newChild.SetScrollAdjustments(null, null))
            {
                Widget wrapper = Widget.Lookup(newChild);
                wrapper.ShowScrollbars = false;
                ParentWrapper.ReplaceChild(Wrapped, newChild, false);
            }
            else if (ww != null && ww.ShowScrollbars && (ParentWrapper is ScrolledWindow) && ParentWrapper.ParentWrapper != null)
            {
                // The viewport is bound to the child widget. Remove it together with the child
                ParentWrapper.ParentWrapper.ReplaceChild(ParentWrapper.Wrapped, newChild, false);
            }
            else
            {
                base.ReplaceChild(oldChild, newChild);
            }
        }
コード例 #11
0
        protected override void ReplaceChild(Gtk.Widget oldChild, Gtk.Widget newChild)
        {
            int index = tabs.IndexOf(oldChild);

            if (index != -1)
            {
                tabs[index] = newChild;
                Gtk.Widget page = notebook.GetNthPage(index);
                notebook.SetTabLabel(page, newChild);
            }
            else
            {
                Gtk.Widget tab     = notebook.GetTabLabel(oldChild);
                int        current = notebook.CurrentPage;
                base.ReplaceChild(oldChild, newChild);
                notebook.CurrentPage = current;
                notebook.SetTabLabel(newChild, tab);
                Widget ww = Widget.Lookup(tab);
                if (ww != null)
                {
                    ww.RequiresUndoStatusUpdate = true;
                }
            }
        }