예제 #1
0
파일: ButtonAction.cs 프로젝트: pcdummy/Eto
 public ToolBarConnector(ButtonAction action, ToolBarButton toolBarButton)
 {
     this.toolBarButton        = toolBarButton;
     this.toolBarButton.Click += toolBarButton_Click;
     this.action = action;
     this.action.EnabledChanged += new EventHandler <EventArgs>(action_EnabledChanged).MakeWeak(e => this.action.EnabledChanged -= e);
 }
예제 #2
0
파일: ButtonAction.cs 프로젝트: pcdummy/Eto
        public static ButtonAction AddButton(this ActionCollection actions, string id, string text, EventHandler <EventArgs> activated)
        {
            ButtonAction action = new ButtonAction(id, text, activated);

            actions.Add(action);
            return(action);
        }
예제 #3
0
파일: ButtonAction.cs 프로젝트: M1C/Eto
 public ToolBarConnector(ButtonAction action, ToolBarButton toolBarButton)
 {
     this.toolBarButton = toolBarButton;
     this.toolBarButton.Click += toolBarButton_Click;
     this.action = action;
     this.action.EnabledChanged += new EventHandler<EventArgs>(action_EnabledChanged).MakeWeak(e => this.action.EnabledChanged -= e);
 }
예제 #4
0
 public MenuConnector(ButtonAction action, ImageMenuItem menuItem)
 {
     this.action = action;
     this.menuItem = menuItem;
     this.menuItem.Click += menuItem_Clicked;
     this.action.EnabledChanged += new EventHandler<EventArgs>(action_EnabledChanged).MakeWeak((e) => this.action.EnabledChanged -= e);
 }
예제 #5
0
 public MenuConnector(ButtonAction action, ButtonMenuItem menuItem)
 {
     this.action             = action;
     this.menuItem           = menuItem;
     this.menuItem.Click    += HandleClick;
     this.menuItem.Validate += HandleValidate;
 }
예제 #6
0
파일: Application.cs 프로젝트: sami1971/Eto
        public void GetSystemActions(GenerateActionArgs args, bool addStandardItems = false)
        {
            // map new commands/menus back to actions for backwards compatibility
            var commands = GetSystemCommands().ToArray();

            foreach (var command in commands)
            {
                var currentCommand = command;
                var action         = new ButtonAction
                {
                    ID          = currentCommand.ID,
                    MenuText    = currentCommand.MenuText,
                    ToolBarText = currentCommand.ToolBarText,
                    TooltipText = currentCommand.ToolTip,
                    Accelerator = currentCommand.Shortcut,
                    command     = currentCommand
                };
                currentCommand.Executed += (sender, e) => action.Activate();
                action.EnabledChanged   += (sender, e) => currentCommand.Enabled = action.Enabled;
                args.Actions.Add(action);
            }
                        #if DESKTOP
            if (addStandardItems)
            {
                var menu = new MenuBar(Generator);
                CreateStandardMenu(menu.Items, commands);
                args.Menu.ExtractMenu(menu);
            }
                        #endif
        }
예제 #7
0
		public static ButtonAction AddButton(this ActionCollection actions, string id, string text, EventHandler<EventArgs> activated, params Key[] accelerators)
		{
			ButtonAction action = new ButtonAction(id, text, activated);
			action.Accelerators = accelerators;
			actions.Add(action);
			return action;
		}
예제 #8
0
파일: ButtonAction.cs 프로젝트: pcdummy/Eto
        public static ButtonAction AddButton(this ActionCollection actions, string id, string text)
        {
            ButtonAction action = new ButtonAction(id, text);

            actions.Add(action);
            return(action);
        }
예제 #9
0
			public MenuConnector(ButtonAction action, ImageMenuItem menuItem)
			{
				this.action = action;
				this.menuItem = menuItem;
				this.menuItem.Click += HandleClick;
				this.menuItem.Validate += HandleValidate;
			}
예제 #10
0
파일: ButtonAction.cs 프로젝트: pcdummy/Eto
        public static ButtonAction AddButton(this ActionCollection actions, string id, string text, EventHandler <EventArgs> activated, params Key[] accelerators)
        {
            ButtonAction action = new ButtonAction(id, text, activated);

            action.Accelerators = accelerators;
            actions.Add(action);
            return(action);
        }
예제 #11
0
		public static ButtonAction AddButton(this ActionCollection actions, string id, string text, string iconResource, EventHandler<EventArgs> activated)
		{
			Icon icon = null;
			if (!string.IsNullOrEmpty(iconResource)) icon = Icon.FromResource (Assembly.GetCallingAssembly (), iconResource);
			ButtonAction action = new ButtonAction(id, text, icon, activated);
			actions.Add(action);
			return action;
		}
예제 #12
0
		public static ButtonAction AddButton(this ActionCollection actions, string id, string text, string iconResource, EventHandler<EventArgs> activated, params Key[] accelerators)
		{
			Icon icon = null;
			if (iconResource != string.Empty) icon = Icon.FromResource (Assembly.GetCallingAssembly (), iconResource);
			ButtonAction action = new ButtonAction(id, text, icon, activated);
			action.Accelerators = accelerators;
			actions.Add(action);
			return action;
		}
예제 #13
0
파일: ButtonAction.cs 프로젝트: Exe0/Eto
		public static ButtonAction AddButton(this ActionCollection actions, string id, string text, string iconResource, EventHandler<EventArgs> activated)
		{
#if WINRT
			throw new NotImplementedException("WinRT does not support Assembly.GetCallingAssembly");
#else
			Icon icon = null;
			if (!string.IsNullOrEmpty(iconResource)) icon = Icon.FromResource (Assembly.GetCallingAssembly (), iconResource);
			var action = new ButtonAction(id, text, icon, activated);
			actions.Add(action);
			return action;
#endif
		}
예제 #14
0
파일: ButtonAction.cs 프로젝트: pcdummy/Eto
        public static ButtonAction AddButton(this ActionCollection actions, string id, string text, string iconResource, EventHandler <EventArgs> activated)
        {
            Icon icon = null;

            if (!string.IsNullOrEmpty(iconResource))
            {
                icon = Icon.FromResource(Assembly.GetCallingAssembly(), iconResource);
            }
            ButtonAction action = new ButtonAction(id, text, icon, activated);

            actions.Add(action);
            return(action);
        }
예제 #15
0
        public static ButtonAction AddButton(this ActionCollection actions, string id, string text, string iconResource, EventHandler <EventArgs> activated, params Key[] accelerators)
        {
            Icon icon = null;

            if (iconResource != string.Empty)
            {
                icon = Icon.FromResource(Assembly.GetCallingAssembly(), iconResource);
            }
            ButtonAction action = new ButtonAction(id, text, icon, activated);

            action.Accelerators = accelerators;
            actions.Add(action);
            return(action);
        }
예제 #16
0
        public static ButtonAction AddButton(this ActionCollection actions, string id, string text, string iconResource, EventHandler <EventArgs> activated)
        {
#if WINRT
            throw new NotImplementedException("WinRT does not support Assembly.GetCallingAssembly");
#else
            Icon icon = null;
            if (!string.IsNullOrEmpty(iconResource))
            {
                icon = Icon.FromResource(Assembly.GetCallingAssembly(), iconResource);
            }
            var action = new ButtonAction(id, text, icon, activated);
            actions.Add(action);
            return(action);
#endif
        }
예제 #17
0
파일: Main.cs 프로젝트: JohnACarruthers/Eto
		void GenerateActions()
		{
			var actions = new GenerateActionArgs(this);
			Application.Instance.GetSystemActions(actions, true);

			var quitAction = new ButtonAction { Text = "Quit", Accelerator = Application.Instance.CommonModifier | Key.Q };
			quitAction.Activated += (sender, e) => Application.Instance.Quit();
				
			// add action to file sub-menu
			var file = actions.Menu.FindAddSubMenu("&File");
			file.Actions.Add(quitAction);

			// generate menu
			this.Menu = actions.Menu.GenerateMenuBar();
		}
예제 #18
0
파일: Application.cs 프로젝트: Exe0/Eto
		public void GetSystemActions(GenerateActionArgs args, bool addStandardItems = false)
		{
			// map new commands/menus back to actions for backwards compatibility
			var commands = GetSystemCommands().ToArray();
			foreach (var command in commands)
			{
				var currentCommand = command;
				var action = new ButtonAction
				{
					ID = currentCommand.ID,
					MenuText = currentCommand.MenuText,
					ToolBarText = currentCommand.ToolBarText,
					TooltipText = currentCommand.ToolTip,
					Accelerator = currentCommand.Shortcut,
					command = currentCommand
				};
				currentCommand.Executed += (sender, e) => action.Activate();
				action.EnabledChanged += (sender, e) => currentCommand.Enabled = action.Enabled;
				args.Actions.Add(action);
			}
			#if DESKTOP
			if (addStandardItems)
			{
				var menu = new MenuBar(Generator);
				CreateStandardMenu(menu.Items, commands);
				args.Menu.ExtractMenu(menu);
			}
			#endif
		}
예제 #19
0
		public static ButtonAction AddButton(this ActionCollection actions, string id, string text, EventHandler<EventArgs> activated)
		{
			ButtonAction action = new ButtonAction(id, text, activated);
			actions.Add(action);
			return action;
		}
예제 #20
0
		public static ButtonAction AddButton(this ActionCollection actions, string id, string text)
		{
			ButtonAction action = new ButtonAction(id, text);
			actions.Add(action);
			return action;
		}