Inheritance: ActionTreeNode
コード例 #1
0
 void CreateTree()
 {
     actionTree          = new ActionTree();
     actionTree.Name     = Wrapped.Name;
     actionTree.Type     = Gtk.UIManagerItemType.Menubar;
     actionTree.Changed += OnTreeChanged;
 }
コード例 #2
0
 void CreateTree()
 {
     actionTree          = new ActionTree();
     actionTree.Name     = Name;
     actionTree.Type     = Gtk.UIManagerItemType.Toolbar;
     actionTree.Changed += OnTreeChanged;
 }
コード例 #3
0
 void DisposeTree()
 {
     if (actionTree != null)
     {
         actionTree.Dispose();
         actionTree.Changed -= OnTreeChanged;
         actionTree          = null;
     }
 }
コード例 #4
0
ファイル: ActionToolbar.cs プロジェクト: Kalnor/monodevelop
		public void FillMenu (ActionTree actionTree)
		{
			addLabel = null;

			if (this.actionTree != null) {
				this.actionTree.ChildNodeAdded -= OnChildAdded;
				this.actionTree.ChildNodeRemoved -= OnChildRemoved;
			}
			
			this.actionTree = actionTree;
			if (actionTree == null) {
				AddSpacerItem ();
				return;
			}
				
			actionTree.ChildNodeAdded += OnChildAdded;
			actionTree.ChildNodeRemoved += OnChildRemoved;
			
			HideSpacerItem ();
			toolItems.Clear ();
			Widget wrapper = Stetic.Wrapper.Widget.Lookup (this);
			
			foreach (Gtk.Widget w in Children) {
				Remove (w);
				w.Destroy ();
			}

			foreach (ActionTreeNode node in actionTree.Children) {
				ActionToolItem aitem = new ActionToolItem (wrapper, this, node);
				AddItem (aitem, -1);
				toolItems.Add (aitem);
			}
			
			if (actionTree.Children.Count == 0) {
				// If there are no buttons in the toolbar, give it some height so it is selectable.
				AddSpacerItem ();
			}

			if (showPlaceholder) {
				AddCreateItemLabel ();
			}
		}
コード例 #5
0
        protected CodeExpression GenerateUiManagerElement(GeneratorContext ctx, ActionTree tree)
        {
            Widget topLevel = GetTopLevel();
            string uiName   = topLevel.UIManagerName;

            if (uiName != null)
            {
                CodeFieldReferenceExpression uiManager = new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), uiName);
                if (topLevel.includedActionGroups == null)
                {
                    topLevel.includedActionGroups = new ArrayList();
                }

                // Add to the uimanager all action groups required by the
                // actions of the tree

                foreach (ActionGroup grp in tree.GetRequiredGroups())
                {
                    if (!topLevel.includedActionGroups.Contains(grp))
                    {
                        // Insert the action group in the UIManager
                        CodeMethodInvokeExpression mi = new CodeMethodInvokeExpression(
                            uiManager,
                            "InsertActionGroup",
                            ctx.GenerateValue(grp, typeof(ActionGroup)),
                            new CodePrimitiveExpression(topLevel.includedActionGroups.Count)
                            );
                        ctx.Statements.Add(mi);
                        topLevel.includedActionGroups.Add(grp);
                    }
                }

                tree.GenerateBuildCode(ctx, uiManager);
                return(new CodeMethodInvokeExpression(
                           uiManager,
                           "GetWidget",
                           new CodePrimitiveExpression("/" + Wrapped.Name)
                           ));
            }
            return(null);
        }
コード例 #6
0
		public void FillMenu (ActionTree actionTree)
		{
			addLabel = null;

			if (this.actionTree != null) {
				this.actionTree.ChildNodeAdded -= OnChildAdded;
				this.actionTree.ChildNodeRemoved -= OnChildRemoved;
			}
			
			this.actionTree = actionTree;
			if (actionTree == null) {
				AddSpacerItem ();
				return;
			}
				
			actionTree.ChildNodeAdded += OnChildAdded;
			actionTree.ChildNodeRemoved += OnChildRemoved;
			
			HideSpacerItem ();
			menuItems.Clear ();
			Widget wrapper = Widget.Lookup (this);
			
			foreach (Gtk.Widget w in Children) {
				Remove (w);
				w.Destroy ();
			}

			foreach (ActionTreeNode node in actionTree.Children) {
				ActionMenuItem aitem = new ActionMenuItem (wrapper, this, node);
				AddItem (aitem, -1);
				menuItems.Add (aitem);
			}

			if (showPlaceholder) {
				AddCreateItemLabel ();
			} else if (actionTree.Children.Count == 0) {
				// Give some height to the toolbar
				AddSpacerItem ();
			}
		}
コード例 #7
0
		protected CodeExpression GenerateUiManagerElement (GeneratorContext ctx, ActionTree tree)
		{
			Widget topLevel = GetTopLevel ();
			string uiName = topLevel.UIManagerName;
			if (uiName != null) {
				CodeFieldReferenceExpression uiManager = new CodeFieldReferenceExpression (new CodeThisReferenceExpression (), uiName);
				if (topLevel.includedActionGroups == null)
					topLevel.includedActionGroups = new ArrayList ();
				
				// Add to the uimanager all action groups required by the 
				// actions of the tree
				
				foreach (ActionGroup grp in tree.GetRequiredGroups ()) {
					if (!topLevel.includedActionGroups.Contains (grp)) {
						// Insert the action group in the UIManager
						CodeMethodInvokeExpression mi = new CodeMethodInvokeExpression (
							uiManager,
							"InsertActionGroup",
							ctx.GenerateValue (grp, typeof(ActionGroup)),
							new CodePrimitiveExpression (topLevel.includedActionGroups.Count)
						);
						ctx.Statements.Add (mi);
						topLevel.includedActionGroups.Add (grp);
					}
				}
				
				tree.GenerateBuildCode (ctx, uiManager);
				return new CodeMethodInvokeExpression (
					uiManager,
					"GetWidget",
					new CodePrimitiveExpression ("/" + Wrapped.Name)
				);
			}
			return null;
		}
コード例 #8
0
ファイル: MenuBar.cs プロジェクト: mono/stetic
 void DisposeTree()
 {
     if (actionTree != null) {
         actionTree.Dispose ();
         actionTree.Changed -= OnTreeChanged;
         actionTree = null;
     }
 }
コード例 #9
0
ファイル: MenuBar.cs プロジェクト: mono/stetic
 void CreateTree()
 {
     actionTree = new ActionTree ();
     actionTree.Name = Wrapped.Name;
     actionTree.Type = Gtk.UIManagerItemType.Menubar;
     actionTree.Changed += OnTreeChanged;
 }
コード例 #10
0
		void CreateTree ()
		{
			actionTree = new ActionTree ();
			actionTree.Name = Name;
			actionTree.Type = Gtk.UIManagerItemType.Toolbar;
			actionTree.Changed += OnTreeChanged;
		}