当前位置: 首页>>代码示例>>C#>>正文


C# Action.ConnectProxy方法代码示例

本文整理汇总了C#中Gtk.Action.ConnectProxy方法的典型用法代码示例。如果您正苦于以下问题:C# Action.ConnectProxy方法的具体用法?C# Action.ConnectProxy怎么用?C# Action.ConnectProxy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Gtk.Action的用法示例。


在下文中一共展示了Action.ConnectProxy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ActionMenuItem

        /// <summary>
        /// Initializes a new instance of the <see cref="ActionMenuItem"/> class.
        /// </summary>
        /// <param name="manager">The manager.</param>
        /// <param name="action">The action.</param>
        public ActionMenuItem(
			ActionManager manager,
			Action action)
        {
            // Saves the properties.
            if (manager == null)
            {
                throw new ArgumentNullException("manager");
            }

            if (action == null)
            {
                throw new ArgumentNullException("action");
            }

            // Attach to the action.
            this.action = action;

            action.ConnectProxy(this);

            // The default menu can't handle the chained accelerators, so we
            // remove the contents of the menu item and recreate it using a
            // HBox with a custom label for both.
            var newChild = new HBox(false, 0);

            displayLabel = new Label(action.Label);
            displayLabel.UseUnderline = true;
            displayLabel.Xalign = 0.0f;
            displayLabel.Show();

            newChild.PackStart(displayLabel);

            // Get the keybinding label.
            HierarchicalPath acceleratorPath = manager.GetPrimaryAcceleratorPath(action);

            if (acceleratorPath != null)
            {
                // Get a formatted version of the accelerator path.
                string display = ActionKeybindings.FormatAcceleratorPath(acceleratorPath);
                keybindingLabel = new Label(display);
                keybindingLabel.UseUnderline = false;
                keybindingLabel.Xalign = 1.0f;
                keybindingLabel.Show();

                newChild.PackStart(keybindingLabel);
            }

            // Lay out the contents in the HBox.
            newChild.Show();

            // Remove the old child item and add this.
            Remove(Child);
            Add(newChild);

            // Figure out if we have an icon.
            if (!String.IsNullOrEmpty(action.StockId))
            {
                IconSet iconSet = Style.LookupIconSet(action.StockId);
                Pixbuf image = iconSet.RenderIcon(
                    Style, DefaultDirection, State, IconSize.Menu, this, null);
                var iconImage = new Image(image);

                Image = iconImage;
            }
        }
开发者ID:dmoonfire,项目名称:mfgames-gtkext-cil,代码行数:70,代码来源:ActionMenuItem.cs

示例2: connectActions

        private void connectActions()
        {
            openaction = basicactions.GetAction("OpenAction");
            openaction.Activated += OnOpenAction;
            quitaction = basicactions.GetAction("QuitAction");
            quitaction.Activated += OnQuitAction;
            newaction = basicactions.GetAction("NewAction");
            newaction.Activated += OnNewAction;
            playaction = basicactions.GetAction("PlayAction");
            playaction.Activated += OnPlayAction;
            pauseaction = basicactions.GetAction("PauseAction");
            pauseaction.Activated += OnPauseAction;

            openaction.ConnectProxy(openbutton);
            newaction.ConnectProxy(newbutton);
            playaction.ConnectProxy(playbutton);
            pauseaction.ConnectProxy(pausebutton);
        }
开发者ID:mcbodge,项目名称:robowarx,代码行数:18,代码来源:MainWindow.cs


注:本文中的Gtk.Action.ConnectProxy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。