Attach() public méthode

public Attach ( Gtk table, uint row, uint col ) : void
table Gtk
row uint
col uint
Résultat void
Exemple #1
0
        void AddItem(ActionMenuItem aitem, int pos)
        {
            Gtk.Table t = new Gtk.Table(1, 3, false);
            aitem.Attach(t, 0, 0);
            aitem.KeyPressEvent += OnItemKeyPress;
            t.ShowAll();

            CustomMenuBarItem it = new CustomMenuBarItem();

            it.ActionMenuItem = aitem;
            aitem.Bind(it);
            it.Child = t;
            it.ShowAll();
            Insert(it, pos);
        }
        void Fill()
        {
            menuItems.Clear();

            uint           n        = 0;
            ActionMenuItem editItem = null;

            if (nodes.Count > 0)
            {
                foreach (ActionTreeNode node in nodes)
                {
                    ActionMenuItem item = new ActionMenuItem(wrapper, this, node);
                    item.KeyPressEvent += OnItemKeyPress;
                    item.Attach(table, n++, 0);
                    menuItems.Add(item);
                    // If adding an action with an empty name, select and start editing it
//					if (node.Action != null && node.Action.Name.Length == 0)
//						editItem = item;
                }
            }

            emptyLabel = new Gtk.EventBox();
            emptyLabel.VisibleWindow = false;
            Gtk.Label label = new Gtk.Label();
            label.Xalign = 0;
            label.Markup = "<i><span foreground='darkgrey'>" + Catalog.GetString("Click to create action") + "</span></i>";
            emptyLabel.Add(label);
            emptyLabel.ButtonPressEvent += OnAddClicked;
            table.Attach(emptyLabel, 1, 2, n, n + 1);

            ShowAll();

            if (editItem != null)
            {
                // If there is an item with an empty action, it means that it was an item that was
                // being edited. Restart the editing now.
                GLib.Timeout.Add(200, delegate
                {
                    editItem.Select();
                    editItem.EditingDone += OnEditingDone;
                    editItem.StartEditing();
                    return(false);
                });
            }
        }
        ActionMenuItem InsertAction(Wrapper.Action action, int n)
        {
            uint row = (uint)n / columns;
            uint col = (uint)(n % columns) * 3;

            IDesignArea    designArea = GetDesignArea();
            ActionTreeNode node       = new ActionTreeNode(Gtk.UIManagerItemType.Menuitem, "", action);
            ActionMenuItem aitem      = new ActionMenuItem(designArea, project, this, node);

            aitem.KeyPressEvent += OnItemKeyPress;
            aitem.MinWidth       = 150;
            aitem.Attach(table, row, col);

            Gtk.Frame fr = new Gtk.Frame();
            fr.Shadow = Gtk.ShadowType.Out;
            aitem.Add(fr);

            items.Add(aitem);
            return(aitem);
        }
Exemple #4
0
        void AddItem(ActionMenuItem aitem, int pos)
        {
            Gtk.Table t = new Gtk.Table (1, 3, false);
            aitem.Attach (t, 0, 0);
            aitem.KeyPressEvent += OnItemKeyPress;
            t.ShowAll ();

            CustomMenuBarItem it = new CustomMenuBarItem ();
            it.ActionMenuItem = aitem;
            aitem.Bind (it);
            it.Child = t;
            it.ShowAll ();
            Insert (it, pos);
        }
		void Fill ()
		{
			menuItems.Clear ();

			uint n = 0;
			ActionMenuItem editItem = null;
			
			if (nodes.Count > 0) {
				foreach (ActionTreeNode node in nodes) {
					ActionMenuItem item = new ActionMenuItem (wrapper, this, node);
					item.KeyPressEvent += OnItemKeyPress;
					item.Attach (table, n++, 0);
					menuItems.Add (item);
					// If adding an action with an empty name, select and start editing it
//					if (node.Action != null && node.Action.Name.Length == 0)
//						editItem = item;
				}
			}
			
			emptyLabel = new Gtk.EventBox ();
			emptyLabel.VisibleWindow = false;
			Gtk.Label label = new Gtk.Label ();
			label.Xalign = 0;
			label.Markup = "<i><span foreground='darkgrey'>" + Catalog.GetString ("Click to create action") + "</span></i>";
			emptyLabel.Add (label);
			emptyLabel.ButtonPressEvent += OnAddClicked;
			table.Attach (emptyLabel, 1, 2, n, n + 1);
			
			ShowAll ();
			
			if (editItem != null) {
				// If there is an item with an empty action, it means that it was an item that was
				// being edited. Restart the editing now.
				GLib.Timeout.Add (200, delegate {
					editItem.Select ();
					editItem.EditingDone += OnEditingDone;
					editItem.StartEditing ();
					return false;
				});
			}
		}
Exemple #6
0
        ActionMenuItem InsertAction(Wrapper.Action action, int n)
        {
            uint row = (uint) n / columns;
            uint col = (uint) (n % columns) * 3;

            IDesignArea designArea = GetDesignArea ();
            ActionTreeNode node = new ActionTreeNode (Gtk.UIManagerItemType.Menuitem, "", action);
            ActionMenuItem aitem = new ActionMenuItem (designArea, project, this, node);
            aitem.KeyPressEvent += OnItemKeyPress;
            aitem.MinWidth = 150;
            aitem.Attach (table, row, col);

            Gtk.Frame fr = new Gtk.Frame ();
            fr.Shadow = Gtk.ShadowType.Out;
            aitem.Add (fr);

            items.Add (aitem);
            return aitem;
        }