Пример #1
0
 public static void ChangeContainerFont(Gtk.Container container, string fontDesc)
 {
     ChangeWidgetFont(container, fontDesc);
     foreach (Gtk.Widget subw in container.Children)
     {
         ChangeWidgetFont(subw, fontDesc);
         if (subw is Gtk.MenuItem menuItem)
         {
             var subMenu = menuItem.Submenu;
             ChangeContainerFont(menuItem, fontDesc);
             if (subMenu is Gtk.Container subContainer)
             {
                 ChangeContainerFont(subContainer, fontDesc);
             }
             else
             {
                 if (subMenu != null)
                 {
                     ChangeWidgetFont(subMenu, fontDesc);
                 }
             }
         }
         else
         if (subw is Gtk.Container subContainer)
         {
             ChangeContainerFont(subContainer, fontDesc);
         }
     }
 }
 internal void Put(Gtk.Widget child, Gtk.Container container)
 {
     this.child     = child;
     this.container = container;
     fixd.Put(child, selectionBorder + padding, selectionBorder + padding);
     child.SizeRequested += new SizeRequestedHandler(OnSizeReq);
 }
Пример #3
0
		protected override void BuildContent (Container parent)
		{
			LogoImage = Xwt.Drawing.Image.FromResource ("WelcomePage_Logo.png");
			TopBorderImage = Xwt.Drawing.Image.FromResource ("WelcomePage_TopBorderRepeat.png");

			var mainAlignment = new Gtk.Alignment (0.5f, 0.5f, 0f, 1f);

			var mainCol = new WelcomePageColumn ();
			mainAlignment.Add (mainCol);

			var row1 = new WelcomePageRow ();
			row1.PackStart (new WelcomePageButtonBar (
				new WelcomePageBarButton ("MonoDevelop.com", "http://www.monodevelop.com", "link-cloud.png"),
				new WelcomePageBarButton (GettextCatalog.GetString ("Documentation"), "http://www.go-mono.com/docs", "link-info.png"),
				new WelcomePageBarButton (GettextCatalog.GetString ("Support"), "http://monodevelop.com/index.php?title=Help_%26_Contact", "link-heart.png"),
				new WelcomePageBarButton (GettextCatalog.GetString ("Q&A"), "http://stackoverflow.com/questions/tagged/monodevelop", "link-chat.png")
				)
			);
			mainCol.PackStart (row1, false, false, 0);

			var row2 = new WelcomePageRow (
				new WelcomePageColumn (
				new WelcomePageRecentProjectsList (GettextCatalog.GetString ("Solutions"))
				),
				new WelcomePageColumn (
					new WelcomePageNewsFeed (GettextCatalog.GetString ("Xamarin News"), "http://software.xamarin.com/Service/News", "NewsLinks")
				),
				new WelcomePageColumn (
					new WelcomePageTipOfTheDaySection ()
				)
			);
			mainCol.PackStart (row2, false, false, 0);

			parent.Add (mainAlignment);
		}
Пример #4
0
 public static void SetChildBackgroundColor(this Gtk.Container container, Xwt.Drawing.Color color)
 {
     foreach (var widget in container.Children)
     {
         widget.SetBackgroundColor(Gtk.StateFlags.Normal, color);
     }
 }
Пример #5
0
 internal void AutoHide(DockItem item, AutoHideBox widget, bool animate)
 {
     if (animate)
     {
         widget.Hidden += delegate
         {
             if (!widget.Disposed)
             {
                 AutoHide(item, widget, false);
             }
         };
         widget.AnimateHide();
     }
     else
     {
         // The widget may already be removed from the parent
         // so 'parent' can be null
         Gtk.Container parent = (Gtk.Container)item.Widget.Parent;
         if (parent != null)
         {
             //removing the widget from its parent causes it to unrealize without unmapping
             //so make sure it's unmapped
             if (item.Widget.IsMapped)
             {
                 item.Widget.Unmap();
             }
             parent.Remove(item.Widget);
         }
         RemoveTopLevel(widget);
         widget.Disposed = true;
         widget.Destroy();
     }
 }
Пример #6
0
		public override List<AppResult> NextSiblings ()
		{
			Widget parent = resultWidget.Parent;
			Gtk.Container container = parent as Gtk.Container;

			// This really shouldn't happen
			if (container == null) {
				return null;
			}

			bool foundSelf = false;
			List<AppResult> siblingResults = new List<AppResult> ();
			foreach (Widget child in container.Children) {
				if (child == resultWidget) {
					foundSelf = true;
					continue;
				}

				if (!foundSelf) {
					continue;
				}

				siblingResults.Add (new GtkWidgetResult (child) { SourceQuery = this.SourceQuery });
			}

			return siblingResults;
		}
Пример #7
0
        public static void DumpWidgetsHierarchy(this Gtk.Widget w, string prefix = "")
        {
            if (prefix == "")
            {
                prefix = "this";
            }
            string s = prefix + " = " + w.Name;

            if (w is Gtk.Label)
            {
                s += "(\"" + (w as Gtk.Label).LabelProp + "\")";
            }
            else if (w is Gtk.Button)
            {
                s += "(\"" + (w as Gtk.Button).Label + "\")";
            }
            Debug.Print(s);
            Gtk.Container c = (w as Gtk.Container);
            if (c != null)
            {
                int i = 0;
                foreach (Gtk.Widget w2 in c)
                {
                    w2.DumpWidgetsHierarchy(prefix + "[" + i + "]");
                    i++;
                }
            }
        }
Пример #8
0
        AppResult GenerateChildrenForContainer(Gtk.Container container, List <AppResult> resultSet)
        {
            AppResult firstChild = null, lastChild = null;

            foreach (var child in container.Children)
            {
                AppResult node = new GtkWidgetResult(child)
                {
                    SourceQuery = ToString()
                };
                resultSet.Add(node);

                // FIXME: Do we need to recreate the tree structure of the AppResults?
                if (firstChild == null)
                {
                    firstChild = node;
                    lastChild  = node;
                }
                else
                {
                    lastChild.NextSibling = node;
                    node.PreviousSibling  = lastChild;
                    lastChild             = node;
                }

                if (child is Gtk.Container)
                {
                    AppResult children = GenerateChildrenForContainer((Gtk.Container)child, resultSet);
                    node.FirstChild = children;
                }
            }

            return(firstChild);
        }
Пример #9
0
        public override List <AppResult> NextSiblings()
        {
            return((List <AppResult>)AutoTestService.CurrentSession.UnsafeSync(() => {
                Widget parent = resultWidget.Parent;
                Gtk.Container container = parent as Gtk.Container;

                // This really shouldn't happen
                if (container == null)
                {
                    return null;
                }

                bool foundSelf = false;
                List <AppResult> siblingResults = new List <AppResult> ();
                foreach (Widget child in container.Children)
                {
                    if (child == resultWidget)
                    {
                        foundSelf = true;
                        continue;
                    }

                    if (!foundSelf)
                    {
                        continue;
                    }

                    siblingResults.Add(new GtkWidgetResult(child));
                }

                return siblingResults;
            }));
        }
Пример #10
0
        public void eachItems(Gtk.Container container)
        {
            foreach (Gtk.Widget item in container.AllChildren)
            {
                if (item is Gtk.Container)
                {
                    eachItems(item as Gtk.Container);
                }

                if (item is Gtk.Label)
                {
                    Gtk.Label lbl = item as Gtk.Label;
                    if (lbl.Text.Equals("[") || lbl.Text.Equals("]"))
                    {
                        lbl.LabelProp = markup.make(string.Format("{0}", lbl.Text), "black", null, "22000", "bold");
                    }
                    else
                    {
                        lbl.LabelProp = markup.make(string.Format("{0}", lbl.Text), "black", null, "20000", "normal");
                    }
                    lbl.UseMarkup = true;
                }
                else if (item is Gtk.Image)
                {
                    if (item.Name.Contains("imghorizontalLine"))
                    {
                        Gtk.Image img = item as Gtk.Image;
                        img.Pixbuf = new Gdk.Pixbuf(cnfg.GetBaseImage("horizontalLine.png"));
                    }
                }
            }
        }
Пример #11
0
		protected override void BuildContent (Container parent)
		{
			LogoImage = Xwt.Drawing.Image.FromResource ("WelcomePage_Logo.png");
			TopBorderImage = Xwt.Drawing.Image.FromResource ("WelcomePage_TopBorderRepeat.png");

			var mainAlignment = new Gtk.Alignment (0.5f, 0.5f, 0f, 1f);

			var mainCol = new WelcomePageColumn ();
			mainAlignment.Add (mainCol);

			var row1 = new WelcomePageRow ();
			row1.PackStart (new WelcomePageButtonBar (
				new WelcomePageBarButton ("Haxe.org", "http://www.haxe.org", "link-cloud.png"),
				new WelcomePageBarButton (GettextCatalog.GetString ("Documentation"), "http://www.http://haxe.org/doc", "link-info.png"),
				new WelcomePageBarButton (GettextCatalog.GetString ("Support"), "https://groups.google.com/forum/#!forum/haxelang", "link-heart.png"),
				new WelcomePageBarButton (GettextCatalog.GetString ("Q&A"), "https://groups.google.com/forum/#!forum/haxelang", "link-chat.png")
				)
			);
			mainCol.PackStart (row1, false, false, 0);

			var row2 = new WelcomePageRow (
				new WelcomePageColumn (
				new WelcomePageRecentProjectsList (GettextCatalog.GetString ("Solutions"))
				),
				new WelcomePageColumn (
					new WelcomePageNewsFeed (GettextCatalog.GetString ("Haxe News"), "http://software.xamarin.com/Service/News", "NewsLinks")
				),
				new WelcomePageColumn (
					new WelcomePageTipOfTheDaySection ()
				)
			);
			mainCol.PackStart (row2, false, false, 0);

			parent.Add (mainAlignment);
		}
        public void ResetSelection(Gtk.Widget widget)
        {
            if (selectionWidget == widget || widget == null)
            {
                PlaceSelectionBox(null);
                if (currentObjectSelection != null)
                {
                    currentObjectSelection.FireDisposed();
                    currentObjectSelection = null;

                    // This makes the property editor to flicker
                    // when changing widget selection
                    // UpdateObjectViewers ();
                }
                if (widget == null)
                {
                    Gtk.Container cc = this as Gtk.Container;
                    while (cc.Parent != null)
                    {
                        cc = cc.Parent as Gtk.Container;
                    }
                    if (cc is Gtk.Window)
                    {
                        ((Gtk.Window)cc).Focus = this;
                    }
                }
            }
        }
Пример #13
0
        internal WidgetDesignerBackend(Gtk.Container container, int designWidth, int designHeight)
        {
            ShadowType       = ShadowType.None;
            HscrollbarPolicy = PolicyType.Automatic;
            VscrollbarPolicy = PolicyType.Automatic;

            resizableFixed = new ResizableFixed();
            resizableFixed.ObjectViewer = defaultObjectViewer;

            wrapper = ObjectWrapper.Lookup(container);
            Gtk.Window window = container as Gtk.Window;

            if (window != null)
            {
                try {
                    metacityPreview = CreateMetacityPreview(window);
                    preview         = metacityPreview;
                    if (wrapper != null)
                    {
                        wrapper.Notify += OnWindowPropChange;
                    }
                } catch {
                    // If metacity is not available, use a regular box.
                    EventBox eventBox = new EventBox();
                    eventBox.Add(container);
                    preview = eventBox;
                }
            }
            else
            {
                EventBox eventBox = new EventBox();
                eventBox.Add(container);
                preview = eventBox;
            }

            resizableFixed.Put(preview, container);

            if (designWidth != -1)
            {
                preview.WidthRequest       = designWidth;
                preview.HeightRequest      = designHeight;
                resizableFixed.AllowResize = true;
            }
            else
            {
                resizableFixed.AllowResize = false;
            }

            preview.SizeAllocated += new Gtk.SizeAllocatedHandler(OnResized);

            AddWithViewport(resizableFixed);

            if (wrapper != null)
            {
                wrapper.AttachDesigner(resizableFixed);
            }

            resizableFixed.SelectionChanged += OnSelectionChanged;
        }
Пример #14
0
 public override void DefaultDetach(object target, object chld)
 {
     Gtk.Container parent = target as Gtk.Container;
     Gtk.Widget    child  = chld as Gtk.Widget;
     if (parent != null && child != null)
     {
         parent.Remove(child);
     }
 }
Пример #15
0
        public static void LocalizeMenu(Gtk.Container container)
        {
            foreach (Gtk.Widget w in container.AllChildren) // .AllChildren here really is necessary, otherwise e.g. Gtk.Notebook will not properly recursed
            {
                MenuItem item = w as MenuItem;

                if (item != null && item.Submenu != null)
                {
                    LocalizeMenu(item.Submenu as Menu);
                }

                if (w is Gtk.Container)
                {
                    LocalizeMenu((w as Gtk.Container));
                }

                if (w is ILocalizableWidget)
                {
                    (w as ILocalizableWidget).Localize("MENU");
                }

                if (w is ImageMenuItem)
                {
                    ImageMenuItem imi = w as ImageMenuItem;
                    Image         img = imi.Image as Image;
                    if (img != null)
                    {
                        string stockicon = img.Stock;
                        if (stockicon == "gtk-cut")
                        {
                            imi.Image = Docking.Tools.ResourceLoader_Docking.LoadImage("Cut-16.png");
                            (imi.Child as Label).LabelProp = "Cut".Localized("MENU");
                        }
                        else if (stockicon == "gtk-copy")
                        {
                            imi.Image = Docking.Tools.ResourceLoader_Docking.LoadImage("Copy-16.png");
                            (imi.Child as Label).LabelProp = "Copy".Localized("MENU");
                        }
                        else if (stockicon == "gtk-paste")
                        {
                            imi.Image = Docking.Tools.ResourceLoader_Docking.LoadImage("Paste-16.png");
                            (imi.Child as Label).LabelProp = "Paste".Localized("MENU");
                        }
                        else if (stockicon == "gtk-delete")
                        {
                            imi.Image = null; // Docking.Tools.ResourceLoader_Docking.LoadImage("Delete-16.png");
                            (imi.Child as Label).LabelProp = "Delete".Localized("MENU");
                        }
                        else if (stockicon == "gtk-select-all")
                        {
                            imi.Image = null; // Docking.Tools.ResourceLoader_Docking.LoadImage("SelectAll-16.png");
                            (imi.Child as Label).LabelProp = "Select All".Localized("MENU");
                        }
                    }
                }
            }
        }
Пример #16
0
        // Works around BXC #3801 - Managed Container subclasses are incorrectly resurrected, then leak.
        // It does this by registering an alternative callback for gtksharp_container_override_forall, which
        // ignores callbacks if the wrapper no longer exists. This means that the objects no longer enter a
        // finalized->release->dispose->re-wrap resurrection cycle.
        // We use a dynamic method to access internal/private GTK# API in a performant way without having to track
        // per-instance delegates.
        public static void FixContainerLeak(Gtk.Container c)
        {
            if (containerLeakFixed)
            {
                return;
            }

            FixContainerLeak(c.GetType());
        }
        public static Gtk.Widget FindInnermostFocusChild(this Gtk.Container container)
        {
            Widget f = container.FocusChild;

            while (f != null && (f is Gtk.Container) && !(f is TreeView))
            {
                f = (f as Gtk.Container).FocusChild;
            }
            return(f);
        }
Пример #18
0
 /// <summary>
 /// Recursively sets the ReliefStyle of every button in the specified container
 /// </summary>
 /// <param name="c">
 /// The parent container
 /// A <see cref="Container"/>
 /// </param>
 /// <param name="style">
 /// The relief style to use
 /// A <see cref="Gtk.ReliefStyle"/>
 /// </param>
 public static void SetButtonRelief(Container c, ReliefStyle style)
 {
     foreach(Widget w in c.AllChildren)
     {
         if((w as Button) != null)
             ((Button)w).Relief = style;
         if((w as Container) != null)
             SetButtonRelief((Container)w, style);
     }
 }
Пример #19
0
 static void SetButtonRelief(Container c)
 {
     foreach(Widget w in c.AllChildren)
     {
         Button b;
         if((b = w as Button) != null)
             b.Relief = ReliefStyle.None;
         if((w as Container) != null)
             SetButtonRelief((Container)w);
     }
 }
Пример #20
0
 public PropertyGrid(EditorManager manager)
 {
     this._editorManager         = manager;
     this._expand                = new PropertyGridExpand(this._editorManager, this);
     this._sw.HScrollbar.Visible = true;
     this._sw.VScrollbar.Visible = true;
     this.container              = (Gtk.Container) new EventBox();
     this._sw.AddWithViewport((Widget)this.container);
     this.container.Name = "CocoStudio.ToolKit.PropertyGrid.EventBox";
     this._sw.Name       = "CocoStudio.ToolKit.PropertyGrid.CompactScrolledWindow";
     this.Add((Widget)this._propertyTable);
 }
Пример #21
0
        public static void AddTo(Gtk.Container container, Gtk.Widget w, bool fill = true, uint padding = 0)
        {
            container.Add(w);

            Gtk.Box.BoxChild bc = container[w] as Gtk.Box.BoxChild;
            if (bc != null)
            {
                bc.Expand  = fill;
                bc.Fill    = fill;
                bc.Padding = padding;
            }
        }
Пример #22
0
        private int GetUnevenRowCellHeight(Gtk.Container cell)
        {
            int height = -1;

            var formsCell = GetXamarinFormsCell(cell);

            if (formsCell != null)
            {
                height = Convert.ToInt32(formsCell.Height);
            }

            return(height);
        }
Пример #23
0
        public ObjectGroupEditor()
        {
            Gtk.Builder builder = new Builder();
            builder.AddFromString(Helper.ReadResourceFile("LynnaLab.Glade.ObjectGroupEditor.ui"));
            builder.Autoconnect(this);

            this.Child = (Gtk.Widget)builder.GetObject("mainBox");
            this.objectBoxContainer  = (Gtk.Container)builder.GetObject("objectBoxContainer");
            this.objectDataContainer = (Gtk.Container)builder.GetObject("objectDataContainer");
            this.frameLabel          = (Gtk.Label)builder.GetObject("objectDataContainerLabel");

            this.ShowAll();
        }
Пример #24
0
		void ChangeColor (Gtk.Widget w)
		{
			w.ModifyBg (Gtk.StateType.Normal, new Gdk.Color (69, 69, 94));
			w.ModifyBg (Gtk.StateType.Active, new Gdk.Color (69, 69, 94));
			w.ModifyFg (Gtk.StateType.Normal, new Gdk.Color (255, 255, 255));
			w.ModifyFg (Gtk.StateType.Active, new Gdk.Color (255, 255, 255));
			w.ModifyFg (Gtk.StateType.Prelight, new Gdk.Color (255, 255, 255));

			Gtk.Container c = w as Gtk.Container;

			if (c != null) {
				foreach (Widget cw in c.Children)
					ChangeColor (cw);
			}
		}
Пример #25
0
        public static void LocalizeControls(string prefix, Gtk.Container container)
        {
            foreach (Gtk.Widget w in container.AllChildren) // .AllChildren here really is necessary, otherwise e.g. Gtk.Notebook will not properly recursed
            {
                if (w is Gtk.Container)
                {
                    LocalizeControls(prefix, (w as Gtk.Container));
                }

                if (w is TreeView)
                {
                    foreach (TreeViewColumn c in (w as TreeView).Columns)
                    {
                        if (c is ILocalizableWidget)
                        {
                            (c as ILocalizableWidget).Localize(prefix);
                        }
                    }
                }

                if (w is Gtk.FileChooserWidget)
                {
                    //w.DumpWidgetsHierarchy();
                    Gtk.Label lbl_CreateFolder = w.GetChild(0, 0, 0, 0, 5, 0) as Gtk.Label;
                    Gtk.Label lbl_Location     = w.GetChild(0, 0, 0, 1, 0) as Gtk.Label;

                    /*
                     * Gtk.Label lbl_Places       = w.GetChild(0, 0, 1, 0, 0, 0, 0, 0, 0, 0) as Gtk.Label;    // TODO WHY DO WE GET null HERE??
                     * Gtk.Label lbl_Name         = w.GetChild(0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0) as Gtk.Label; // TODO WHY DO WE GET null HERE??
                     * Gtk.Label lbl_Size         = w.GetChild(0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0) as Gtk.Label; // TODO WHY DO WE GET null HERE??
                     * Gtk.Label lbl_Modified     = w.GetChild(0, 0, 1, 1, 0, 0, 0, 2, 0, 0, 0) as Gtk.Label; // TODO WHY DO WE GET null HERE??
                     */
                    if (lbl_CreateFolder != null)
                    {
                        lbl_CreateFolder.LabelProp = "Create Folder".Localized("Docking.Components");
                    }
                    if (lbl_Location != null)
                    {
                        lbl_Location.LabelProp = "Path".Localized("Docking.Components");
                    }
                }

                if (w is ILocalizableWidget)
                {
                    (w as ILocalizableWidget).Localize(prefix);
                }
            }
        }
Пример #26
0
        Label FindLabelChild(Gtk.Container container)
        {
            var widgets = (
                from child in container.Children
                where typeof(Label).IsAssignableFrom(child.GetType())
                select(Label) child
                ).Union(
                from child in container.Children
                where typeof(Gtk.Container).IsAssignableFrom(child.GetType())
                select FindLabelChild((Gtk.Container)child)
                );

            var labels = widgets.ToArray();

            return(labels.Length > 0 ? labels.First(w => (w != null)) : null);
        }
Пример #27
0
        /// <summary>
        /// Adds the dock item.
        /// </summary>
        /// <param name="label">Label.</param>
        /// <param name="container">Container.</param>
        private void AddDockItem(string label, Gtk.Container container)
        {
            DockItem dockItem = morphose.GetMainWindow().DockFrame.AddItem(label);

            if (label != "Visualizer")
            {
                dockItem.DefaultWidth = 50;
            }
            dockItem.DrawFrame      = true;
            dockItem.Label          = label;
            dockItem.Expand         = true;
            dockItem.DefaultVisible = true;
            dockItem.Visible        = true;
            dockItem.Content        = container;
            container.ShowAll();
        }
Пример #28
0
        public void Fill(TreeIter iter, Gtk.Widget widget)
        {
            Stetic.Wrapper.Widget wrapper = Stetic.Wrapper.Widget.Lookup(widget);
            if (wrapper == null)
            {
                return;
            }

            if (!wrapper.Unselectable)
            {
                Gdk.Pixbuf icon = wrapper.ClassDescriptor.Icon.ScaleSimple(16, 16, Gdk.InterpType.Bilinear);
                string     txt;
                if (widget == project.Selection)
                {
                    txt = "<b>" + GLib.Markup.EscapeText(widget.Name) + "</b>";
                }
                else
                {
                    txt = GLib.Markup.EscapeText(widget.Name);
                }

                if (!iter.Equals(TreeIter.Zero))
                {
                    iter = store.AppendValues(iter, icon, txt, widget);
                }
                else
                {
                    iter = store.AppendValues(icon, txt, widget);
                }
            }

            Gtk.Container cc = widget as Gtk.Container;
            if (cc != null && wrapper.ClassDescriptor.AllowChildren)
            {
                foreach (Gtk.Widget child in cc.Children)
                {
                    Fill(iter, child);
                }
            }
            if (widget == project.Selection)
            {
                tree.ExpandToPath(store.GetPath(iter));
                tree.ExpandRow(store.GetPath(iter), false);
                tree.Selection.SelectIter(iter);
            }
        }
Пример #29
0
        public void CreateTileGrid(Gtk.Container window, Gtk.Image image)
        {
            Gdk.Pixbuf tileSet = image.Pixbuf, scaled = image.Pixbuf;             // gets the pixbuf of the tileset image, scaled is a temporary solution
            scaled = scaled.ScaleSimple(32, 32, Gdk.InterpType.Bilinear);         // scaled should have the dimension of each tile

            myListStore myListstore = new myListStore(window);

            //adds columns to the Liststore
            myListstore.addTVColumn("id", "text", 0);
            myListstore.addTVColumn("number", "text", 1);              //should be something more logic
            myListstore.addTVColumn("stuff", "text", 2);               //should be something more logic than stuff
            myListstore.addTVColumn("tile", "pixbuf", 3);

            new JsonClass(window, image, myListstore);

            window.ShowAll();
        }
Пример #30
0
        static IEnumerable <Gtk.Widget> GetFocusableChildren(Gtk.Container container)
        {
            if (container.CanFocus)
            {
                yield return(container);
            }

            foreach (var f in container.Children)
            {
                if (f is Container c)
                {
                    foreach (var child in GetFocusableChildren(c))
                    {
                        yield return(child);
                    }
                }
            }
        }
Пример #31
0
        private void MainResized(object obj, Gtk.SizeAllocatedArgs args)
        {
            // If the details pane pops up and covers the selected tile,
            // fix it.

            Gtk.Container mainChild = main.Child as Gtk.Container;
            if (mainChild != null)
            {
                Gtk.Widget focusChild = mainChild.FocusChild;
                mainChild.FocusChild = null;
                mainChild.FocusChild = focusChild;

                GroupView gv = mainChild as GroupView;
                if (gv != null)
                {
                    gv.AdjustCategories(args.Allocation.Height);
                }
            }
        }
Пример #32
0
        protected override void HandleError(Exception e)
        {
            //remove the grid in case it was the source of the exception, as GTK# expose exceptions can fire repeatedly
            //also user should not be able to edit things when showing exceptions
            if (propertyGrid != null)
            {
                Gtk.Container parent = propertyGrid.Parent as Gtk.Container;
                if (parent != null)
                {
                    parent.Remove(propertyGrid);
                }

                propertyGrid.Destroy();
                propertyGrid = null;
            }

            //show the error message
            base.HandleError(e);
        }
Пример #33
0
        static IEnumerable <Gtk.Widget> FindAllChildWidgets(this Gtk.Container container)
        {
            var widgets = new Stack <Widget> (new[] { container });

            while (widgets.Any())
            {
                var widget = widgets.Pop();
                yield return(widget);

                if (widget is Gtk.Container)
                {
                    var c = (Gtk.Container)widget;
                    foreach (var w in c.Children)
                    {
                        widgets.Push(w);
                    }
                }
            }
        }
 void FillWidgets(Stetic.Wrapper.Widget widget, int level)
 {
     if (!widget.Unselectable)
     {
         TreeIter iter = store.AppendValues(widget.ClassDescriptor.Icon, widget.Wrapped.Name);
         widgets [widget.Wrapped.Name] = iter;
     }
     Gtk.Container cont = widget.Wrapped as Gtk.Container;
     if (cont != null && widget.ClassDescriptor.AllowChildren)
     {
         foreach (Gtk.Widget child in cont.AllChildren)
         {
             Stetic.Wrapper.Widget cwidget = Stetic.Wrapper.Widget.Lookup(child);
             if (cwidget != null)
             {
                 FillWidgets(cwidget, level + 1);
             }
         }
     }
 }
Пример #35
0
        private void RemoveContainerEntries(Container widget)
        {
            if(widget.Children == null) {
                return;
            }

            while(widget.Children.Length > 0) {
                widget.Remove(widget.Children[0]);
            }
        }
Пример #36
0
		void clearContainer (Container c)
		{
			while (c.Children.Length > 0)
				c.Remove (c.Children [0]);
		}
Пример #37
0
    void CreateComponents()
    {
        fullViewVBox = new VBox (false, 0);
        rootWidget = fullViewVBox;

        CreateMenuBar ();

        CreateToolBar();

        // Create the docking widget and add it to the window.
        dock = new DockFrame ();
        dock.Homogeneous = false;
        dock.DefaultItemHeight = 100;
        dock.DefaultItemWidth = 100;
        //dock.CompactGuiLevel = 1;

        toolbarFrame.AddContent (dock);

        // Create the notebook for the various documents.
        tabControl = new DragNotebook (); //(dock.ShadedContainer);
        tabControl.Scrollable = true;
        tabControl.AppendPage( new Label( "Other page" ), new Label( "Favorite Page  " ) );
        tabControl.AppendPage( new Label( "What page" ), new Label( "Welcome/Start Page  " ) );
        tabControl.AppendPage( new TextView(), new Image( "gtk-new", IconSize.Menu ) );
        tabControl.ShowAll();

        // The main document area
        documentDockItem = dock.AddItem ("Documents");
        documentDockItem.Behavior = DockItemBehavior.Locked;
        documentDockItem.Status = DockItemStatus.AutoHide;
        documentDockItem.DefaultHeight = 100;
        documentDockItem.DefaultWidth = 100;
        documentDockItem.DefaultStatus = DockItemStatus.AutoHide;
        documentDockItem.DefaultLocation = "Document/Right";
        documentDockItem.Expand = true;
        documentDockItem.DrawFrame = true;
        documentDockItem.Label = "Documents";
        documentDockItem.Content = tabControl;
        documentDockItem.DefaultVisible = true;
        documentDockItem.Visible = true;

        DockItem dit = dock.AddItem ("left");
        dit.Status = DockItemStatus.AutoHide;
        dit.DefaultHeight = 100;
        dit.DefaultWidth = 100;
        dit.DefaultStatus = DockItemStatus.AutoHide;
        dit.DefaultLocation = "left";
        dit.Behavior = DockItemBehavior.Normal;
        dit.Label = "Left";
        dit.DefaultVisible = true;
        dit.Visible = true;
        DockItemToolbar tb = dit.GetToolbar(PositionType.Top);
        ToolButton b = new ToolButton(null,"Hello");
        tb.Add(b,false);
        tb.Visible = true;
        tb.ShowAll();

        dit = dock.AddItem ("right");
        dit.Status = DockItemStatus.AutoHide;
        dit.DefaultHeight = 100;
        dit.DefaultWidth = 100;
        dit.DefaultStatus = DockItemStatus.AutoHide;
        dit.DefaultLocation = "Documents/Right";
        dit.Behavior = DockItemBehavior.Normal;
        dit.Label = "Right";
        dit.DefaultVisible = true;
        dit.Visible = true;
        //dit.Icon = Gdk.Pixbuf.LoadFromResource("Cage.Shell.Docking.stock-close-12.png");

        dit = dock.AddItem ("top");
        dit.Status = DockItemStatus.AutoHide;
        dit.DefaultHeight = 100;
        dit.DefaultWidth = 100;
        dit.DefaultStatus = DockItemStatus.AutoHide;
        dit.DefaultLocation = "Documents/Top";
        dit.Behavior = DockItemBehavior.Normal;
        dit.Label = "Top";
        dit.DefaultVisible = true;
        dit.Visible = true;

        dit = dock.AddItem ("bottom");
        dit.Status = DockItemStatus.AutoHide;
        dit.DefaultHeight = 100;
        dit.DefaultWidth = 100;
        dit.DefaultStatus = DockItemStatus.AutoHide;
        dit.DefaultLocation = "Documents/Bottom";
        dit.Behavior = DockItemBehavior.Normal;
        dit.Label = "Bottom";
        dit.DefaultVisible = true;
        dit.Visible = true;

        if ( File.Exists( "toolbar.status" ) )
        {
            toolbarFrame.LoadStatus("toolbar.status");
        }

        if ( File.Exists( "config.layout" ) )
        {
            dock.LoadLayouts( "config.layout" );
        }
        else
        {
            dock.CreateLayout( "test", true );
        }

        dock.CurrentLayout = "test";
        dock.HandlePadding = 0;
        dock.HandleSize = 10;

        dock.SaveLayouts( "config.layout" );
        toolbarFrame.SaveStatus("toolbar.status");

        Add (fullViewVBox);
        fullViewVBox.ShowAll ();

        statusBar = new Gtk.Statusbar();
        fullViewVBox.PackEnd (statusBar, false, true, 0);
    }
Пример #38
0
		static Widget GetChildWidget (Container toplevel, Type type)
		{
			foreach (var child in ((Container) toplevel).Children) {
				if (child.GetType () ==  type)
					return child;
				
				if (child is Container) {
					var w = GetChildWidget ((Container) child, type);
					if (w != null)
						return w;
				}
			}
			
			return null;
		}
Пример #39
0
		public void UpdateContent ()
		{
			if (widget != null)
				((Gtk.Container)widget.Parent).Remove (widget);
			widget = item.Content;
			
			if (item.DrawFrame) {
				if (borderFrame == null) {
					borderFrame = new CustomFrame (1, 1, 1, 1);
					borderFrame.Show ();
					contentBox.Add (borderFrame);
				}
				if (widget != null) {
					borderFrame.Add (widget);
					widget.Show ();
				}
			}
			else if (widget != null) {
				if (borderFrame != null) {
					contentBox.Remove (borderFrame);
					borderFrame = null;
				}
				contentBox.Add (widget);
				widget.Show ();
			}
		}
Пример #40
0
			public SmartScrolledWindowContainerChild (Container parent, Widget child) : base (parent, child)
			{
			}
Пример #41
0
		protected virtual void BuildContent (Container parent)
		{
		}
Пример #42
0
 static void AttachHandler(Container container, Action<object, EnterNotifyEventArgs> enterHandler, Action<object, LeaveNotifyEventArgs> leaveHandler) 
 {
     if(container != null)
     {
         foreach(Widget w in container.AllChildren) {
             w.EnterNotifyEvent += new EnterNotifyEventHandler(enterHandler);
             w.LeaveNotifyEvent += new LeaveNotifyEventHandler(leaveHandler);
             Container subcontainer = w as Container;
             if(subcontainer != null)
                 AttachHandler(subcontainer, enterHandler, leaveHandler);
         }
     }
 }
        public void Attach(IWorkbench wb)
        {
            DefaultWorkbench workbench = (DefaultWorkbench) wb;

            this.workbench = workbench;
            wbWindow = (Window) workbench;

            Gtk.VBox vbox = new VBox (false, 0);
            rootWidget = vbox;

            vbox.PackStart (workbench.TopMenu, false, false, 0);

            toolbarFrame = new CommandFrame (Runtime.Gui.CommandService.CommandManager);
            vbox.PackStart (toolbarFrame, true, true, 0);

            if (workbench.ToolBars != null) {
                for (int i = 0; i < workbench.ToolBars.Length; i++) {
                    toolbarFrame.AddBar ((DockToolbar)workbench.ToolBars[i]);
                }
            }

            // Create the docking widget and add it to the window.
            dock = new Dock ();
            DockBar dockBar = new DockBar (dock);
            Gtk.HBox dockBox = new HBox (false, 5);
            dockBox.PackStart (dockBar, false, true, 0);
            dockBox.PackStart (dock, true, true, 0);
            toolbarFrame.AddContent (dockBox);

            // Create the notebook for the various documents.
            tabControl = new DragNotebook ();
            tabControl.Scrollable = true;
            tabControl.SwitchPage += new SwitchPageHandler (ActiveMdiChanged);
            tabControl.TabsReordered += new TabsReorderedHandler (OnTabsReordered);
            DockItem item = new DockItem ("Documents", "Documents",
                              DockItemBehavior.Locked | DockItemBehavior.NoGrip);
            item.PreferredWidth = -2;
            item.PreferredHeight = -2;
            item.Add (tabControl);
            item.Show ();
            dock.AddItem (item, DockPlacement.Center);

            workbench.Add (vbox);

            vbox.PackEnd (Runtime.Gui.StatusBar.Control, false, true, 0);
            workbench.ShowAll ();

            foreach (IViewContent content in workbench.ViewContentCollection)
                ShowView (content);

            // by default, the active pad collection is the full set
            // will be overriden in CreateDefaultLayout() below
            activePadCollection = workbench.PadContentCollection;

            // create DockItems for all the pads
            foreach (IPadContent content in workbench.PadContentCollection)
            {
                AddPad (content, content.DefaultPlacement);
            }

            CreateDefaultLayout();
            //RedrawAllComponents();
            wbWindow.Show ();

            workbench.ContextChanged += contextChangedHandler;
        }
Пример #44
0
        public static void FetchForm(Container Parent, XmlNode Nodes)
        {
            int cIndex = 0;
            string[] UFont;
            XmlNodeList original = Nodes.ChildNodes;
            XmlNodeList reverse = new ReverseXmlList(original);

            foreach (XmlNode C in reverse) {
                if (C.Name == "Object") {
                    cIndex++;
                    if (C.Attributes[0].Name == "type") {
                        if (C.Attributes["type"].Value.StartsWith("System.Windows.Forms.PictureBox") || C.Attributes["type"].Value.StartsWith("System.Windows.Forms.Button")) {
                            var PB = new Gtk.Button();
                            global::Gtk.Fixed.FixedChild PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent[PB]));
                            Parent.Add(PB);
                            foreach (XmlNode V in C.ChildNodes) {
                                if (V.Name == "Property") {
                                    switch (V.Attributes["name"].Value) {
                                        case "BorderStyle":
                                            if (V.InnerText == "Solid") {
                                                //PB.ModifierStyle =
                                            }
                                            break;
                                        case "Name":
                                            PB.Name = V.InnerText;
                                            break;
                                        case "ForeColor":
                                            var FColor = V.InnerText.GetXColor().ToNative();
                                            PB.Children[0].ModifyFg(StateType.Normal, FColor);
                                            PB.Children[0].ModifyFg(StateType.Active, FColor);
                                            PB.Children[0].ModifyFg(StateType.Prelight, FColor);
                                            PB.Children[0].ModifyFg(StateType.Selected, FColor);
                                            break;
                                        case "Caption":
                                        case "Text":
                                            PB.Label = global::Mono.Unix.Catalog.GetString(System.Environment.ExpandEnvironmentVariables(V.InnerText).Replace("%DATE%", System.DateTime.Now.ToString("dd.MM.yyyy")).Replace("%TIME%", System.DateTime.Now.ToString("hh:mm:ss")));
                                            break;
                                        case "BackColor":
                                            var BColor = V.InnerText.GetXColor().ToNative();
                                            PB.ModifyBg(StateType.Normal, BColor);
                                            PB.ModifyBg(StateType.Active, BColor);
                                            PB.ModifyBg(StateType.Insensitive, BColor);
                                            PB.ModifyBg(StateType.Prelight, BColor);
                                            PB.ModifyBg(StateType.Selected, BColor);
                                            break;
                                        case "SizeMode":
                                            //PB.SizeMode = Enum.Parse(typeof(PictureBoxSizeMode), V.InnerText);
                                            break;
                                        case "Location":
                                            PBC1.X = (int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX);
                                            PBC1.Y = (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY);
                                            break;
                                        case "Size":
                                            PB.SetSizeRequest((int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX), (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY));
                                            break;
                                        case "Font":
                                            string VC = V.InnerText;
                                            UFont = VC.Replace("style=", "").Split(new[] {","}, StringSplitOptions.RemoveEmptyEntries);
                                            string VCFName = UFont[0];
                                            float VCSize = float.Parse(UFont[1].Replace("pt", ""));
                                            float Z = (float)(VCSize * App.ScaleFactorY);
                                            PB.Children[0].ModifyFont(Pango.FontDescription.FromString(VCFName + " " + ((int)Z).ToString()));
                                            break;
                                        case "Image":
                                            if (V.HasChildNodes) {
                                                string IMGData = V.FirstChild.InnerText;
                                                byte[] B = System.Convert.FromBase64String(IMGData);
                                                Pixbuf P = new Pixbuf(B);
                                                P=P.ScaleSimple(PB.WidthRequest-10, PB.HeightRequest, InterpType.Bilinear);
                                                PB.Image = new Gtk.Image(P);
                                            }
                                            break;
                                    }
                                } else if (V.Name == "Object") {
                                    //FetchForm(PB, V.ParentNode);
                                }
                            }
                        } else if (C.Attributes["type"].Value.StartsWith("System.Windows.Forms.Label")) {
                            var CE = new Gtk.EventBox();
                            CE.ResizeMode = ResizeMode.Parent;
                            var CC = new Gtk.Label();
                            CE.Add(CC);
                            Parent.Add(CE);
                            CC.LineWrapMode = Pango.WrapMode.Word;
                            CC.LineWrap = true;
                            CC.Wrap = true;
                            CC.Justify = Justification.Fill;
                            global::Gtk.Fixed.FixedChild PBC1;
                            if ((Parent[CE]).GetType().ToString() == "Gtk.Container+ContainerChild") {
                                var XVC = Parent[CE].Parent.Parent;
                                PBC1 = (global::Gtk.Fixed.FixedChild)(Parent[XVC]);
                            } else {
                                PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent[CE]));
                            }
                            foreach (XmlNode V in C.ChildNodes) {
                                if (V.Name == "Property") {
                                    switch (V.Attributes["name"].Value) {
                                        case "BorderStyle":
                                            if (V.InnerText == "Solid") {
                                                //PB.ModifierStyle =
                                            }
                                            break;
                                        case "Name":
                                            CC.Name = V.InnerText;
                                            break;
                                        case "Font":
                                            string VC = V.InnerText;
                                            UFont = VC.Replace("style=", "").Split(new[] {","}, StringSplitOptions.RemoveEmptyEntries);
                                            string VCFName = UFont[0];
                                            float VCSize = float.Parse(UFont[1].Replace("pt", ""));
                                            float Z = (float)(VCSize * App.ScaleFactorY);
                                            CC.ModifyFont(Pango.FontDescription.FromString(VCFName + " " + (int)Z));
                                            break;
                                        case "ForeColor":
                                            var FColor = V.InnerText.GetXColor().ToNative();
                                            CC.ModifyFg(StateType.Normal, FColor);
                                            CC.ModifyFg(StateType.Active, FColor);
                                            CC.ModifyFg(StateType.Insensitive, FColor);
                                            CC.ModifyFg(StateType.Prelight,FColor);
                                            CC.ModifyFg(StateType.Selected, FColor);
                                            CE.ModifyFg(StateType.Normal, FColor);
                                            CE.ModifyFg(StateType.Active, FColor);
                                            CE.ModifyFg(StateType.Insensitive, FColor);
                                            CE.ModifyFg(StateType.Prelight, FColor);
                                            CE.ModifyFg(StateType.Selected, FColor);
                                            CC.Markup = "<span foreground=\"" + V.InnerText + "\">" + CC.Text + "</span>";
                                            break;
                                        case "Caption":
                                        case "Text":
                                            CC.Text = global::Mono.Unix.Catalog.GetString(System.Environment.ExpandEnvironmentVariables(V.InnerText).Replace("%DATE%", System.DateTime.Now.ToString("dd.MM.yyyy")).Replace("%TIME%", System.DateTime.Now.ToString("hh:mm:ss")).Replace("##", "\r\n"));
                                            break;
                                        case "BackColor":
                                            if (V.InnerText != "Transparent") {
                                                var BColor = V.InnerText.GetXColor().ToNative();
                                                CE.ModifyBg(StateType.Normal, BColor);
                                                CE.ModifyBg(StateType.Active, BColor);
                                                CE.ModifyBg(StateType.Insensitive, BColor);
                                                CE.ModifyBg(StateType.Prelight, BColor);
                                                CE.ModifyBg(StateType.Selected, BColor);
                                            } else {
                                                CE.Visible = false;
                                                CE.VisibleWindow = false;
                                            }
                                            break;
                                        case "SizeMode":
                                            //PB.SizeMode = Enum.Parse(typeof(PictureBoxSizeMode), V.InnerText);
                                            break;
                                        case "Location":
                                            PBC1.X = (int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX);
                                            PBC1.Y = (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY);
                                            break;
                                        case "TextAlign":
                                            CC.Justify = (V.InnerText == "MiddleCenter" || V.InnerText == "TopCenter" || V.InnerText == "BottomCenter" ? Justification.Center : (V.InnerText == "MiddleRight" || V.InnerText == "TopRight" || V.InnerText == "BottomRight" ? Justification.Right : Justification.Left));
                                            break;
                                        case "Size":
                                            CE.SetSizeRequest((int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX), (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY));
                                            CC.SetSizeRequest((int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX), (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY));
                                            break;
                                    }
                                } else if (V.Name == "Object") {
                                    var TZJE = new Fixed();

                                }
                            }
                        } else if (C.Attributes ["type"].Value.StartsWith("System.Windows.Forms.TextBox")) {
                            if (C.InnerXml.IndexOf("\"Multiline\">True") > -1)
                            {
                                var CC = new Gtk.Entry ();
                                global::Gtk.Fixed.FixedChild PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent [CC]));
                                Parent.Add (CC);
                                foreach (XmlNode V in C.ChildNodes) {
                                    {
                                        if (V.Name == "Property")
                                        {
                                            switch (V.Attributes ["name"].Value)
                                            {
                                                case "Text":
                                                    {
                                                        if (V.InnerText.Contains ("%")) {
                                                            CC.Text = System.Environment.ExpandEnvironmentVariables (V.InnerText);
                                                            CC.Position = CC.Text.Length;
                                                        }
                                                        break;
                                                    }
                                                case "Location":
                                                    PBC1.X = (int)(Convert.ToInt32 (V.InnerText.Substring (0, V.InnerText.IndexOf (",")))  * App.ScaleFactorX);
                                                    PBC1.Y = (int)(Convert.ToInt32 (V.InnerText.Substring (V.InnerText.IndexOf (",") + 1)) * App.ScaleFactorY);
                                                    break;
                                                case "Size":
                                                    CC.SetSizeRequest ((int)(Convert.ToInt32 (V.InnerText.Substring (0, V.InnerText.IndexOf (",")))* App.ScaleFactorX), (int)(Convert.ToInt32 (V.InnerText.Substring (V.InnerText.IndexOf (",") + 1))* App.ScaleFactorY));
                                                    break;
                                                case "Name":
                                                    CC.Name = V.InnerText;
                                                    break;
                                                case "Font":
                                                    string VC = V.InnerText;
                                                    UFont = VC.Replace("style=", "").Split(new[] {","}, StringSplitOptions.RemoveEmptyEntries);
                                                    string VCFName = UFont[0];
                                                    float VCSize = float.Parse(UFont[1].Replace("pt", ""));
                                                    float Z = (float)(VCSize * App.ScaleFactorY);
                                                    CC.ModifyFont (Pango.FontDescription.FromString (VCFName+" "+((int)Z).ToString()));
                                                    System.Diagnostics.Debug.WriteLine(VCFName+" "+((int)Z).ToString());
                                                    break;
                                            }
                                        }
                                    }
                                }
                            }
                            else
                            {
                                var CC= new Gtk.Entry();
                                global::Gtk.Fixed.FixedChild PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent [CC]));
                                Parent.Add (CC);
                                foreach (XmlNode V in C.ChildNodes) {
                                    {
                                        if (V.Name == "Property")
                                        {
                                            switch (V.Attributes ["name"].Value)
                                            {
                                                case "Name":
                                                    CC.Name = V.InnerText;
                                                    break;
                                                case "Text":
                                                    {
                                                        if (V.InnerText.Contains ("%")) {
                                                            CC.Text = System.Environment.ExpandEnvironmentVariables (V.InnerText);
                                                            CC.Position = CC.Text.Length;
                                                        }
                                                        break;
                                                    }
                                                case "Location":
                                                    PBC1.X = (int)(Convert.ToInt32 (V.InnerText.Substring (0, V.InnerText.IndexOf (",")))  * App.ScaleFactorX);
                                                    PBC1.Y = (int)(Convert.ToInt32 (V.InnerText.Substring (V.InnerText.IndexOf (",") + 1)) * App.ScaleFactorY);
                                                    break;
                                                case "Size":
                                                    CC.SetSizeRequest ((int)(Convert.ToInt32 (V.InnerText.Substring (0, V.InnerText.IndexOf (",")))* App.ScaleFactorX), (int)(Convert.ToInt32 (V.InnerText.Substring (V.InnerText.IndexOf (",") + 1))* App.ScaleFactorY));
                                                    break;
                                                case "PasswordChar":
                                                    CC.InvisibleChar = '*';
                                                    CC.Visibility = false;
                                                    break;
                                                case "Font":
                                                    string VC = V.InnerText;
                                                    UFont = VC.Replace("style=", "").Split(new[] {","}, StringSplitOptions.RemoveEmptyEntries);
                                                    string VCFName = UFont[0];
                                                    float VCSize = float.Parse(UFont[1].Replace("pt", ""));
                                                    float Z = (float)(VCSize * App.ScaleFactorY);
                                                    CC.ModifyFont (Pango.FontDescription.FromString (VCFName+" "+((int)Z).ToString()));
                                                    System.Diagnostics.Debug.WriteLine(VCFName+" "+((int)Z).ToString());
                                                    break;
                                            }
                                        }
                                    }
                                }
                            }
                        } else if (C.Attributes ["type"].Value.StartsWith ("System.Windows.Forms.Panel")) {
                            var CP = new Gtk.Fixed ();
                            //CP.Clicked += HandleClick;
                            global::Gtk.Fixed.FixedChild PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent [CP]));
                            Parent.Add (CP);
                            foreach (XmlNode V in C.ChildNodes) {
                                if (V.Name == "Property") {
                                    switch (V.Attributes ["name"].Value) {
                                        case "Name":
                                            CP.Name = V.InnerText;
                                            break;
                                        case "BorderStyle":
                                            if (V.InnerText == "Solid") {
                                                //PB.ModifierStyle =
                                            }
                                            break;
                                        case "ForeColor":

                                            CP.Children [0].ModifyFg (StateType.Normal, V.InnerText.GetXColor ().ToNative ());
                                            break;
                                        case "BackColor":
                                            CP.ModifyBg (StateType.Normal, V.InnerText.GetXColor().ToNative ());
                                            break;
                                        case "SizeMode":
                                            //PB.SizeMode = Enum.Parse(typeof(PictureBoxSizeMode), V.InnerText);
                                            break;
                                        case "Location":
                                            PBC1.X = (int)(Convert.ToInt32 (V.InnerText.Substring (0, V.InnerText.IndexOf (",")))  * App.ScaleFactorX);
                                            PBC1.Y = (int)(Convert.ToInt32 (V.InnerText.Substring (V.InnerText.IndexOf (",") + 1)) * App.ScaleFactorY);
                                            break;
                                        case "Size":
                                            CP.SetSizeRequest ((int)(Convert.ToInt32 (V.InnerText.Substring (0, V.InnerText.IndexOf (",")))* App.ScaleFactorX), (int)(Convert.ToInt32 (V.InnerText.Substring (V.InnerText.IndexOf (",") + 1))* App.ScaleFactorY));
                                            break;
                                    }
                                } else if (V.Name == "Object") {
                                    //FetchForm(PB, V.ParentNode);
                                }
                            }
                        } else {
                            System.Diagnostics.Debug.WriteLine (C.Attributes ["type"].Value);

                        }
                    }
                }

            }
            Parent.ShowAll();
        }
Пример #45
0
 public static void SetFocus(Container w, bool canFocus, params Type[] skipTypes)
 {
     if (IsSkipedType (w, skipTypes)) {
         return;
     }
     w.CanFocus = canFocus;
     foreach (Widget child in w.AllChildren) {
         if (child is Container) {
             SetFocus (child as Container, canFocus, skipTypes);
         } else {
             if (!IsSkipedType (child, skipTypes)) {
                 child.CanFocus = canFocus;
             }
         }
     }
 }
Пример #46
0
		void CreateComponents ()
		{
			fullViewVBox = new VBox (false, 0);
			rootWidget = fullViewVBox;
			
			InstallMenuBar ();
			
			toolbarFrame = new CommandFrame (IdeApp.CommandService);
			fullViewVBox.PackStart (toolbarFrame, true, true, 0);
			
			foreach (DockToolbar t in toolbars)
				toolbarFrame.AddBar (t);
			
			// Create the docking widget and add it to the window.
			dock = new DockFrame ();
			
			dock.CompactGuiLevel = ((int)IdeApp.Preferences.WorkbenchCompactness) + 1;
			IdeApp.Preferences.WorkbenchCompactnessChanged += delegate {
				dock.CompactGuiLevel = ((int)IdeApp.Preferences.WorkbenchCompactness) + 1;
			};
			
			/* Side bar is experimental. Disabled for now
			HBox hbox = new HBox ();
			VBox sideBox = new VBox ();
			sideBox.PackStart (new SideBar (workbench, Orientation.Vertical), false, false, 0);
			hbox.PackStart (sideBox, false, false, 0);
			hbox.ShowAll ();
			sideBox.NoShowAll = true;
			hbox.PackStart (dock, true, true, 0);
			DockBar bar = dock.ExtractDockBar (PositionType.Left);
			bar.AlwaysVisible = true;
			sideBox.PackStart (bar, true, true, 0);
			toolbarFrame.AddContent (hbox);
			*/

			toolbarFrame.AddContent (dock);
			
			// Create the notebook for the various documents.
			tabControl = new SdiDragNotebook (dock.ShadedContainer);
			tabControl.Scrollable = true;
			tabControl.SwitchPage += OnActiveWindowChanged;
			tabControl.PageAdded += delegate { OnActiveWindowChanged (null, null); };
			tabControl.PageRemoved += delegate { OnActiveWindowChanged (null, null); };
		
			tabControl.ButtonPressEvent += delegate(object sender, ButtonPressEventArgs e) {
				int tab = tabControl.FindTabAtPosition (e.Event.XRoot, e.Event.YRoot);
				if (tab < 0)
					return;
				tabControl.CurrentPage = tab;
				if (e.Event.Type == Gdk.EventType.TwoButtonPress)
					ToggleFullViewMode ();
			};
			
			this.tabControl.PopupMenu += delegate {
				ShowPopup ();
			};
			this.tabControl.ButtonReleaseEvent += delegate (object sender, Gtk.ButtonReleaseEventArgs e) {
				int tab = tabControl.FindTabAtPosition (e.Event.XRoot, e.Event.YRoot);
				if (tab < 0)
					return;
				if (e.Event.Button == 3)
					ShowPopup ();
			};
			
			tabControl.TabsReordered += new TabsReorderedHandler (OnTabsReordered);

			// The main document area
			documentDockItem = dock.AddItem ("Documents");
			documentDockItem.Behavior = DockItemBehavior.Locked;
			documentDockItem.Expand = true;
			documentDockItem.DrawFrame = false;
			documentDockItem.Label = GettextCatalog.GetString ("Documents");
			documentDockItem.Content = tabControl;
			
			// Add some hiden items to be used as position reference
			DockItem dit = dock.AddItem ("__left");
			dit.DefaultLocation = "Documents/Left";
			dit.Behavior = DockItemBehavior.Locked;
			dit.DefaultVisible = false;
			
			dit = dock.AddItem ("__right");
			dit.DefaultLocation = "Documents/Right";
			dit.Behavior = DockItemBehavior.Locked;
			dit.DefaultVisible = false;
			
			dit = dock.AddItem ("__top");
			dit.DefaultLocation = "Documents/Top";
			dit.Behavior = DockItemBehavior.Locked;
			dit.DefaultVisible = false;
			
			dit = dock.AddItem ("__bottom");
			dit.DefaultLocation = "Documents/Bottom";
			dit.Behavior = DockItemBehavior.Locked;
			dit.DefaultVisible = false;

			Add (fullViewVBox);
			fullViewVBox.ShowAll ();
			
			fullViewVBox.PackEnd (this.StatusBar, false, true, 0);
			
			if (MonoDevelop.Core.PropertyService.IsMac)
				this.StatusBar.HasResizeGrip = true;
			else {
				if (GdkWindow != null && GdkWindow.State == Gdk.WindowState.Maximized)
					IdeApp.Workbench.StatusBar.HasResizeGrip = false;
				SizeAllocated += delegate {
					if (GdkWindow != null)
						IdeApp.Workbench.StatusBar.HasResizeGrip = GdkWindow.State != Gdk.WindowState.Maximized;
				};
			}

			// create DockItems for all the pads
			foreach (PadCodon content in padContentCollection)
				AddPad (content, content.DefaultPlacement, content.DefaultStatus);
			
			try {
				if (System.IO.File.Exists (configFile)) {
					dock.LoadLayouts (configFile);
					foreach (string layout in dock.Layouts) {
						if (!layouts.Contains (layout) && !layout.EndsWith (fullViewModeTag))
							layouts.Add (layout);
					}
				}
			} catch (Exception ex) {
				LoggingService.LogError (ex.ToString ());
			}
		}
Пример #47
0
 /// <summary>
 /// recursive add all children
 /// </summary>
 /// <param name='parent'>
 /// Parent.
 /// </param>
 /// <param name='list'>
 /// List.
 /// </param>
 protected void addChildren(Container parent, List<Widget> list)
 {
     foreach (Widget w in parent.AllChildren)
     {
         list.Add(w);
         //Console.WriteLine("xxx:" + w.Name);
         Container c = w as Container;
         if (c != null)
         {
             //Console.WriteLine("-->:" + w.Name);
             addChildren(c,list);
         }
     }
 }
Пример #48
0
		internal void Put (Gtk.Widget child, Gtk.Container container)
		{
			this.child = child;
			this.container = container;
			fixd.Put (child, selectionBorder + padding, selectionBorder + padding);
			child.SizeRequested += new SizeRequestedHandler (OnSizeReq);
		}
        private void DestroyView()
        {
            viewWidget = null;

            if (podcast_view != null)
            {
                podcast_view.Shutdown ();
            }

            podcast_view = null;
            podcast_model = null;

            podcast_feed_view = null;
            podcast_feed_model = null;

            feed_view_popup_menu = null;
        }
Пример #50
0
 public ContainerChild(Container parent, Widget child)
 {
     this.parent = parent;
     this.child = child;
 }
Пример #51
0
			public EditorContainerChild (Container parent, Widget child) : base (parent, child)
			{
			}
Пример #52
0
        void CreateComponents()
        {
            fullViewVBox = new VBox (false, 0);
            rootWidget = fullViewVBox;

            InstallMenuBar ();
            Realize ();
            toolbar = DesktopService.CreateMainToolbar (this);
            DesktopService.SetMainWindowDecorations (this);
            var toolbarBox = new HBox ();
            fullViewVBox.PackStart (toolbarBox, false, false, 0);
            toolbarFrame = new CommandFrame (IdeApp.CommandService);

            fullViewVBox.PackStart (toolbarFrame, true, true, 0);

            // Create the docking widget and add it to the window.
            dock = new DockFrame ();

            dock.CompactGuiLevel = ((int)IdeApp.Preferences.WorkbenchCompactness) + 1;
            IdeApp.Preferences.WorkbenchCompactnessChanged += delegate {
                dock.CompactGuiLevel = ((int)IdeApp.Preferences.WorkbenchCompactness) + 1;
            };

            /* Side bar is experimental. Disabled for now
            HBox hbox = new HBox ();
            VBox sideBox = new VBox ();
            sideBox.PackStart (new SideBar (workbench, Orientation.Vertical), false, false, 0);
            hbox.PackStart (sideBox, false, false, 0);
            hbox.ShowAll ();
            sideBox.NoShowAll = true;
            hbox.PackStart (dock, true, true, 0);
            DockBar bar = dock.ExtractDockBar (PositionType.Left);
            bar.AlwaysVisible = true;
            sideBox.PackStart (bar, true, true, 0);
            toolbarFrame.AddContent (hbox);
            */

            toolbarFrame.AddContent (dock);

            // Create the notebook for the various documents.
            tabControl = new SdiDragNotebook (this);

            DockNotebook.ActiveNotebookChanged += delegate {
                OnActiveWindowChanged (null, null);
            };

            Add (fullViewVBox);
            fullViewVBox.ShowAll ();
            bottomBar = new MonoDevelopStatusBar ();
            fullViewVBox.PackEnd (bottomBar, false, true, 0);
            bottomBar.ShowAll ();
            toolbarBox.PackStart (this.toolbar, true, true, 0);

            // In order to get the correct bar height we need to calculate the tab size using the
            // correct style (the style of the window). At this point the widget is not yet a child
            // of the window, so its style is not yet the correct one.
            tabControl.InitSize ();
            var barHeight = tabControl.BarHeight;

            // The main document area
            documentDockItem = dock.AddItem ("Documents");
            documentDockItem.Behavior = DockItemBehavior.Locked;
            documentDockItem.Expand = true;
            documentDockItem.DrawFrame = false;
            documentDockItem.Label = GettextCatalog.GetString ("Documents");
            documentDockItem.Content = new DockNotebookContainer (tabControl, true);

            DockVisualStyle style = new DockVisualStyle ();
            style.PadTitleLabelColor = Styles.PadLabelColor;
            style.PadBackgroundColor = Styles.PadBackground;
            style.InactivePadBackgroundColor = Styles.InactivePadBackground;
            style.PadTitleHeight = barHeight;
            dock.DefaultVisualStyle = style;

            style = new DockVisualStyle ();
            style.PadTitleLabelColor = Styles.PadLabelColor;
            style.PadTitleHeight = barHeight;
            style.ShowPadTitleIcon = false;
            style.UppercaseTitles = false;
            style.ExpandedTabs = true;
            style.PadBackgroundColor = Styles.BrowserPadBackground;
            style.InactivePadBackgroundColor = Styles.InactiveBrowserPadBackground;
            style.TreeBackgroundColor = Styles.BrowserPadBackground;
            dock.SetDockItemStyle ("ProjectPad", style);
            dock.SetDockItemStyle ("ClassPad", style);

            //			dock.SetRegionStyle ("Documents/Left", style);
            //dock.SetRegionStyle ("Documents/Right", style);

            //			style = new DockVisualStyle ();
            //			style.SingleColumnMode = true;
            //			dock.SetRegionStyle ("Documents/Left;Documents/Right", style);
            //			dock.SetDockItemStyle ("Documents", style);

            // Add some hiden items to be used as position reference
            DockItem dit = dock.AddItem ("__left");
            dit.DefaultLocation = "Documents/Left";
            dit.Behavior = DockItemBehavior.Locked;
            dit.DefaultVisible = false;

            dit = dock.AddItem ("__right");
            dit.DefaultLocation = "Documents/Right";
            dit.Behavior = DockItemBehavior.Locked;
            dit.DefaultVisible = false;

            dit = dock.AddItem ("__top");
            dit.DefaultLocation = "Documents/Top";
            dit.Behavior = DockItemBehavior.Locked;
            dit.DefaultVisible = false;

            dit = dock.AddItem ("__bottom");
            dit.DefaultLocation = "Documents/Bottom";
            dit.Behavior = DockItemBehavior.Locked;
            dit.DefaultVisible = false;

            if (MonoDevelop.Core.Platform.IsMac)
                bottomBar.HasResizeGrip = true;
            else {
                if (GdkWindow != null && GdkWindow.State == Gdk.WindowState.Maximized)
                    bottomBar.HasResizeGrip = false;
                SizeAllocated += delegate {
                    if (GdkWindow != null)
                        bottomBar.HasResizeGrip = GdkWindow.State != Gdk.WindowState.Maximized;
                };
            }

            // create DockItems for all the pads
            ExtensionNodeList padCodons = AddinManager.GetExtensionNodes (viewContentPath);
            foreach (ExtensionNode node in padCodons)
                ShowPadNode (node);

            try {
                if (System.IO.File.Exists (configFile)) {
                    dock.LoadLayouts (configFile);
                    foreach (string layout in dock.Layouts) {
                        if (!layouts.Contains (layout) && !layout.EndsWith (fullViewModeTag))
                            layouts.Add (layout);
                    }
                }
            } catch (Exception ex) {
                LoggingService.LogError (ex.ToString ());
            }
        }
        private void BuildView()
        {
            podcast_view_scroller = new ScrolledWindow();

            podcast_view_scroller.ShadowType = ShadowType.In;
            podcast_view_scroller.VscrollbarPolicy = PolicyType.Automatic;
            podcast_view_scroller.HscrollbarPolicy = PolicyType.Automatic;

            podcast_feed_view_scroller = new ScrolledWindow();

            podcast_feed_view_scroller.ShadowType = ShadowType.In;
            podcast_feed_view_scroller.VscrollbarPolicy = PolicyType.Automatic;
            podcast_feed_view_scroller.HscrollbarPolicy = PolicyType.Automatic;

            podcast_model = new PodcastPlaylistModel ();
            podcast_feed_model = new PodcastFeedModel ();

            podcast_model.ClearModel ();
            podcast_feed_model.ClearModel ();

            podcast_model.QueueAdd (PodcastCore.Library.Podcasts);
            podcast_feed_model.QueueAdd (PodcastCore.Library.Feeds);

            podcast_view = new PodcastPlaylistView (podcast_model);
            podcast_view.ButtonPressEvent += OnPlaylistViewButtonPressEvent;

            podcast_feed_view = new PodcastFeedView (podcast_feed_model);
            podcast_feed_view.Selection.Changed += OnFeedViewSelectionChanged;
            podcast_feed_view.ButtonPressEvent += OnPodcastFeedViewButtonPressEvent;
            podcast_feed_view.SelectAll += OnSelectAllHandler;

            podcast_view_scroller.Add (podcast_view);
            podcast_feed_view_scroller.Add (podcast_feed_view);

            feed_info_pane = new HPaned ();
            feed_info_pane.Add1 (podcast_feed_view_scroller);
            // -- later-- feed_info_pane.Add2 ();

            feed_playlist_pane = new VPaned ();
            feed_playlist_pane.Add1 (feed_info_pane);
            feed_playlist_pane.Add2 (podcast_view_scroller);

            try
            {
                feed_playlist_pane.Position =
                    GConfSchemas.PlaylistSeparatorPositionSchema.Get ();
            }
            catch {
                feed_playlist_pane.Position = 300;
                GConfSchemas.PlaylistSeparatorPositionSchema.Set (
                    feed_playlist_pane.Position
                );
            }

            update_button = new ActionButton (Globals.ActionManager ["PodcastUpdateFeedsAction"]);
            viewWidget = feed_playlist_pane;

            viewWidget.ShowAll ();
        }