Esempio n. 1
0
		public MenuSamples ()
		{
			Label la = new Label ("Right click here to show the context menu");
			menu = new Menu ();
			menu.Items.Add (new MenuItem ("One"));
			menu.Items.Add (new MenuItem ("Two"));
			menu.Items.Add (new MenuItem ("Three"));
			menu.Items.Add (new SeparatorMenuItem ());

			var rgroup = new RadioButtonMenuItemGroup ();
			menu.Items.Add (new RadioButtonMenuItem ("Opt 1") { Group = rgroup, Sensitive = false });
			menu.Items.Add (new RadioButtonMenuItem ("Opt 2") { Group = rgroup, Checked = true });
			menu.Items.Add (new RadioButtonMenuItem ("Opt 3") { Group = rgroup });

			menu.Items.Add (new SeparatorMenuItem ());

			menu.Items.Add (new CheckBoxMenuItem ("Check 1"));
			menu.Items.Add (new CheckBoxMenuItem ("Check 2") { Checked = true });

			menu.Items.Add (new SeparatorMenuItem ());

			var subMenu = new MenuItem ("Submenu");
			subMenu.SubMenu = new Menu ();
			var subZoomIn = new MenuItem (new Command ("Zoom+", StockIcons.ZoomIn));
			var subZoomOut = new MenuItem (new Command ("Zoom-", StockIcons.ZoomOut));
			subMenu.SubMenu.Items.Add (subZoomIn);
			subMenu.SubMenu.Items.Add (subZoomOut);
			menu.Items.Add (subMenu);

			subZoomIn.Clicked += (sender, e) => MessageDialog.ShowMessage ("'Zoom+' item clicked.");
			subZoomOut.Clicked += (sender, e) => MessageDialog.ShowMessage ("'Zoom-' item clicked.");

			la.ButtonPressed += HandleButtonPressed;
			PackStart (la);
		}
Esempio n. 2
0
        private Menu CreateMenu()
        {
            Menu m = new Menu();
            MenuItem file = new MenuItem("File");
            Menu fileSubMenu = new Menu();

            MenuItem open = new MenuItem("Open");
            open.Clicked += open_Clicked;
            fileSubMenu.Items.Add(open);

            MenuItem saveas = new MenuItem("Save As");
            saveas.Clicked += saveas_Clicked;
            fileSubMenu.Items.Add(saveas);


            MenuItem exit = new MenuItem("Exit");
            exit.Clicked += exit_Clicked;
            fileSubMenu.Items.Add(exit);


            file.SubMenu = fileSubMenu;
            m.Items.Add(file);

            return m;
        }
Esempio n. 3
0
        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        public MainWindow()
        {
            Title = "Xwt Demo Application";
              Width = 500;
              Height = 400;

              // Create a simple File Menu with Exit button

              Xwt.Menu menu = new Xwt.Menu();

              Xwt.MenuItem file = new Xwt.MenuItem("_File");
              file.SubMenu = new Xwt.Menu();
              file.SubMenu.Items.Add(new Xwt.MenuItem("_Open"));
              file.SubMenu.Items.Add(new Xwt.MenuItem("_New"));
              Xwt.MenuItem mi = new Xwt.MenuItem("_Close");
              mi.Clicked += delegate
              {
            Application.Exit();
              };

              file.SubMenu.Items.Add(mi);
              menu.Items.Add(file);

              Xwt.MenuItem edit = new Xwt.MenuItem("_Edit");
              edit.SubMenu = new Xwt.Menu();
              edit.SubMenu.Items.Add(new Xwt.MenuItem("_Copy"));
              edit.SubMenu.Items.Add(new Xwt.MenuItem("Cu_t"));
              edit.SubMenu.Items.Add(new Xwt.MenuItem("_Paste"));
              menu.Items.Add(edit);

              MainMenu = menu;

              CloseRequested += Form_Close;
        }
Esempio n. 4
0
		VBox GenerateFrameContents (bool useMnemonics)
		{
			var statusText = useMnemonics ? "with mnemonic" : "without mnemonic";
			var vbox = new VBox ();

			var button = new Button ("_Button");
			button.UseMnemonic = useMnemonics;
			button.Clicked += (sender, e) => MessageDialog.ShowMessage (string.Format ("Button {0} clicked.", statusText));
			vbox.PackStart (button);

			var toggleButton = new ToggleButton ("_Toggle Button");
			toggleButton.UseMnemonic = useMnemonics;
			toggleButton.Clicked += (sender, e) => MessageDialog.ShowMessage (string.Format ("Toggle Button {0} clicked.", statusText));
			vbox.PackStart (toggleButton);

			var menuButton = new MenuButton ("_Menu Button");
			menuButton.UseMnemonic = useMnemonics;
			menuButton.Label = "_Menu Button";
			var firstMenuItem = new MenuItem ("_First");
			firstMenuItem.UseMnemonic = useMnemonics;
			firstMenuItem.Clicked += (sender, e) => MessageDialog.ShowMessage (string.Format ("First Menu Item {0} clicked.", statusText));
			var secondMenuItem = new MenuItem ("_Second");
			secondMenuItem.UseMnemonic = useMnemonics;
			secondMenuItem.Clicked += (sender, e) => MessageDialog.ShowMessage (string.Format ("Second Menu Item {0} clicked.", statusText));
			var menu = new Menu ();
			menu.Items.Add (firstMenuItem);
			menu.Items.Add (secondMenuItem);
			menuButton.Menu = menu;
			vbox.PackStart (menuButton);

			return vbox;
		}
Esempio n. 5
0
        public MainWindow()
        {
            Menu menu = new Menu ();

            var file = new MenuItem ("File");
            file.SubMenu = new Menu ();
            file.SubMenu.Items.Add (new MenuItem ("Open"));
            file.SubMenu.Items.Add (new MenuItem ("New"));
            file.SubMenu.Items.Add (new MenuItem ("Close"));
            menu.Items.Add (file);

            var edit = new MenuItem ("Edit");
            edit.SubMenu = new Menu ();
            edit.SubMenu.Items.Add (new MenuItem ("Copy"));
            edit.SubMenu.Items.Add (new MenuItem ("Cut"));
            edit.SubMenu.Items.Add (new MenuItem ("Paste"));
            menu.Items.Add (edit);

            MainMenu = menu;

            HBox box = new HBox ();

            icon = Image.FromResource (typeof(App), "class.png");

            store = new TreeStore (nameCol, iconCol, widgetCol);
            samplesTree = new TreeView ();
            samplesTree.Columns.Add ("Name", iconCol, nameCol);

            AddSample (null, "Boxes", typeof(Boxes));
            AddSample (null, "Buttons", typeof(ButtonSample));
            AddSample (null, "ComboBox", typeof(ComboBoxes));
            //			AddSample (null, "Designer", typeof(Designer));
            AddSample (null, "Drag & Drop", typeof(DragDrop));
            var n = AddSample (null, "Drawing", null);
            AddSample (n, "Canvas with Widget", typeof(CanvasWithWidget));
            AddSample (n, "Chart", typeof(ChartSample));
            AddSample (n, "Transformations", typeof(DrawingTransforms));
            AddSample (null, "Images", typeof(Images));
            AddSample (null, "List View", typeof(ListView1));
            AddSample (null, "Notebook", typeof(NotebookSample));
            //			AddSample (null, "Scroll View", typeof(ScrollWindowSample));
            AddSample (null, "Text Entry", typeof(TextEntries));
            AddSample (null, "Windows", typeof(Windows));

            samplesTree.DataSource = store;

            box.PackStart (samplesTree);

            sampleBox = new VBox ();
            title = new Label ("Sample:");
            sampleBox.PackStart (title, BoxMode.None);

            box.PackStart (sampleBox, BoxMode.FillAndExpand);

            Content = box;

            samplesTree.SelectionChanged += HandleSamplesTreeSelectionChanged;
        }
Esempio n. 6
0
 static MenuItem CreateFileMenu()
 {
     var file = new MenuItem ("_File");
     file.SubMenu = new Menu ();
     var mi = new MenuItem ("_Close");
     file.SubMenu.Items.Add (mi);
     mi.Clicked += (s, e) => Application.Exit ();
     return file;
 }
Esempio n. 7
0
        static void Main(string[] args)
        {
            string dataFolderPath = Directory.GetCurrentDirectory();
            string database = String.Format("{0}\\data.db", dataFolderPath);
            dataSource = "data source=" + database;
            tableName = "product";

            tableName = "product";

            PlotHelper.createTable(dataSource,tableName);
            PlotHelper.TestConnection(dataSource);

            // TODO: add Xwt.WPF.dll to vendor directory
            Application.Initialize(ToolkitType.Gtk);
            Window MainWindow = new Window()
            {
                Title = "Xwt Demo Application",
                Width = 500,
                Height = 400
            };
            MainWindow.CloseRequested += (o, e) =>
            {
                Application.Exit();
            };
            Menu MainMenu = new Menu();
            RichTextView TextView = new RichTextView();
            MenuItem FileOpenMenuItem = new MenuItem("???????");
            Menu FileMenu = new Menu();
            FileOpenMenuItem.Clicked += (o, e) =>
            {
                OpenFileDialog Dialog = new OpenFileDialog("??????? ????");
                if (Dialog.Run(MainWindow))
                {
                    TextView.LoadFile(Dialog.FileName, Xwt.Formats.TextFormat.Markdown);
                }
            };
            MenuItem FileMenuItem = new MenuItem("????") { SubMenu = FileMenu };
            FileMenu.Items.Add(FileOpenMenuItem);
            MainMenu.Items.Add(FileMenuItem);

            MainWindow.MainMenu = MainMenu;
            var n = new NotebookSample();

            MainWindow.Content = n;

            MainWindow.Show();
            Application.Run();
        }
Esempio n. 8
0
        public MainWindow()
        {
            Title = string.Format (Catalog.GetString ("{0} Demo Application"), "Hamekoz Xwt");
            InitialLocation = WindowLocation.CenterScreen;
            Icon = Image.FromResource (Resources.Icon);
            WindowState = WindowState.Maximized;
            try {
                statusIcon = Application.CreateStatusIcon ();
                statusIcon.Menu = new Menu ();
                var about = new MenuItem {
                    Label = Catalog.GetString ("About"),
                    Image = Icons.Starred.WithSize (IconSize.Small),
                };
                var exit = new MenuItem {
                    Label = Catalog.GetString ("Exit"),
                    Image = Icons.Delete.WithSize (IconSize.Small),
                };
                statusIcon.Menu.Items.Add (about);
                statusIcon.Menu.Items.Add (exit);
                about.Clicked += AboutClicked;
                exit.Clicked += ExitClicked;
                statusIcon.Image = Icon;
            } catch {
                Console.WriteLine (Catalog.GetString ("Status icon could not be shown"));
            }

            panel = new HPaned ();

            store = new TreeStore (nameCol, iconCol, widgetCol);
            menuTree = new TreeView ();
            menuTree.Columns.Add ("", iconCol, nameCol);

            menuTree.DataSource = store;
            menuTree.SelectionChanged += HandleMenuTreeSelectionChanged;
            menuTree.MinWidth = 220;

            panel.Panel1.Content = menuTree;
            panel.Panel1.Content.MarginRight = 5;

            panel.Panel2.Resize = true;

            Content = panel;

            CloseRequested += HandleCloseRequested;

            InitialLocation = WindowLocation.CenterScreen;
        }
Esempio n. 9
0
        public MiniCardContextMenu()
        {
            menu = new Menu();

            var resetPoints = new MenuItem("Reset points");
            resetPoints.Clicked += (sender, e) =>
                ItemEvent(activeCard.Card.ResetPoints);
            menu.Items.Add(resetPoints);

            hideItem = new MenuItem("Hide Card");
            hideItem.Clicked += (sender, e) =>
                ItemEvent(() => activeCard.Card.Visible = false);
            menu.Items.Add(hideItem);

            showItem = new MenuItem("Show Card");
            showItem.Clicked += (sender, e) =>
                ItemEvent(() => activeCard.Card.Visible = true);
            menu.Items.Add(showItem);
        }
Esempio n. 10
0
        //CTOR
        static PluginWidget()
        {
            menu = new Menu();

            MenuItem item;

            (item = new MenuItem("Delete")).Clicked += (s, e) => { if (!lastClicked.Delete()) errorSound(); };
            item.Image = Resources.GetImage("delete.png");
            menu.Items.Add(item);

            (item = new MenuItem("Create Copy")).Clicked += (s, e) => { if (!lastClicked.CreateCopy()) errorSound(); };
            item.Image = Resources.GetImage("copy.png");
            menu.Items.Add(item);

            (item = new MenuItem("Rename")).Clicked += (s, e) => { lastClicked.StartRename(); };
            item.Image = Resources.GetImage("rename.png");
            menu.Items.Add(item);

            menu.Items.Add(new SeparatorMenuItem());

            (item = new MenuItem("Copy Path")).Clicked += (s, e) => { Xwt.Clipboard.SetText(lastClicked.Path); };
            menu.Items.Add(item);
        }
Esempio n. 11
0
        public TextArea(TextEditor editor)
        {
            this.editor = editor;

            CanGetFocus = true;

            lineNumberMargin = new LineNumberMargin(editor);
            paddingMargin = new PaddingMargin(5);
            textViewMargin = new TextViewMargin(editor);

            margins.Add(lineNumberMargin);
            margins.Add(paddingMargin);
            margins.Add(textViewMargin);

            contextMenu = new Menu();

            cutMenuItem = new MenuItem("Cut");
            cutMenuItem.Clicked += (sender, e) => Cut();
            contextMenu.Items.Add(cutMenuItem);

            copyMenuItem = new MenuItem("Copy");
            copyMenuItem.Clicked += (sender, e) => Copy();
            contextMenu.Items.Add(copyMenuItem);

            pasteMenuItem = new MenuItem("Paste");
            pasteMenuItem.Clicked += (sender, e) => Paste();
            contextMenu.Items.Add(pasteMenuItem);

            contextMenu.Items.Add(new SeparatorMenuItem());

            selectallMenuItem = new MenuItem("Select All");
            selectallMenuItem.Clicked += (sender, e) => SelectAll();
            contextMenu.Items.Add(selectallMenuItem);

            ButtonPressed += HandleButtonPressed;
        }
Esempio n. 12
0
        private void BuildMenu()
        {
            var menu = new Menu();

            var fileMenu = new MenuItem("File");
            fileMenu.SubMenu = new Menu();
            menu.Items.Add(fileMenu);

            newMenuItem = new MenuItem("New");
            newMenuItem.Clicked += (sender, e) => New();
            fileMenu.SubMenu.Items.Add(newMenuItem);

            openMenuItem = new MenuItem("Open");
            openMenuItem.Clicked += (sender, e) => Open();
            fileMenu.SubMenu.Items.Add(openMenuItem);

            fileMenu.SubMenu.Items.Add(new SeparatorMenuItem());

            saveMenuItem = new MenuItem("Save");
            saveMenuItem.Clicked += (sender, e) => Save(false);
            fileMenu.SubMenu.Items.Add(saveMenuItem);

            saveAsMenuItem = new MenuItem("Save As");
            saveAsMenuItem.Clicked += (sender, e) => Save(true);
            fileMenu.SubMenu.Items.Add(saveAsMenuItem);

            fileMenu.SubMenu.Items.Add(new SeparatorMenuItem());

            exitMenuItem = new MenuItem("Exit");
            exitMenuItem.Clicked += (sender, e) => this.Close();
            fileMenu.SubMenu.Items.Add(exitMenuItem);

            var editMenu = new MenuItem("Edit");
            editMenu.SubMenu = new Menu();
            menu.Items.Add(editMenu);

            undoMenuItem = new MenuItem("Undo");
            undoMenuItem.Clicked += (sender, e) => te1.Undo();
            editMenu.SubMenu.Items.Add(undoMenuItem);

            redoMenuItem = new MenuItem("Redo");
            redoMenuItem.Clicked += (sender, e) => te1.Redo();
            editMenu.SubMenu.Items.Add(redoMenuItem);

            editMenu.SubMenu.Items.Add(new SeparatorMenuItem());

            cutMenuItem = new MenuItem("Cut");
            cutMenuItem.Clicked += (sender, e) => te1.Cut();
            editMenu.SubMenu.Items.Add(cutMenuItem);

            copyMenuItem = new MenuItem("Copy");
            copyMenuItem.Clicked += (sender, e) => te1.Copy();
            editMenu.SubMenu.Items.Add(copyMenuItem);

            pasteMenuItem = new MenuItem("Paste");
            pasteMenuItem.Clicked += (sender, e) => te1.Paste();
            editMenu.SubMenu.Items.Add(pasteMenuItem);

            editMenu.SubMenu.Items.Add(new SeparatorMenuItem());

            selectAllMenuItem = new MenuItem("Select All");
            selectAllMenuItem.Clicked += (sender, e) => te1.SelectAll();
            editMenu.SubMenu.Items.Add(selectAllMenuItem);

            var buildMenu = new MenuItem("Build");
            buildMenu.SubMenu = new Menu();
            menu.Items.Add(buildMenu);

            runMenuItem = new MenuItem("Run");
            runMenuItem.Clicked += (sender, e) => Run();
            buildMenu.SubMenu.Items.Add(runMenuItem);

            debugMenuItem = new CheckBoxMenuItem("Debug");
            debugMenuItem.Checked = true;
            buildMenu.SubMenu.Items.Add(debugMenuItem);

            var helpMenu = new MenuItem("Help");
            helpMenu.SubMenu = new Menu();
            menu.Items.Add(helpMenu);

            aboutMenuItem = new MenuItem("About");
            aboutMenuItem.Clicked += (sender, e) => ShowAboutDialog();
            helpMenu.SubMenu.Items.Add(aboutMenuItem);

            MainMenu = menu;
        }
Esempio n. 13
0
        /// <summary>
        /// Prepare menu.
        /// </summary>
        private void _initializeMenu()
        {
            // Default menu
            Menu menu = new Menu();

            // Create main menu item
            MenuItem server = new MenuItem(Director.Properties.Resources.MenuServer);

            // Prepare submenu
            server.SubMenu = _createServerMenu();

            // Add server menu to items
            menu.Items.Add(server);

            // Create running menu
            MenuItem RunMenu = new MenuItem(Director.Properties.Resources.MenuRun);

            // Create submenu
            RunMenu.SubMenu = _createRunSubmenu();

            // Add
            menu.Items.Add(RunMenu);

            // Import menu
            MenuItem ImportMenu = new MenuItem(Director.Properties.Resources.Import);
            menu.Items.Add(ImportMenu);
            ImportMenu.SubMenu = _createImportMenu();

            // Settings
            MenuItem SettingsMenu = new MenuItem(Director.Properties.Resources.SettingsMenu);
            menu.Items.Add(SettingsMenu);
            SettingsMenu.SubMenu = new Menu();

            // Language
            MenuItem Languages = new MenuItem(Director.Properties.Resources.Language)
            {
                Image = Image.FromResource(DirectorImages.LIST_ICON)
            };
            SettingsMenu.SubMenu.Items.Add(Languages);

            // Langauges submenu
            Menu LanguagesSubMenu = new Menu();
            Languages.SubMenu = LanguagesSubMenu;

            // Get locale
            string locale = Director.Properties.Settings.Default.language;

            // English
            MenuItem LocaleEnglish = new MenuItem("English")
            {
                Image = Image.FromResource(DirectorImages.EN_ICON)
            };
            LanguagesSubMenu.Items.Add(LocaleEnglish);
            LocaleEnglish.Clicked += delegate
            {
                Director.Properties.Settings.Default.language = "en";
                Director.Properties.Settings.Default.Save();
                MessageDialog.ShowMessage(Director.Properties.Resources.RestartApp);
            };

            // Czech
            MenuItem LocaleCzech = new MenuItem("Czech")
            {
                Image = Image.FromResource(DirectorImages.CS_ICON)
            };
            LanguagesSubMenu.Items.Add(LocaleCzech);
            LocaleCzech.Clicked += delegate
            {
                Director.Properties.Settings.Default.language = "cs";
                Director.Properties.Settings.Default.Save();
                MessageDialog.ShowMessage(Director.Properties.Resources.RestartApp);
            };

            // Help menu
            MenuItem HelpMenu = new MenuItem(Director.Properties.Resources.HelpMenu);
            menu.Items.Add(HelpMenu);

            // Help menu
            Menu HelpSubMenu = new Menu();
            HelpMenu.SubMenu = HelpSubMenu;

            // About menu
            MenuItem AboutMenu = new MenuItem(Director.Properties.Resources.About)
            {
                Image = Image.FromResource(DirectorImages.HELP_ICON)
            };
            HelpSubMenu.Items.Add(AboutMenu);
            AboutMenu.Clicked += delegate
            {
                About.About AboutWindow = new About.About();
                AboutWindow.Run();
                AboutWindow.Dispose();
            };

            // Set as main menu
            MainMenu = menu;

            // Create server menu
            ServerMenu = new Menu();

            // Add scenario item
            MenuItem MenuAddScenario = new MenuItem(Director.Properties.Resources.MenuAddScenario)
            {
                Image = Image.FromResource(DirectorImages.ADD_ICON)
            };
            ServerMenu.Items.Add(MenuAddScenario);
            MenuAddScenario.Clicked += AddScenario;

            // Menu paste scenario
            PasteScenario = new MenuItem(Director.Properties.Resources.MenuPasteScenario)
            {
                Image = Image.FromResource(DirectorImages.PASTE_ICON),
                Sensitive = false
            };
            ServerMenu.Items.Add(PasteScenario);

            // Separator
            ServerMenu.Items.Add(new SeparatorMenuItem());

            // Edit default headers
            MenuItem MenuEditDefaultHeaders = new MenuItem(Director.Properties.Resources.MenuEditDefaultHeaders)
            {
                Image = Image.FromResource(DirectorImages.DEFAULT_HEADERS_ICON)
            };
            MenuEditDefaultHeaders.Clicked += MenuEditDefaultHeaders_Clicked;
            ServerMenu.Items.Add(MenuEditDefaultHeaders);

            // Create Scenario menu
            ScenarioMenu = new Menu();

            // Add request menu
            MenuItem MenuAddRequest = new MenuItem(Director.Properties.Resources.ContextMenuAddRequest)
            {
                Image = Image.FromResource(DirectorImages.ADD_ICON)
            };
            MenuAddRequest.Clicked += AddRequest;
            ScenarioMenu.Items.Add(MenuAddRequest);

            // Run scenario
            MenuItem MenuRunScenario = new MenuItem(Director.Properties.Resources.RunScenario)
            {
                Image = Image.FromResource(DirectorImages.RUN_ICON)
            };
            ScenarioMenu.Items.Add(MenuRunScenario);
            MenuRunScenario.Clicked += RunScenario;

            MenuItem MenuRunScVariables = new MenuItem(Director.Properties.Resources.SetVariables)
            {
                Image = Image.FromResource(DirectorImages.VARIABLES_ICON)
            };
            ScenarioMenu.Items.Add (MenuRunScVariables);
            MenuRunScVariables.Clicked += RunScenarioWithVariables;

            // Separator
            ScenarioMenu.Items.Add(new SeparatorMenuItem());

            // Scenario UP and down
            MenuItem ItemUpMenu = new MenuItem(Director.Properties.Resources.OrderUP)
            {
                Image = Image.FromResource(DirectorImages.UP_ICON)
            };
            ItemUpMenu.Clicked += ItemUpMenu_Clicked;
            ScenarioMenu.Items.Add(ItemUpMenu);

            MenuItem ItemDownMenu = new MenuItem(Director.Properties.Resources.OrderDOWN)
            {
                Image = Image.FromResource(DirectorImages.DOWN_ICON)
            };
            ItemDownMenu.Clicked += ItemDownMenu_Clicked;
            ScenarioMenu.Items.Add(ItemDownMenu);

            // Add to scenario and request menu
            ScenarioMenu.Items.Add(new SeparatorMenuItem());

            // Paste request
            PasteRequest = new MenuItem(Director.Properties.Resources.MenuPasteRequest)
            {
                Image = Image.FromResource(DirectorImages.PASTE_ICON),
                Sensitive = false
            };
            ScenarioMenu.Items.Add(PasteRequest);

            // Copy scenario
            CopyScenario = new MenuItem(Director.Properties.Resources.MenuCopyScenario)
            {
                Image = Image.FromResource(DirectorImages.COPY_ICON)
            };
            CopyScenario.Clicked += CopyScenario_Clicked;
            ScenarioMenu.Items.Add(CopyScenario);
            // Separator
            ScenarioMenu.Items.Add(new SeparatorMenuItem());

            // Delete scenario menu
            MenuItem MenuRemoveScenario = new MenuItem(Director.Properties.Resources.ContextMenuRemoveScenario)
            {
                Image = Image.FromResource(DirectorImages.CROSS_ICON)
            };
            ScenarioMenu.Items.Add(MenuRemoveScenario);
            MenuRemoveScenario.Clicked += RemoveScenario;

            // Request menu
            RequestMenu = new Menu();
            MenuItem MenuEditRequest = new MenuItem(Director.Properties.Resources.MenuEditRequest)
            {
                Image = Image.FromResource(DirectorImages.EDIT_ICON)
            };
            MenuEditRequest.Clicked += MenuEditRequest_Clicked;
            RequestMenu.Items.Add(MenuEditRequest);

            CopyRequest = new MenuItem(Director.Properties.Resources.MenuCopyRequest)
            {
                Image = Image.FromResource(DirectorImages.COPY_ICON)
            };
            CopyRequest.Clicked += CopyRequest_Clicked;
            RequestMenu.Items.Add(CopyRequest);

            RequestMenu.Items.Add(new SeparatorMenuItem());

            // Scenario UP and down
            MenuItem RequestItemUpMenu = new MenuItem(Director.Properties.Resources.OrderUP)
            {
                Image = Image.FromResource(DirectorImages.UP_ICON)
            };
            RequestItemUpMenu.Clicked += ItemUpMenu_Clicked;
            RequestMenu.Items.Add(RequestItemUpMenu);

            MenuItem RequestItemDownMenu = new MenuItem(Director.Properties.Resources.OrderDOWN)
            {
                Image = Image.FromResource(DirectorImages.DOWN_ICON)
            };
            RequestItemDownMenu.Clicked += ItemDownMenu_Clicked;
            RequestMenu.Items.Add(RequestItemDownMenu);

            // Separator
            RequestMenu.Items.Add(new SeparatorMenuItem());

            // Remove
            MenuItem MenuRemoveRequest = new MenuItem(Director.Properties.Resources.ContextMenuRemoveRequest)
            {
                Image = Image.FromResource(DirectorImages.CROSS_ICON)
            };
            RequestMenu.Items.Add(MenuRemoveRequest);
            MenuRemoveRequest.Clicked += MenuRemoveRequest_Clicked;
        }
Esempio n. 14
0
		public MainWindow(string title, string pty)
		{
			Title = title;
			Width = 700;
			Height = 400;

			terminal = new TermSharp.Terminal();
			Content = terminal;
			terminal.InnerMargin = new WidgetSpacing(5, 0, 5, 0);
			Padding = new WidgetSpacing();

			terminal.Cursor.Enabled = true;

			Font.RegisterFontFromFile(Path.Combine(Directory.GetCurrentDirectory(), "External/TermsharpConsole/RobotoMono-Regular.ttf"));
			var robotoMonoFont = Font.FromName("Roboto Mono");
			if(robotoMonoFont.Family.Contains("Roboto"))
			{
				terminal.CurrentFont = robotoMonoFont;
			}

			var contextMenu = new Menu();

			var copyMenuItem = new MenuItem("Copy");
			copyMenuItem.Clicked += (sender, e) => Clipboard.SetText(terminal.CollectClipboardData().Text);
			contextMenu.Items.Add(copyMenuItem);

			var pasteMenuItem = new MenuItem("Paste");
			contextMenu.Items.Add(pasteMenuItem);

			terminal.ContextMenu = contextMenu;

			CloseRequested += delegate
			{
				Application.Exit();
			};

			terminal.SetFocus();

			var readerThread = new Thread(() =>
			{
				var stream = new PtyUnixStream(pty);
				var vt100decoder = new TermSharp.Vt100.Decoder(terminal, stream.WriteByte, new ConsoleDecoderLogger());
				var utfDecoder = new ByteUtf8Decoder(vt100decoder.Feed);

				Application.Invoke(() =>
				{
					pasteMenuItem.Clicked += delegate
					{
						var text = Clipboard.GetText();
						var textAsBytes = Encoding.UTF8.GetBytes(text);
						foreach(var b in textAsBytes)
						{
							stream.WriteByte(b);
						}
					};
				});

				var encoder = new TermSharp.Vt100.Encoder(x => 
				{
					terminal.ClearSelection();
					terminal.MoveScrollbarToEnd();
					stream.WriteByte(x); 
				});

				terminal.KeyPressed += (s, a) =>
				{
					a.Handled = true;

					var modifiers = a.Modifiers;
					if(!Utilities.IsOnOsX)
					{
						modifiers &= ~(ModifierKeys.Command);
					}

					if(modifiers== ModifierKeys.Shift)
					{
						if(a.Key == Key.PageUp)
						{
							terminal.PageUp();
							return;
						}
						if(a.Key == Key.PageDown)
						{
							terminal.PageDown();
							return;
						}
					}
					encoder.Feed(a.Key, modifiers);
				};

				var buffer = new List<byte>();
				var noTimeoutNextTime = true;
				while(true)
				{
					if(noTimeoutNextTime)
					{
						noTimeoutNextTime = false;
					}
					else
					{
						stream.ReadTimeout = 10;
					}
					var readByte = buffer.Count > 1024 ? BufferFull : stream.ReadByte();
					if(readByte == StreamClosed)
					{
						Application.Invoke(Application.Exit);
						return;
					}
					if(readByte >= 0)
					{
						buffer.Add((byte)readByte);
					}
					else
					{
						var bufferToWrite = buffer;
						Application.Invoke(() =>
						{
							foreach (var b in bufferToWrite)
							{
								utfDecoder.Feed(b);
							}
						});
						buffer = new List<byte>();
						noTimeoutNextTime = true;
					}
				}
			})
			{ IsBackground = true };

			readerThread.Start();
		}
Esempio n. 15
0
        /// <summary>
        /// Create run submenu.
        /// </summary>
        /// <returns></returns>
        private Menu _createRunSubmenu()
        {
            Menu _runSubmenu = new Menu();

            // Run all
            RunAllMenu = new MenuItem(Director.Properties.Resources.RunAllMenu)
            {
                Image = Image.FromResource(DirectorImages.RUN_ICON),
                Sensitive = false
            };
            _runSubmenu.Items.Add(RunAllMenu);

            // Stop
            StopThreadMenu = new MenuItem(Director.Properties.Resources.Stop)
            {
                Image = Image.FromResource(DirectorImages.CROSS_ICON),
                Sensitive = false
            };
            _runSubmenu.Items.Add(StopThreadMenu);

            // Separator
            _runSubmenu.Items.Add(new SeparatorMenuItem());

            // Export variables
            ExportVariablesMenu = new MenuItem(Director.Properties.Resources.ExportVariablesStates)
            {
                Image = Image.FromResource(DirectorImages.EXPORT_VARIABLES_ICON),
                Sensitive = false
            };
            _runSubmenu.Items.Add(ExportVariablesMenu);

            return _runSubmenu;
        }
Esempio n. 16
0
        /// <summary>
        /// Create server menu.
        /// </summary>
        private Menu _createServerMenu()
        {
            Menu ServerMenu = new Menu();

            // Sub menu server
            NewServer = new MenuItem(Director.Properties.Resources.MenuNewServer)
            {
                Image = Image.FromResource(DirectorImages.NEW_SERVER_ICON)
            };
            ServerMenu.Items.Add(NewServer);

            // Scenario open
            OpenServerMenu = new MenuItem(Director.Properties.Resources.MenuOpenScenario)
            {
                Image = Image.FromResource(DirectorImages.OPEN_SCENARIO_ICON)
            };
            ServerMenu.Items.Add(OpenServerMenu);

            // Export scenario
            SaveServerMenu = new MenuItem(Director.Properties.Resources.MenuSaveServer)
            {
                Image = Image.FromResource(DirectorImages.SAVE_SCENARIO_ICON)
            };
            ServerMenu.Items.Add(SaveServerMenu);

            // Close scenario
            CloseServer = new MenuItem(Director.Properties.Resources.MenuCloseScenario)
            {
                Image = Image.FromResource(DirectorImages.CROSS_ICON),
                Sensitive = false
            };
            ServerMenu.Items.Add(CloseServer);

            // Separator before exit
            ServerMenu.Items.Add(new SeparatorMenuItem());

            // Sub menu exit
            MenuItem _exit = new MenuItem(Director.Properties.Resources.MenuExitProgram)
            {
                Image = Image.FromResource(DirectorImages.EXIT_ICON)
            };
            _exit.Clicked += delegate { Application.Exit(); };
            ServerMenu.Items.Add(_exit);

            return ServerMenu;
        }
Esempio n. 17
0
 internal void InsertItem(int n, MenuItem item)
 {
     Backend.InsertItem (n, (IMenuItemBackend)GetBackend (item));
 }
Esempio n. 18
0
 internal void RemoveItem(MenuItem item)
 {
     Backend.RemoveItem ((IMenuItemBackend)GetBackend (item));
 }
		void ShowBatchFixContextMenu (double x, double y, IEnumerable<TreePosition> rows)
		{
			var possibleFixes = rows
				.Select (row => store.GetNavigatorAt (row).GetValue (nodeField))
				.Where (node1 => node1 != null)
				.SelectMany (node2 => node2.AllChildren.Union (new [] { node2 }))
				.Where (node3 => node3.Visible)
				.OfType<IssueSummary> ()
				.Where (issue => issue.Actions.Any (a => a.Batchable))
				.Distinct()
				.GroupBy(issue => issue.InspectorIdString)
				.OrderBy (group => -group.Count ());
				
			var groups = possibleFixes.Take (BatchChoiceCount).ToList ();
			if (!groups.Any ())
				return;

			if (groups.Count == 1) {
				CreateIssueMenu (groups.First ()).Popup (view, x, y);
			} else {
				var menu = new Menu ();
				foreach (var g in groups) {
					var menuItem = new MenuItem (g.First ().ProviderTitle);
					menuItem.SubMenu = CreateIssueMenu (g);
					menu.Items.Add (menuItem);
				}
				menu.Popup (view, x, y);
			}
		}
Esempio n. 20
0
        public MainWindow()
        {
            Title = "Xwt Demo Application";
            Width = 500;
            Height = 400;

            try {
                statusIcon = Application.CreateStatusIcon ();
                statusIcon.Menu = new Menu ();
                statusIcon.Menu.Items.Add (new MenuItem ("Test"));
                statusIcon.Image = Image.FromResource (GetType (), "package.png");
            } catch {
                Console.WriteLine ("Status icon could not be shown");
            }

            Menu menu = new Menu ();

            var file = new MenuItem ("_File");
            file.SubMenu = new Menu ();
            file.SubMenu.Items.Add (new MenuItem ("_Open"));
            file.SubMenu.Items.Add (new MenuItem ("_New"));
            MenuItem mi = new MenuItem ("_Close");
            mi.Clicked += delegate {
                Application.Exit();
            };
            file.SubMenu.Items.Add (mi);
            menu.Items.Add (file);

            var edit = new MenuItem ("_Edit");
            edit.SubMenu = new Menu ();
            edit.SubMenu.Items.Add (new MenuItem ("_Copy"));
            edit.SubMenu.Items.Add (new MenuItem ("Cu_t"));
            edit.SubMenu.Items.Add (new MenuItem ("_Paste"));
            menu.Items.Add (edit);

            MainMenu = menu;

            HPaned box = new HPaned ();

            icon = Image.FromResource (typeof(App), "document-generic.png");

            store = new TreeStore (nameCol, iconCol, widgetCol);
            samplesTree = new TreeView ();
            samplesTree.Columns.Add ("Name", iconCol, nameCol);

            var w = AddSample (null, "Widgets", null);
            AddSample (w, "Boxes", typeof(Boxes));
            AddSample (w, "Buttons", typeof(ButtonSample));
            AddSample (w, "CheckBox", typeof(Checkboxes));
            AddSample (w, "Clipboard", typeof(ClipboardSample));
            AddSample (w, "ColorSelector", typeof(ColorSelectorSample));
            AddSample (w, "ComboBox", typeof(ComboBoxes));
            AddSample (w, "DatePicker", typeof(DatePickerSample));
            //			AddSample (null, "Designer", typeof(Designer));
            AddSample (w, "Expander", typeof (ExpanderSample));
            AddSample (w, "Progress bars", typeof(ProgressBarSample));
            AddSample (w, "Frames", typeof(Frames));
            AddSample (w, "Images", typeof(Images));
            AddSample (w, "Labels", typeof(Labels));
            AddSample (w, "ListBox", typeof(ListBoxSample));
            AddSample (w, "LinkLabels", typeof(LinkLabels));
            var listView = AddSample (w, "ListView", typeof(ListView1));
            AddSample (listView, "Editable checkboxes", typeof(ListView2));
            AddSample (w, "Markdown", typeof (MarkDownSample));
            AddSample (w, "Menu", typeof(MenuSamples));
            var mn = AddSample (w, "Mnemonics", typeof (Mnemonics));
            AddSample (w, "Notebook", typeof(NotebookSample));
            AddSample (w, "Paneds", typeof(PanedViews));
            AddSample (w, "Popover", typeof(PopoverSample));
            AddSample (w, "RadioButton", typeof (RadioButtonSample));
            AddSample (w, "Scroll View", typeof(ScrollWindowSample));
            AddSample (w, "Scrollbar", typeof(ScrollbarSample));
            AddSample (w, "Slider", typeof (SliderSample));
            AddSample (w, "Spinners", typeof (Spinners));
            AddSample (w, "Tables", typeof (Tables));
            AddSample (w, "Text Entry", typeof (TextEntries));
            AddSample (w, "Password Entry", typeof (PasswordEntries));
            AddSample (w, "TreeView", typeof(TreeViews));

            var n = AddSample (null, "Drawing", null);
            AddSample (n, "Canvas with Widget (Linear)", typeof (CanvasWithWidget_Linear));
            AddSample (n, "Canvas with Widget (Radial)", typeof (CanvasWithWidget_Radial));
            AddSample (n, "Chart", typeof (ChartSample));
            AddSample (n, "Colors", typeof(ColorsSample));
            AddSample (n, "Figures", typeof(DrawingFigures));
            AddSample (n, "Transformations", typeof(DrawingTransforms));
            AddSample (n, "Images and Patterns", typeof(DrawingPatternsAndImages));
            AddSample (n, "Text", typeof(DrawingText));
            AddSample (n, "Partial Images", typeof (PartialImages));
            AddSample (n, "Custom Drawn Image", typeof (ImageScaling));
            AddSample (n, "Widget Rendering", typeof (WidgetRendering));

            var wf = AddSample (null, "Widget Features", null);
            AddSample (wf, "Drag & Drop", typeof(DragDrop));
            AddSample (wf, "Widget Events", typeof(WidgetEvents));
            AddSample (wf, "Opacity", typeof(OpacitySample));
            AddSample (wf, "Tooltips", typeof(Tooltips));

            AddSample (null, "Windows", typeof(Windows));

            AddSample (null, "Screens", typeof (ScreensSample));

            samplesTree.DataSource = store;

            box.Panel1.Content = samplesTree;

            sampleBox = new VBox ();
            title = new Label ("Sample:");
            sampleBox.PackStart (title);

            box.Panel2.Content = sampleBox;
            box.Panel2.Resize = true;
            box.Position = 160;

            Content = box;

            samplesTree.SelectionChanged += HandleSamplesTreeSelectionChanged;

            CloseRequested += HandleCloseRequested;
        }
Esempio n. 21
0
        /// <summary>
        /// Initializes the context menu.
        /// </summary>
        void InitializeContextMenu()
        {
            contextMenu = new Menu();

            contextEditMask = new MenuItem("Edit mask");
            contextEditMask.UseMnemonic = true;
            contextEditMask.Clicked += (object sender, EventArgs e) => EditMode ^= true;
            contextMenu.Items.Add(contextEditMask);

            MenuItem contextResetMask = new MenuItem("Reset mask");
            contextResetMask.UseMnemonic = true;
            contextResetMask.Clicked += (object sender, EventArgs e) => scan.Mask.ResetMask();
            contextMenu.Items.Add(contextResetMask);

            MenuItem contextSaveMask = new MenuItem("Save changes");
            contextSaveMask.UseMnemonic = true;
            contextSaveMask.Clicked += (object sender, EventArgs e) => SaveMask();
            contextMenu.Items.Add(contextSaveMask);
        }
Esempio n. 22
0
        /// <summary>
        /// Initializes the context menu.
        /// </summary>
        void InitializeContextMenu()
        {
            contextMenu = new Menu();
            contextMenuFibertype = new Menu();

            contextMenu.Items.Add(new MenuItem { Label = "Fiber Type", SubMenu = contextMenuFibertype });

            MenuItem magnificationMenu = new MenuItem { Label = "Magnification..." };
            contextMenu.Items.Add(magnificationMenu);

            magnificationMenu.Clicked += delegate {
                Dialog d = new Dialog();
                d.Title = "Change magnification factor to...";
                d.Buttons.Add(new DialogButton(Command.Apply));
                d.Buttons.Add(new DialogButton(Command.Cancel));

                TextEntry newMagnification = new TextEntry { PlaceholderText = "Magnification factor" };
                d.Content = newMagnification;

                Command ret = d.Run();
                if (ret != null && ret.Id == Command.Apply.Id) {
                    TreeStore currentStore = DataSource as TreeStore;
                    foreach (TreePosition x in SelectedRows) {
                        string n = currentStore.GetNavigatorAt(x)
                            .GetValue(isFiltered ? nameColFilter : nameCol);

                        BaseScan found = scanCollection.Find(o => o.Name == n);
                        if (found != null) {
                            try {
                                found.Metadata["LensMagnification"] = float.Parse(newMagnification.Text);
                            } catch (Exception e) {
                                // TODO show error
                                Console.WriteLine(e.Message);
                                Console.WriteLine(e.StackTrace);
                            }
                        }
                    }
                }

                d.Dispose();
            };
        }
Esempio n. 23
0
        protected override void OnButtonPressed(ButtonEventArgs args)
        {
            base.OnButtonPressed(args);

            if (scanCollection == null) {
                return;
            }

            switch (args.Button) {
            case PointerButton.Left:
                if (args.MultiplePress >= 2) {
                    TreePosition selected = SelectedRow;
                    if (selected != null) {
                        string scanName = (DataSource as TreeStore).GetNavigatorAt(selected)
                            .GetValue(isFiltered ? nameColFilter : nameCol);
                        Image thumbnail = (DataSource as TreeStore).GetNavigatorAt(selected)
                            .GetValue(isFiltered ? thumbnailColFilter : thumbnailCol);
                        BaseScan scan = scanCollection.Find(((BaseScan obj) => obj.Name == scanName));

                        if (scan != null) {
                            MetadataDialog metaDialog = new MetadataDialog(scan, thumbnail);
                            Command r = metaDialog.Run();

                            if (r != null && r.Id == Command.Apply.Id) {
                                metaDialog.Save();
                            }

                            metaDialog.Dispose();

                        }
                    }
                }
                break;
            case PointerButton.Right:
                contextMenuFibertype.Items.Clear();

                TreeStore currentStore = DataSource as TreeStore;
                string currentFiberType;
                if (SelectedRow != null && currentStore != null) {
                    TreeNavigator row = currentStore.GetNavigatorAt(SelectedRow);

                    string name = row.GetValue(isFiltered ? nameColFilter : nameCol);
                    currentFiberType = scanCollection.Find(o => o.Name == name).FiberType;

                    foreach (string typeName in fiberTypeNodes.Keys) {
                        RadioButtonMenuItem radioButton = new RadioButtonMenuItem(typeName);
                        if (typeName == currentFiberType) {
                            radioButton.Checked = true;
                        }

                        radioButton.Clicked += delegate(object sender, EventArgs e) {
                            RadioButtonMenuItem r = sender as RadioButtonMenuItem;
                            if (r == null) {
                                return;
                            }

                            List<BaseScan> foundScan = new List<BaseScan>();
                            foreach (TreePosition x in SelectedRows) {
                                if (r != null) {
                                    string n = currentStore.GetNavigatorAt(x)
                                        .GetValue(isFiltered ? nameColFilter : nameCol);
                                    BaseScan found = scanCollection.Find(o => o.Name == n);
                                    if (found != null) {
                                        foundScan.Add(found);
                                    }
                                }
                            }

                            foreach (BaseScan found in foundScan) {
                                found.FiberType = r.Label;
                            }
                        };

                        contextMenuFibertype.Items.Add(radioButton);
                    }

                    // other fibertype
                    MenuItem otherFibertype = new MenuItem { Label = "Other..." };
                    contextMenuFibertype.Items.Add(new SeparatorMenuItem());
                    contextMenuFibertype.Items.Add(otherFibertype);
                    otherFibertype.Clicked += delegate {
                        Dialog d = new Dialog();
                        d.Title = "Change fiber type to...";
                        d.Buttons.Add(new DialogButton(Command.Apply));
                        d.Buttons.Add(new DialogButton(Command.Cancel));

                        TextEntry newFiberType = new TextEntry { PlaceholderText = "Fiber type name" };
                        d.Content = newFiberType;

                        Command ret = d.Run();
                        if (ret != null && ret.Id == Command.Apply.Id) {
                            List<BaseScan> foundScan = new List<BaseScan>();
                            foreach (TreePosition x in SelectedRows) {
                                string n = currentStore.GetNavigatorAt(x)
                                        .GetValue(isFiltered ? nameColFilter : nameCol);
                                BaseScan found = scanCollection.Find(o => o.Name == n);
                                if (found != null) {
                                    foundScan.Add(found);
                                }
                            }

                            foreach (BaseScan found in foundScan) {
                                found.FiberType = newFiberType.Text;
                            }
                        }

                        d.Dispose();
                    };

                    contextMenu.Popup();
                }
                break;
            }
        }
Esempio n. 24
0
        private void Build()
        {
            this.Title = "Spritefont Editor";
            this.Width = 600;
            this.Height = 480;
            this.Icon = Xwt.Drawing.Image.FromResource("Resources.icon.png");

            menu1 = new Menu ();

            MenuItem fileMenuItem = new MenuItem ("File");
            Menu fileMenu = new Menu ();

            menuitem_new = new MenuItem ("New");
            fileMenu.Items.Add (menuitem_new);

            menuitem_open = new MenuItem ("Open");
            fileMenu.Items.Add (menuitem_open);

            fileMenu.Items.Add(new SeparatorMenuItem());

            menuitem_save = new MenuItem ("Save");
            fileMenu.Items.Add (menuitem_save);

            menuitem_saveas = new MenuItem ("Save As");
            fileMenu.Items.Add (menuitem_saveas);

            fileMenu.Items.Add(new SeparatorMenuItem());

            menuitem_exit = new MenuItem ("Exit");
            fileMenu.Items.Add (menuitem_exit);

            fileMenuItem.SubMenu = fileMenu;
            menu1.Items.Add (fileMenuItem);

            if (Settings.SuportedPlatformToolkits.Length > 1)
            {
                menuitem_toolkit = new MenuItem("Toolkit");
                var toolKitMenu = new Menu();

                foreach (var t in Settings.SuportedPlatformToolkits)
                {
                    var m = new RadioButtonMenuItem(t.ToString());
                    m.Checked = (t == Settings.GetToolkit());
                    m.Clicked += ToolKitClicked;
                    m.Tag = t;
                    toolKitMenu.Items.Add(m);
                }

                menuitem_toolkit.SubMenu = toolKitMenu;
                menu1.Items.Add(menuitem_toolkit);
            }

            this.MainMenu = menu1;

            sfwidget1 = new SFWidget();
            this.Content = sfwidget1;
            this.Padding = 0;

            this.menuitem_new.Clicked += NewClicked;
            this.menuitem_open.Clicked += OpenClicked;
            this.menuitem_save.Clicked += SaveClicked;
            this.menuitem_saveas.Clicked += (sender, e) => SaveAs();
            this.menuitem_exit.Clicked += (sender, e) => Application.Exit();
        }
Esempio n. 25
0
        private Menu CreatePopupMenu()
        {
            var popup = new Menu();

            var copyItem = new MenuItem("Copy");
            copyItem.Clicked += delegate
            {
                Clipboard.SetText(terminal.CollectClipboardData().Text);
            };
            popup.Items.Add(copyItem);

            var pasteItem = new MenuItem("Paste");
            pasteItem.Clicked += delegate
            {
                var text = Clipboard.GetText();
                if(string.IsNullOrEmpty(text))
                {
                    return;
                }
                var textAsBytes = Encoding.UTF8.GetBytes(text);
                foreach(var b in textAsBytes)
                {
                    terminalInputOutputSource.HandleInput(b);
                }
            };
            popup.Items.Add(pasteItem);

            if(additionlMenuItemProvider != null)
            {
                foreach(var item in additionlMenuItemProvider(this))
                {
                    popup.Items.Add(item);
                }
            }

            return popup;
        }
		Menu CreateIssueMenu (IEnumerable<IssueSummary> issues)
		{
			var allIssues = issues as IList<IssueSummary> ?? issues.ToList ();
			var issueMenu = new Menu ();
			
			var actionGroups = allIssues
				.SelectMany (issue => issue.Actions)
				.GroupBy (action => action.SiblingKey);
			foreach (var _actionGroup in actionGroups) {
				var actionGroup = _actionGroup;
				
				var actionMenuItem = new MenuItem (actionGroup.First ().Title);
				actionMenuItem.Clicked += delegate {
					ThreadPool.QueueUserWorkItem (delegate {
						try {
							using (var monitor = IdeApp.Workbench.ProgressMonitors.GetStatusProgressMonitor ("Applying fixes", null, false)) {
								var fixer = new BatchFixer (new ExactIssueMatcher (), monitor);
								var appliedActions = fixer.TryFixIssues (actionGroup);
								foreach (var action in appliedActions) {
									((IIssueTreeNode)action.IssueSummary).Visible = false;
								}
							}
							Application.Invoke (delegate {
								ProcessUpdateQueue ();
							});
						} catch (Exception e) {
							LoggingService.LogInternalError (e);
						}
					});
				};
				issueMenu.Items.Add (actionMenuItem);
			}
			return issueMenu;
		}
Esempio n. 27
0
File: Menu.cs Progetto: garuma/xwt
 internal void InsertItem(int n, MenuItem item)
 {
     Backend.InsertItem (n, (IMenuItemBackend)BackendHost.ToolkitEngine.GetSafeBackend (item));
 }
Esempio n. 28
0
        public MainWindow()
        {
            try {
                statusIcon = Application.CreateStatusIcon ();
                statusIcon.Menu = new Menu ();
                statusIcon.Menu.Items.Add (new MenuItem ("Test"));
                statusIcon.Image = Image.FromResource (GetType (), "package.png");
            } catch {
                Console.WriteLine ("Status icon could not be shown");
            }

            Menu menu = new Menu ();

            var file = new MenuItem ("File");
            file.SubMenu = new Menu ();
            file.SubMenu.Items.Add (new MenuItem ("Open"));
            file.SubMenu.Items.Add (new MenuItem ("New"));
            MenuItem mi = new MenuItem ("Close");
            mi.Clicked += delegate {
                Application.Exit();
            };
            file.SubMenu.Items.Add (mi);
            menu.Items.Add (file);

            var edit = new MenuItem ("Edit");
            edit.SubMenu = new Menu ();
            edit.SubMenu.Items.Add (new MenuItem ("Copy"));
            edit.SubMenu.Items.Add (new MenuItem ("Cut"));
            edit.SubMenu.Items.Add (new MenuItem ("Paste"));
            menu.Items.Add (edit);

            MainMenu = menu;

            HPaned box = new HPaned ();

            icon = Image.FromResource (typeof(App), "class.png");

            store = new TreeStore (nameCol, iconCol, widgetCol);
            samplesTree = new TreeView ();
            samplesTree.Columns.Add ("Name", iconCol, nameCol);

            AddSample (null, "Boxes", typeof(Boxes));
            AddSample (null, "Buttons", typeof(ButtonSample));
            AddSample (null, "CheckBox", typeof(Checkboxes));
            AddSample (null, "Clipboard", typeof(ClipboardSample));
            AddSample (null, "ColorSelector", typeof(ColorSelectorSample));
            AddSample (null, "ComboBox", typeof(ComboBoxes));
            //			AddSample (null, "Designer", typeof(Designer));
            AddSample (null, "Drag & Drop", typeof(DragDrop));

            var n = AddSample (null, "Drawing", null);
            AddSample (n, "Canvas with Widget", typeof(CanvasWithWidget));
            AddSample (n, "Chart", typeof(ChartSample));
            AddSample (n, "Colors", typeof(ColorsSample));
            AddSample (n, "Figures", typeof(DrawingFigures));
            AddSample (n, "Transformations", typeof(DrawingTransforms));
            AddSample (n, "Images and Patterns", typeof(DrawingPatternsAndImages));
            AddSample (n, "Text", typeof(DrawingText));
            AddSample (n, "Partial Images", typeof (PartialImages));

            AddSample (null, "Expander", typeof (ExpanderSample));
            AddSample (null, "Progress bars", typeof(ProgressBarSample));
            AddSample (null, "Frames", typeof(Frames));
            AddSample (null, "Images", typeof(Images));
            AddSample (null, "Labels", typeof(Labels));
            AddSample (null, "ListBox", typeof(ListBoxSample));
            AddSample (null, "ListView", typeof(ListView1));
            AddSample (null, "Menu", typeof(MenuSamples));
            AddSample (null, "Notebook", typeof(NotebookSample));
            AddSample (null, "Paneds", typeof(PanedViews));
            AddSample (null, "Scroll View", typeof(ScrollWindowSample));
            AddSample (null, "Tables", typeof(Tables));
            AddSample (null, "Text Entry", typeof(TextEntries));
            AddSample (null, "Tooltips", typeof(Tooltips));
            AddSample (null, "TreeView", typeof(TreeViews));
            AddSample (null, "WidgetEvents", typeof(WidgetEvents));
            AddSample (null, "Windows", typeof(Windows));

            samplesTree.DataSource = store;

            box.Panel1.Content = samplesTree;

            sampleBox = new VBox ();
            title = new Label ("Sample:");
            sampleBox.PackStart (title, BoxMode.None);

            box.Panel2.Content = sampleBox;
            box.Panel2.Resize = true;
            box.Position = 160;

            Content = box;

            samplesTree.SelectionChanged += HandleSamplesTreeSelectionChanged;
        }
Esempio n. 29
0
        /// <summary>
        /// Create import menu.
        /// </summary>
        /// <returns></returns>
        private Menu _createImportMenu()
        {
            Menu _imM = new Menu();

            // Apiary
            MenuItem ApiaryImport = new MenuItem(Director.Properties.Resources.ImportApiary)
            {
                Image = Image.FromResource(DirectorImages.APIARY_ICON)
            };
            _imM.Items.Add(ApiaryImport);
            ApiaryImport.Clicked += ApiaryImport_Clicked;

            // Postman
            MenuItem PostmanImport = new MenuItem(Director.Properties.Resources.ImportPostman)
            {
                Image = Image.FromResource(DirectorImages.POSTMAN_ICON)
            };
            _imM.Items.Add(PostmanImport);
            PostmanImport.Clicked += PostmanImport_Clicked;

            // Return
            return _imM;
        }
Esempio n. 30
0
File: Menu.cs Progetto: garuma/xwt
 internal void RemoveItem(MenuItem item)
 {
     Backend.RemoveItem ((IMenuItemBackend)BackendHost.ToolkitEngine.GetSafeBackend (item));
 }
Esempio n. 31
0
        public GUIManager()
        {
//            AppDomain.CurrentDomain.ProcessExit += DBManager.OnExit;

            Application.Initialize(ToolkitType.Gtk);

            // Initialize main window
            MainWindow = new GUIWindow()
            {
                Title     = "Password Manager",
                Width     = 500,
                Height    = 600,
                Resizable = true
            };

            LoggedIn = false;

            MainMenu = new Menu();

            // Creates the 'File' menu item
            MenuItem fileMenu = new MenuItem("File");

            fileMenu.SubMenu = new Menu();

            // Adds the 'Home' command to 'File' menu
            MenuItem homeCommand = new MenuItem(new Command("Home"));

            fileMenu.SubMenu.Items.Add(homeCommand);

            // Adds the 'Settings' command to 'File' menu
            MenuItem settingsCommand = new MenuItem(new Command("Settings"));

            fileMenu.SubMenu.Items.Add(settingsCommand);

            // Adds the 'Logout' command to 'File' menu
            MenuItem logoutCommand = new MenuItem(new Command("Logout"));

            fileMenu.SubMenu.Items.Add(logoutCommand);

            // Finalize fileMenu
            MainMenu.Items.Add((fileMenu));

            logoutCommand.Sensitive = false; // Change after logged in

            // Creates the 'Help' menu item
            MenuItem helpMenu = new MenuItem("Help");

            helpMenu.SubMenu = new Menu();

            // Adds 'About' item to 'Help' menu
            MenuItem aboutSubMenu = new MenuItem("About");

            helpMenu.SubMenu.Items.Add(aboutSubMenu);

            // Finalize helpMenu
            MainMenu.Items.Add(helpMenu);

            // Make login page
            LoginPage = new LoginPage(this);

            // Set buttons for window switching
            aboutSubMenu.Clicked += delegate
            {
                // Make about page
                AboutPage = new AboutPage(this);

                MainWindow.Content = AboutPage;
            };
            homeCommand.Clicked += delegate
            {
                // If not logged in, 'Home' sends to login page
                if (!LoggedIn)
                {
                    // Make login page
                    LoginPage = new LoginPage(this);

                    MainWindow.Content = LoginPage;
                }
                else // Else send to home page
                {
                    // Make management page
                    ManagementPage = new ManagementPage(this);

                    MainWindow.Content = ManagementPage;
                }
            };
            logoutCommand.Clicked += delegate
            {
                LoggedIn = false;

                DBManager.Instance.CloseDB();

                // Make login page
                LoginPage = new LoginPage(this);

                MainWindow.Content = LoginPage;
            };
            settingsCommand.Clicked += delegate
            {
                SettingsPage settingsPage = new SettingsPage(this);

                MainWindow.Content = settingsPage;
            };

            MainWindow.Content = LoginPage; // First page

            MainWindow.MainMenu = MainMenu;
        }