Example #1
0
        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
        }
Example #2
0
		public void CopyArguments(GenerateActionArgs args)
		{
			foreach (var de in args.arguments)
			{
				arguments[de.Key] = de.Value;
			}
		}
Example #3
0
 public void CopyArguments(GenerateActionArgs args)
 {
     foreach (DictionaryEntry de in args.arguments)
     {
         arguments[de.Key] = de.Value;
     }
 }
Example #4
0
        private void GenerateMenu(GenerateActionArgs args)
        {
            var main = args.Menu.FindAddSubMenu(this.Text, 0);
            var file = args.Menu.FindAddSubMenu("&File", 0);
            var edit = args.Menu.FindAddSubMenu("&Edit", 0);
            var window = args.Menu.FindAddSubMenu("&Window", 1000);
            var help = args.Menu.FindAddSubMenu("Help", 1000);

            if (Generator.ID == "mac")
            {
                main.Actions.Add(Actions.About.ActionID);
                main.Actions.AddSeparator();
                main.Actions.Add(Actions.Preferences.ActionID);
                main.Actions.AddSeparator();
                main.Actions.Add("mac_hide");
                main.Actions.Add("mac_hideothers");
                main.Actions.Add("mac_showall");
                main.Actions.AddSeparator();
                main.Actions.Add(Actions.Quit.ActionID);

                edit.Actions.Add("mac_undo");
                edit.Actions.Add("mac_redo");
                edit.Actions.AddSeparator();
                edit.Actions.Add("mac_cut");
                edit.Actions.Add("mac_copy");
                edit.Actions.Add("mac_paste");
                edit.Actions.Add("mac_delete");
                edit.Actions.AddSeparator();
                edit.Actions.Add("mac_selectAll");

                file.Actions.Add(Actions.Save.ActionID);
                file.Actions.Add(Actions.New.ActionID);
                file.Actions.Add(Actions.Delete.ActionID);
                file.Actions.Add(Actions.Rename.ActionID);

                window.Actions.Add("mac_performMiniaturize");
                window.Actions.Add("mac_performZoom");
            }
            else
            {
                file.Actions.Add(Actions.Preferences.ActionID);
                file.Actions.AddSeparator();
                file.Actions.Add(Actions.Save.ActionID);
                file.Actions.Add(Actions.New.ActionID);
                file.Actions.Add(Actions.Delete.ActionID);
                file.Actions.Add(Actions.Rename.ActionID);
                file.Actions.AddSeparator();
                file.Actions.Add(Actions.Quit.ActionID);

                help.Actions.Add(Actions.About.ActionID);
            }

            this.Menu = args.Menu.GenerateMenuBar();
        }
Example #5
0
        void CreateActions()
        {
            var args = new GenerateActionArgs();
            
            Application.Instance.GetSystemActions(args, true);
            
            //top.GetActions(args);
            
            args.Actions.Add(new Actions.AddServer { AutoConnect = true });
            args.Actions.Add(new Actions.EditServer(top.Channels));
            args.Actions.Add(new Actions.RemoveServer(top.Channels, config));
            args.Actions.Add(new Actions.ServerConnect(top.Channels));
            args.Actions.Add(new Actions.ServerDisconnect(top.Channels));
            args.Actions.Add(new Actions.ChannelList(top.Channels));
            args.Actions.Add(new Actions.Quit());
            args.Actions.Add(new Actions.About());
            args.Actions.Add(new Actions.ShowPreferences(config));
            
            var file = args.Menu.FindAddSubMenu("&File", 100);
            var help = args.Menu.FindAddSubMenu("&Help", 900);
            var server = args.Menu.FindAddSubMenu("&Server", 500);
            var view = args.Menu.FindAddSubMenu("&View", 500);
            

            server.Actions.Add(Actions.ServerConnect.ActionID);
            server.Actions.Add(Actions.ServerDisconnect.ActionID);
            server.Actions.AddSeparator();
            server.Actions.Add(Actions.AddServer.ActionID);
            server.Actions.Add(Actions.EditServer.ActionID);
            server.Actions.Add(Actions.RemoveServer.ActionID);
            server.Actions.AddSeparator();
            server.Actions.Add(Actions.ChannelList.ActionID);
            
            if (Generator.IsMac)
            {
                var application = args.Menu.FindAddSubMenu(Application.Instance.Name, 100);
                application.Actions.Add(Actions.About.ActionID, 100);
#if DEBUG
                // TODO: not yet implemented!
                application.Actions.Add (Actions.ShowPreferences.ActionID);
#endif
                application.Actions.Add(Actions.Quit.ActionID, 900);
            }
            else
            {
                file.Actions.Add(Actions.Quit.ActionID, 900);
                view.Actions.Add(Actions.ShowPreferences.ActionID);
                help.Actions.Add(Actions.About.ActionID, 100);
            }
            
            top.CreateActions(args);
            
            this.Menu = args.Menu.GenerateMenuBar();
        }
Example #6
0
		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();
		}
Example #7
0
        private void GenerateActions()
        {
            // generate action args
            GenerateActionArgs args = new GenerateActionArgs();
            Application.Instance.GetSystemActions(args);
            args.Actions.Add(new Actions.About());
            args.Actions.Add(new Actions.Quit());
            args.Actions.Add(new Actions.Close());
            args.Actions.Add(new Actions.New());
            args.Actions.Add(new Actions.Save());
            args.Actions.Add(new Actions.Delete());
            args.Actions.Add(new Actions.Preferences());
            args.Actions.Add(new Actions.Rename());

            // generate menu and toolbar
            GenerateMenu(args);
            GenerateToolBar(args);
        }
Example #8
0
		void GenerateActions()
		{
			var actions = new GenerateActionArgs(this);

			Application.Instance.GetSystemActions(actions, true);

			var myAction = new MyAction();
				
			// add action to file sub-menu
			var file = actions.Menu.FindAddSubMenu("&File");
			file.Actions.Add(myAction);

			// add action to toolbar
			actions.ToolBar.Add(myAction);

			// generate menu & toolbar
			this.Menu = actions.Menu.GenerateMenuBar();
			this.ToolBar = actions.ToolBar.GenerateToolBar();
		}
Example #9
0
		void GenerateActions ()
		{
			var actions = new GenerateActionArgs(this);
				
			// define action
			actions.Actions.Add (new MyAction());

			// add action to toolbar
			actions.ToolBar.Add (MyAction.ActionID);
			
			// add action to file sub-menu
			var file = actions.Menu.FindAddSubMenu ("&File");
			file.Actions.Add (MyAction.ActionID);
			
			// generate menu & toolbar

			this.Menu = actions.Menu.GenerateMenuBar ();
			
			this.ToolBar = actions.ToolBar.GenerateToolBar ();
		}
Example #10
0
 public void Merge(GenerateActionArgs args)
 {
     toolBar.Merge(args.toolBar);
     menu.Merge(args.Menu);
 }
Example #11
0
File: MainForm.cs Project: M1C/Eto
 void GenerateToolBar(GenerateActionArgs args)
 {
     args.ToolBar.Add (Actions.Quit.ActionID);
     args.ToolBar.Add (Actions.About.ActionID);
     this.ToolBar = args.ToolBar.GenerateToolBar ();
 }
Example #12
0
		public void CreateActions (GenerateActionArgs args)
		{
			args.Actions.Add (new Actions.NextChannel (this));
			args.Actions.Add (new Actions.NextUnreadChannel (this));
			args.Actions.Add (new Actions.PrevChannel (this));
			args.Actions.Add (new Actions.PrevUnreadChannel (this));
			args.Actions.Add (new Actions.LeaveChannel (this));
			
			var channel = args.Menu.FindAddSubMenu ("&Channel", 800);
			
			channel.Actions.Add (Actions.NextChannel.ActionID);
			channel.Actions.Add (Actions.NextUnreadChannel.ActionID);
			channel.Actions.Add (Actions.PrevChannel.ActionID);
			channel.Actions.Add (Actions.PrevUnreadChannel.ActionID);
			channel.Actions.AddSeparator ();
			
			channel.Actions.Add (Actions.LeaveChannel.ActionID);
		}
Example #13
0
File: MainForm.cs Project: M1C/Eto
        void GenerateMenu(GenerateActionArgs args)
        {
            var file = args.Menu.FindAddSubMenu ("&File", 100);
            var edit = args.Menu.FindAddSubMenu ("&Edit", 200);
            var window = args.Menu.FindAddSubMenu ("&Window", 900);
            var help = args.Menu.FindAddSubMenu ("Help", 1000);

            if (Generator.ID == "mac") {
                // have a nice OS X style menu

                var main = args.Menu.FindAddSubMenu ("Test Application", 0);
                main.Actions.Add (Actions.About.ActionID, 0);
                main.Actions.AddSeparator ();
                main.Actions.Add ("mac_hide", 700);
                main.Actions.Add ("mac_hideothers", 700);
                main.Actions.Add ("mac_showall", 700);
                main.Actions.AddSeparator (900);
                main.Actions.Add (Actions.Quit.ActionID, 1000);

                file.Actions.Add ("mac_performClose", 900);

                edit.Actions.Add ("mac_undo", 100);
                edit.Actions.Add ("mac_redo", 100);
                edit.Actions.AddSeparator (200);
                edit.Actions.Add ("mac_cut", 200);
                edit.Actions.Add ("mac_copy", 200);
                edit.Actions.Add ("mac_paste", 200);
                edit.Actions.Add ("mac_delete", 200);
                edit.Actions.Add ("mac_selectAll", 200);

                window.Actions.Add ("mac_performMiniaturize");
                window.Actions.Add ("mac_performZoom");
            }
            else {
                // windows/gtk style window
                file.Actions.Add (Actions.Quit.ActionID);

                help.Actions.Add (Actions.About.ActionID);
            }

            this.Menu = args.Menu.GenerateMenuBar ();
        }
Example #14
0
		public virtual void GetSystemActions(GenerateActionArgs args, bool addStandardItems = false)
		{
			Handler.GetSystemActions(args, addStandardItems);
		}
Example #15
0
 public void CreateActions(GenerateActionArgs args)
 {
     Channels.CreateActions(args);
 }
Example #16
0
        private void GenerateToolBar(GenerateActionArgs args)
        {
            args.ToolBar.Add(Actions.New.ActionID);
            args.ToolBar.Add(Actions.Delete.ActionID);
            args.ToolBar.Add(Actions.Rename.ActionID);
            //args.ToolBar.AddFlexibleSpace();
            //args.ToolBar.Add(Actions.Preferences.ActionID);
            //args.ToolBar.Add(Actions.About.ActionID);

            this.ToolBar = args.ToolBar.GenerateToolBar();
            this.ToolBar.Style = "ToolBar";
        }
Example #17
0
		public void Merge(GenerateActionArgs args)
		{
			toolBar.Merge(args.toolBar);
			menu.Merge(args.Menu);
		}
Example #18
0
 public virtual void GetSystemActions(GenerateActionArgs args, bool addStandardItems = false)
 {
     Handler.GetSystemActions(args, addStandardItems);
 }
Example #19
0
		void GenerateMenuToolBarActions()
		{
			// use actions to generate menu & toolbar to share logic
			var args = new GenerateActionArgs();

			// generate actions to use in menus and toolbars
			Application.Instance.GetSystemActions(args, true);

			args.Actions.Add(new Actions.About());
			args.Actions.Add(new Actions.Quit());
			args.Actions.Add(new Actions.Close());


			// generate and set the menu
			GenerateMenu(args);

			// generate and set the toolbar
			GenerateToolBar(args);
		}
Example #20
0
		public virtual void GetSystemActions(GenerateActionArgs args)
		{
			inner.GetSystemActions(args);
		}
Example #21
0
		void GenerateMenu(GenerateActionArgs args)
		{
			var file = args.Menu.GetSubmenu("&File", 100);
			args.Menu.GetSubmenu("&Edit", 200);
			args.Menu.GetSubmenu("&Window", 900);
			var help = args.Menu.GetSubmenu("&Help", 1000);

			if (Generator.IsMac)
			{
				// have a nice OS X style menu

				var main = args.Menu.GetSubmenu(Application.Instance.Name, 0);
				main.Actions.Add(Actions.About.ActionID, 0);
				main.Actions.Add(Actions.Quit.ActionID, 1000);
			}
			else
			{
				// windows/gtk style window
				file.Actions.Add(Actions.Quit.ActionID);

				help.Actions.Add(Actions.About.ActionID);
			}

#if DESKTOP
			this.Menu = args.Menu.GenerateMenuBar();
#endif
		}
Example #22
0
		void GenerateToolBar(GenerateActionArgs args)
		{
			args.ToolBar.Add(Actions.Quit.ActionID);
			args.ToolBar.Add(Actions.About.ActionID);
#if DESKTOP
			// TODO for mobile
			this.ToolBar = args.ToolBar.GenerateToolBar();
#endif
		}
Example #23
0
		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
		}