コード例 #1
0
        public PlayListTreeView()
        {
            this.HeadersVisible = false;

            ls = new ListStore(typeof(PlayListPlay));
            this.Model = ls;

            menu = new Menu();
            MenuItem title = new MenuItem(Catalog.GetString("Edit Title"));
            title.Activated += new EventHandler(OnTitle);
            title.Show();
            MenuItem delete = new MenuItem(Catalog.GetString("Delete"));
            delete.Activated += new EventHandler(OnDelete);
            delete.Show();
            setRate = new MenuItem(Catalog.GetString("Apply current play rate"));
            setRate.Activated += new EventHandler(OnApplyRate);
            setRate.Show();
            menu.Append(title);
            menu.Append(setRate);
            menu.Append(delete);

            Gtk.TreeViewColumn nameColumn = new Gtk.TreeViewColumn();
            nameColumn.Title = Catalog.GetString("Name");
            Gtk.CellRendererText nameCell = new Gtk.CellRendererText();
            nameColumn.PackStart(nameCell, true);
            nameColumn.SetCellDataFunc(nameCell, new Gtk.TreeCellDataFunc(RenderName));
            this.AppendColumn(nameColumn);
        }
コード例 #2
0
ファイル: TIcon.cs プロジェクト: sonicwang1989/lphant
        public TIcon(CInterfaceGateway in_krnGateway, Gtk.Window mwindow)
        {
            krnGateway = in_krnGateway;
            mainwindow = mwindow;

             	menu = new Gtk.Menu ();
               		EventBox eb = new EventBox ();
            eb.ButtonPressEvent += new ButtonPressEventHandler (TIconClicked);
            eb.Add (new Gtk.Image (new Gdk.Pixbuf (null, "lPhant.png")));

            MenuItem it_show = new MenuItem ("Show");
            it_show.Activated += new EventHandler (TIconShow);

            MenuItem it_options = new MenuItem ("Options");
            it_options.Activated += new EventHandler (TIconOptions);

            ImageMenuItem it_quit = new ImageMenuItem("Quit");
            it_quit.Activated += new EventHandler (TIconQuit);

            menu.Append (it_show);
            menu.Append (it_options);
            menu.Append (it_quit);

               	   t = new TrayIcon ("eLePhantGTK");
               	   t.Add (eb);
               	   t.ShowAll ();
        }
コード例 #3
0
ファイル: MenuBarController.cs プロジェクト: gclark916/Howler
        public MenuBarController()
        {
            MenuBar mb = new MenuBar();

            Menu filemenu = new Menu();
            MenuItem file = new MenuItem("File");
            file.Submenu = filemenu;

            ImageMenuItem importDirectoryMenuItem = new ImageMenuItem("Import Directory");
            importDirectoryMenuItem.Activated += ImportDirectoryMenuItemOnActivated;
            filemenu.Append(importDirectoryMenuItem);

            ImageMenuItem open = new ImageMenuItem(Stock.Open);
            filemenu.Append(open);

            SeparatorMenuItem sep = new SeparatorMenuItem();
            filemenu.Append(sep);

            ImageMenuItem exit = new ImageMenuItem(Stock.Quit);

            exit.Activated += (sender, args) => Application.Quit();
            filemenu.Append(exit);

            mb.Append(file);
            View = mb;
        }
コード例 #4
0
        public VolatileReader()
            : base("Volatile Reader")
        {
            this.Build ();
            SetDefaultSize(250,200);
            SetPosition(Gtk.WindowPosition.Center);
            DeleteEvent += delegate(object o, DeleteEventArgs args) {
                Application.Quit();
            };

            MenuBar bar = new MenuBar();

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

            MenuItem exit = new MenuItem("Exit");
            exit.Activated += delegate(object sender, EventArgs e) {
                Application.Quit();
            };

            MenuItem openFile = new MenuItem("Open file...");
            openFile.Activated += OpenFile;

            fileMenu.Append(openFile);
            fileMenu.Append(exit);

            bar.Append(fileMenuItem);

            _vbox = new VBox(false, 2);
            _vbox.PackStart(bar, false, false, 0);

            this.Add(_vbox);
            this.ShowAll();
        }
コード例 #5
0
        public AppMenuBar()
            : base()
        {
            /* File menu */
            fileMenuItem =
                new MenuItem (Catalog.GetString ("_File"));
            Append (fileMenuItem);

            Menu menu = new Menu ();
              fileMenuItem.Submenu = menu;
              menu.Append (new SeparatorMenuItem ());
            ImageMenuItem item =
                new ImageMenuItem (Catalog.
                           GetString ("_Quit"));
              item.Image = new Image (Stock.Quit, IconSize.Menu);
              item.Activated += OnQuit;
              quitMenuItem = item;

              menu.Append (item);

            /* Edit menu */
              editMenuItem =
                new MenuItem (Catalog.GetString ("_Edit"));
              editMenuItem.Submenu = new Menu ();
              Append (editMenuItem);

            /* View menu */
              viewMenuItem =
                new MenuItem (Catalog.GetString ("_View"));
              viewMenuItem.Submenu = new Menu ();
              Append (viewMenuItem);

            /* Help menu */
              helpMenuItem =
                new MenuItem (Catalog.GetString ("_Help"));
              Append (helpMenuItem);

              menu = new Menu ();
              helpMenuItem.Submenu = menu;

              item = new ImageMenuItem (Catalog.
                            GetString ("_About"));
              item.Image = new Image (Stock.About, IconSize.Menu);
              item.Activated += OnAbout;
              menu.Append (item);

              item = new ImageMenuItem (Catalog.
                            GetString ("_Contents"));
              item.Activated += OnContents;
              item.Image = new Image (Stock.Help, IconSize.Menu);
              menu.Append (item);

              ShowAll ();
        }
コード例 #6
0
ファイル: TrayIcon.cs プロジェクト: ArsenShnurkov/beagle-1
		private Gtk.Menu MakeMenu (Gtk.Widget parent) 
		{
			Gtk.Menu menu = new Gtk.Menu ();
			menu.AttachToWidget (parent, new Gtk.MenuDetachFunc (DetachWidget));
			
			Gtk.ImageMenuItem item;
						
			// Quick Search menu items
			if (recent_searches.Count == 0) {
				item = new Gtk.ImageMenuItem (Catalog.GetString ("No Recent Searches"));
				item.Sensitive = false;
				menu.Append (item);
				menu_to_query_map = null;
			} else {
				item = new Gtk.ImageMenuItem (Catalog.GetString ("Recent Searches"));
				item.Sensitive = false;
				item.Image = new Gtk.Image (Stock.Find, IconSize.Menu);
				menu.Append (item);

				menu_to_query_map = new Hashtable ();

				foreach (string s in recent_searches) {
					// Replace all occurences of '_' with "__"
					// so that underscores don't become mnemonics.
					string query = s.Replace ("_", "__");

					item = new Gtk.ImageMenuItem (query);
					item.Activated += new EventHandler (OnSearch);
					menu.Append (item);
					menu_to_query_map [item] = s;
				}
			}			

			if (recent_searches.Count > 0) {
				item = new Gtk.ImageMenuItem (Catalog.GetString ("Clear"));
				item.Image = new Gtk.Image (Gtk.Stock.Clear, Gtk.IconSize.Menu);
				item.Activated += new EventHandler (OnClear);
				menu.Append (item);
			}

			menu.Append (new Gtk.SeparatorMenuItem ());			
		
			item = new Gtk.ImageMenuItem (Catalog.GetString ("Quit"));
			item.Image = new Gtk.Image (Gtk.Stock.Quit, Gtk.IconSize.Menu);
			item.Activated += new EventHandler (OnQuit);
			menu.Append (item);
			
			menu.ShowAll ();
			return menu;
		}
コード例 #7
0
    public static Gtk.MenuItem MakeMenuItem(Gtk.Menu menu, string l, EventHandler e, bool enabled)
    {
        Gtk.MenuItem  i;
        Gtk.StockItem item = Gtk.StockItem.Zero;

        if (Gtk.StockManager.Lookup(l, ref item))
        {
            i = new Gtk.ImageMenuItem(l, new Gtk.AccelGroup());
        }
        else
        {
            i = new Gtk.MenuItem(l);
        }

        if (e != null)
        {
            i.Activated += e;
        }

        i.Sensitive = enabled;

        menu.Append(i);
        i.Show();

        return(i);
    }
コード例 #8
0
		Gtk.MenuBar CreateMenus ()
		{
			AccelGroup group = new AccelGroup ();
			MenuBar bar = new MenuBar ();
			
			Menu file_menu = new Menu ();
			MenuItem file_menu_item = new MenuItem ("_File");
			file_menu_item.Submenu = file_menu;
			
			ImageMenuItem file_exit = new ImageMenuItem (Gtk.Stock.Quit, group);
			file_exit.Activated += new EventHandler (exit_cb);
			file_menu.Append (file_exit);
			bar.Append (file_menu_item);

			Menu help_menu = new Menu ();
			ImageMenuItem help_menu_item = new ImageMenuItem (Gtk.Stock.Help, group);
			help_menu_item.Submenu = help_menu;
			
			ImageMenuItem file_help = new ImageMenuItem (Gnome.Stock.About, group);
			file_help.Activated += new EventHandler (about_cb);
			help_menu.Append (file_help);
			bar.Append (help_menu_item);
			bar.ShowAll ();

			return bar;
		}
コード例 #9
0
ファイル: DemoMenus.cs プロジェクト: liberostelios/gtk-sharp
		private Menu CreateMenu (int depth, bool tearoff)
		{
			if (depth < 1)
				return null;

			Menu menu = new Menu ();
			RadioMenuItem[] group = null;

			if (tearoff) {
				TearoffMenuItem menuitem = new TearoffMenuItem ();
				menu.Append (menuitem);
			}

			for (int i = 0, j = 1; i < 5; i++, j++) {
				RadioMenuItem menuitem = new RadioMenuItem (group, String.Format ("item {0} - {1}", depth, j));
				group = menuitem.Group;

				menu.Append (menuitem);
				if (i == 3)
					menuitem.Sensitive = false;

				menuitem.Submenu = CreateMenu ((depth - 1), true);
			}

			return menu;
		}
コード例 #10
0
        public TrackListHeaderMenuController(BaseTrackListViewController trackListViewController)
        {
            var visibleColumns = trackListViewController.GetColumnTrackProperties().ToHashSet();

            Menu headerMenu = new Menu();

            foreach (TrackProperty trackProperty in Enum.GetValues(typeof(TrackProperty)))
            {
                var trackPropertyMenuItem = new CheckMenuItem(Extensions.GetEnumDescription(trackProperty));
                if (visibleColumns.Contains(trackProperty))
                    trackPropertyMenuItem.Active = true;
                TrackProperty property = trackProperty;
                trackPropertyMenuItem.Toggled += (sender, args) =>
                    {
                        if (trackPropertyMenuItem.Active)
                            trackListViewController.InsertColumn(property, ClickedProperty);
                        else
                            trackListViewController.RemoveColumn(property);
                    };
                headerMenu.Append(trackPropertyMenuItem);
            }

            View = headerMenu;
            View.ShowAll();
        }
コード例 #11
0
ファイル: Menu.cs プロジェクト: akrisiun/gtk-sharp
		public static void Main21 (string[] args)
		{
			Application.Init();
			Window win = new Window ("Menu Sample App");
			win.DeleteEvent += new DeleteEventHandler (delete_cb);
			win.DefaultWidth = 200;
			win.DefaultHeight = 150;

			VBox box = new VBox (false, 2);

			MenuBar mb = new MenuBar ();
			Menu file_menu = new Menu ();
			MenuItem exit_item = new MenuItem("Exit");
			exit_item.Activated += new EventHandler (exit_cb);
			file_menu.Append (exit_item);
			MenuItem file_item = new MenuItem("File");
			file_item.Submenu = file_menu;
			mb.Append (file_item);
			box.PackStart(mb, false, false, 0);

			Button btn = new Button ("Yep, that's a menu");
			box.PackStart(btn, true, true, 0);
			
			win.Add (box);
			win.ShowAll ();

			Application.Run ();
		}
コード例 #12
0
ファイル: MainMenu.cs プロジェクト: aaberg/DbUtils
        public void Build()
        {
            // file menu
            file = new MenuItem("File");
            fileMenu = new Menu();
            file.Submenu = fileMenu;

            openMenuItem = new MenuItem ("Open Sqlite database");
            openMenuItem.Activated += OnNewSqliteDbActivated;
            fileMenu.Append (openMenuItem);

            newSqlEditorMenuItem = new MenuItem ("New Sql Editor Tab");
            newSqlEditorMenuItem.Sensitive = false;
            newSqlEditorMenuItem.Activated += OnNewSqlEditorWindowActivated;
            fileMenu.Append (newSqlEditorMenuItem);

            exitMenuItem = new MenuItem ("Exit");
            exitMenuItem.Activated += OnExitActivated;
            fileMenu.Append (exitMenuItem);

            this.Append (file);

            // setup edit menu
            edit = new MenuItem("Edit");
            editMenu = new Menu ();
            edit.Submenu = editMenu;

            this.Append (edit);

            // setup database menu
            database = new MenuItem("Database");
            databaseMenu = new Menu ();
            database.Submenu = databaseMenu;

            newSqliteDbMenuItem = new MenuItem ("New Sqlite DB");
            newSqliteDbMenuItem.Activated += OnNewSqliteDbActivated;
            databaseMenu.Append (newSqliteDbMenuItem);
            openSqliteDbMenuItem = new MenuItem ("Open Sqlite DB");
            openSqliteDbMenuItem.Activated += OnOpenSqliteDbActivated;
            databaseMenu.Append (openSqliteDbMenuItem);
            this.Append (database);

            // initialize event handlers

            ApplicationState.Instance.CurrentConnectionChanged += (sender, e) => newSqlEditorMenuItem.Sensitive = e.DbServerConnection != null;
        }
コード例 #13
0
ファイル: ChatPageMenu.cs プロジェクト: codebutler/meshwork
 public ChatPageMenu(ChatSubpageBase page)
 {
     m_Page = page;
     m_Menu = new Menu();
     var closeItem = new ImageMenuItem(Stock.Close, null);
     closeItem.Activated += HandleCloseItemActivated;
     m_Menu.Append(closeItem);
     m_Menu.ShowAll();
 }
コード例 #14
0
ファイル: Main.cs プロジェクト: atsushieno/mldsp
        public static void Main(string[] args)
        {
            Application.Init ();
            //MainWindow win = new MainWindow ();
            //win.Show ();
            MoonlightRuntime.Init ();
            Window w = new Window ("mldsp");
            w.DefaultHeight = 520;
            w.DefaultWidth = 760;
            w.DeleteEvent += delegate { Application.Quit (); };

            var moon = new MoonlightHost ();
            var xappath = System.IO.Path.Combine (System.IO.Path.GetDirectoryName (new Uri (typeof (MainClass).Assembly.CodeBase).LocalPath), "mldsp.clr.xap");
            moon.LoadXap (xappath);
            if (args.Length > 0) {
                int device;
                if (int.TryParse (args [0], out device))
                    ((mldsp.App) moon.Application).OutputDeviceID = device;
                else {
                    Console.WriteLine ("WARNING: wrong device ID speficication. Specify an index.");
                    foreach (var dev in PortMidiSharp.MidiDeviceManager.AllDevices)
                        if (dev.IsOutput)
                            Console.WriteLine ("{0} {1}", dev.ID, dev.Name);
                }
            }

            var vbox = new VBox (false, 0);
            w.Add (vbox);
            var mainmenu = new MenuBar ();
            vbox.PackStart (mainmenu, false, true, 0);
            var optmi = new MenuItem ("_Options");
            mainmenu.Add (optmi);
            var devmi = new MenuItem ("Select Device");
            var optmenu = new Menu ();
            optmi.Submenu = optmenu;
            optmenu.Append (devmi);
            var devlist = new SList (IntPtr.Zero);
            var devmenu = new Menu ();
            devmi.Submenu = devmenu;
            foreach (var dev in PortMidiSharp.MidiDeviceManager.AllDevices) {
                if (dev.IsOutput) {
                    var mi = new RadioMenuItem (devlist, dev.Name);
                    mi.Data ["Device"] = dev.ID;
                    devlist = mi.Group;
                    int id = dev.ID;
                    mi.Activated += delegate {
                        ((mldsp.App) moon.Application).ResetDevice ((int) mi.Data ["Device"]);
                    };
                    devmenu.Append (mi);
                }
            }

            vbox.PackEnd (moon);

            w.ShowAll ();
            Application.Run ();
        }
コード例 #15
0
    public static void MakeMenuItem(Gtk.Menu menu, string l, EventHandler e, bool enabled)
    {
        Gtk.MenuItem i = new Gtk.MenuItem(l);
        i.Activated += e;
        i.Sensitive  = enabled;

        menu.Append(i);
        i.Show();
    }
コード例 #16
0
    public static Gtk.MenuItem MakeMenuItem(Gtk.Menu menu, string label, string image_name, EventHandler e, bool enabled)
    {
        Gtk.ImageMenuItem i = new Gtk.ImageMenuItem(label);
        i.Activated += e;
        i.Sensitive  = enabled;
        i.Image      = new Gtk.Image(image_name, Gtk.IconSize.Menu);

        menu.Append(i);
        i.Show();

        return(i);
    }
コード例 #17
0
 public Menu BuildAddToMenu(System.EventHandler handler)
 {
     Menu bookmarkMenu = new Menu();
     string[] bookmarks = m_App.CacheStore.GetBookmarkLists();
     foreach(string bookmark in bookmarks)
     {
         Action action = new Action(bookmark, bookmark);
         action.Activated += handler;
         bookmarkMenu.Append(action.CreateMenuItem());
     }
     return bookmarkMenu;
 }
コード例 #18
0
ファイル: Friends.cs プロジェクト: hekar/Vaporized
		private Gtk.MenuBar CreateMenu ()
		{
			MenuBar menu = new MenuBar ();
			
			// File
			Menu fileSub = new Menu ();
			MenuItem file = new MenuItem ("File");
			file.Submenu = fileSub;
			
			MenuItem login = new MenuItem ("Login");
			MenuItem exit = new MenuItem ("Exit");
			
			fileSub.Append (login);
			fileSub.Append (exit);
			
			// Options
			Menu optionSub = new Menu ();
			MenuItem option = new MenuItem ("Options");
			option.Submenu = optionSub;
			
			MenuItem preferences = new MenuItem ("Preferences");
			
			optionSub.Append (preferences);
			
			// Help
			Menu helpSub = new Menu ();
			MenuItem help = new MenuItem ("Help");
			help.Submenu = helpSub;
			
			MenuItem about = new MenuItem ("About");
			
			helpSub.Append (about);
			
			// Menubar
			menu.Append (file);
			menu.Append (option);
			menu.Append (help);
			
			return menu;
		}
コード例 #19
0
    public static Gtk.MenuItem MakeCheckMenuItem(Gtk.Menu menu, string label, EventHandler e, bool enabled, bool active, bool as_radio)
    {
        Gtk.CheckMenuItem i = new Gtk.CheckMenuItem(label);
        i.Activated  += e;
        i.Sensitive   = enabled;
        i.DrawAsRadio = as_radio;
        i.Active      = active;

        menu.Append(i);
        i.Show();

        return(i);
    }
コード例 #20
0
ファイル: CopyAs.cs プロジェクト: brwright321/tomboy-copy-as
        public override void Initialize()
        {
            Assembly asm = Assembly.GetExecutingAssembly();
            string asm_dir = System.IO.Path.GetDirectoryName(asm.Location);

            // if there are no xsl files - copy all xsl file resources to folder
            string[] xslFiles = System.IO.Directory.GetFiles(asm_dir, "CopyAs-*.xsl");
            if (xslFiles.Length == 0) {
                // copy initial files to add-in dir
                foreach (string xslFile in initialXslFiles) {
                    Stream resource = asm.GetManifestResourceStream(xslFile);
                    Stream dest = new FileStream(Path.Combine(asm_dir, xslFile),
                            FileMode.OpenOrCreate, FileAccess.Write);

                    byte[] buf = new byte[4096];
                    while (true) {
                        int n = resource.Read(buf, 0, buf.Length);
                        if (n == 0) {
                            break;
                        }
                        dest.Write(buf, 0, n);
                    }
                    dest.Close();
                }
                // list copied files
                xslFiles = System.IO.Directory.GetFiles(asm_dir, "CopyAs-*.xsl");
            }

            Menu menu = new Menu();
            foreach (string xslFile in xslFiles) {
                if (mainItem == null) {
                    mainItem = new Gtk.MenuItem(Catalog.GetString("Copy as"));
                    mainItem.Show();
             					AddPluginMenuItem(mainItem);
                    mainItem.Submenu = menu;
                }
                string menuName = xslFile.Substring(xslFile.IndexOf("-") + 1);
                menuName = menuName.Substring(0, menuName.Length - 4);
                       		MenuItem subItem = new Gtk.MenuItem(Catalog.GetString(menuName));
                subItem.Show();
                            subItem.Activated += OnMenuItemActivated;
                menu.Append(subItem);

                string stylesheet_file = Path.Combine(asm_dir, xslFile);
                XslTransform xsl = new XslTransform();
                xsl.Load(stylesheet_file);
                transformByMenuItem.Add(subItem, xsl);
            }
        }
コード例 #21
0
        Menu MakeMenu(IEnumerable<string> defs)
        {
            Menu tmp = new Menu();

            /*tmp.Append(new MenuItem("Toggle language"));
            tmp.Append(new SeparatorMenuItem());*/
            foreach (string langDef in defs) {
                CheckMenuItem cmi = new CheckMenuItem (langDef);
                cmi.Active = languageRepresentation.IsToggled (langDef);
                cmi.Activated += delegate { languageRepresentation.ToggleLangage(langDef); };
                tmp.Append(cmi);
            }

            return tmp;
        }
コード例 #22
0
ファイル: UserMenu.cs プロジェクト: codebutler/meshwork
        public UserMenu(Network network, Node node)
        {
            m_Menu = new Menu();

            m_MessageMenuItem = new MenuItem("_Message");
            m_MessageMenuItem.Activated += on_m_MessageMenuItem_activate;
            m_Menu.Append(m_MessageMenuItem);

            m_GetInfoMenuItem = new MenuItem("View _Info");
            m_GetInfoMenuItem.Activated += on_m_GetInfoMenuItem_activate;
            m_Menu.Append(m_GetInfoMenuItem);

            m_InviteChatMenuRoom = new MenuItem("In_vite to Chat...");
            m_InviteChatMenuRoom.Activated += on_m_InviteChatMenuRoom_activate;
            m_Menu.Append(m_InviteChatMenuRoom);

            m_Menu.Append(new SeparatorMenuItem());

            m_ConnectMenuItem = new MenuItem("C_onnect");
            m_ConnectMenuItem.Activated += on_mnuUsersConnectTo_activate;
            m_Menu.Append(m_ConnectMenuItem);

            m_Menu.Append(new SeparatorMenuItem());

            m_BrowseMenuItem = new MenuItem("_Browse");
            m_BrowseMenuItem.Activated += on_m_BrowseMenuItem_activate;
            m_Menu.Append(m_BrowseMenuItem);

            m_SendFileMenuItem = new MenuItem("Send _File...");
            m_SendFileMenuItem.Activated += on_m_SendFileMenuItem_activate;
            m_Menu.Append(m_SendFileMenuItem);

            m_TrustMenuItem = new MenuItem("_Trust");
            m_TrustMenuItem.Activated += on_m_TrustMenuItem_activate;
            m_Menu.Append(m_TrustMenuItem);

            m_Menu.ShowAll();

            this.selectedNode = node;
            this.network = network;
        }
コード例 #23
0
ファイル: ActionManager.cs プロジェクト: CoEST/TraceLab
        private MenuButton ConstrucRecentExperimentsMenuButton()
        {
            Menu recentExperimentsMenu = new Menu();

            foreach (RecentExperimentReference recentExp in m_applicationContext.Application.RecentExperiments) 
            {
                RecentExperimentMenuItem item = new RecentExperimentMenuItem(recentExp);
                item.Image = new Image(s_traceLabIcon);
                item.ExposeEvent += GtkMenuHelper.DrawImageMenuItemImage; 
                item.Activated += OpenExperiment;
                recentExperimentsMenu.Append(item);
            }

            recentExperimentsMenu.ShowAll();
            MenuButton recentExperimentButton = new MenuButton(new Image(Stock.Open, IconSize.SmallToolbar), recentExperimentsMenu, true);
            recentExperimentButton.TooltipText = "Select recent opened experiment";
            return recentExperimentButton;
        }
コード例 #24
0
ファイル: MenuBarWidget.cs プロジェクト: draptik/RepoSync
		private void Init ()
		{
			Menu helpMenu = new Menu ();

			MenuItem aboutItem = new MenuItem ("About");
			aboutItem.Activated += HandleAboutActivated;

			helpMenu.Append (aboutItem);
			MenuItem helpItem = new MenuItem ("Help");

			helpItem.Submenu = helpMenu;

			MenuBar menuBar = new MenuBar ();
			menuBar.Append (helpItem);

			var vbox = new Gtk.VBox ();
			vbox.PackStart (menuBar, false, false, 0);
			this.Add (vbox);
		}
コード例 #25
0
 public Menu BuildBookmarkMenu()
 {
     Menu bookmarkMenu = new Menu();
     string[] bookmarks = m_App.CacheStore.GetBookmarkLists();
     int count = 0;
     RadioAction noList = new RadioAction("None", Catalog.GetString("None"), null, null, count);
     noList.Active = true;
     noList.Toggled += HandleNoListToggled;
     bookmarkMenu.Append(noList.CreateMenuItem());
     foreach(string bookmark in bookmarks)
     {
         RadioAction action = new RadioAction(bookmark, bookmark, null, null, count);
         action.Group = noList.Group;
         if (bookmark == m_App.CacheStore.ActiveBookmarkList)
             action.Active = true;
         action.Toggled += HandleActionToggled;
         bookmarkMenu.Append(action.CreateMenuItem());
     }
     return bookmarkMenu;
 }
コード例 #26
0
    private void popupMenu()
    {
        Gtk.Menu popupMenu = new Gtk.Menu();

        foreach (Sector sector in level.Sectors)
        {
            Gtk.MenuItem item = new Gtk.MenuItem(sector.Name);
            item.Name       = sector.Name;
            item.Activated += OnSectorItemActivated;
            popupMenu.Add(item);
        }
        popupMenu.Add(new Gtk.SeparatorMenuItem());

        Gtk.MenuItem propertiesItem = new Gtk.ImageMenuItem(Gtk.Stock.Properties, null);
        propertiesItem.Activated += OnPropertiesActivated;
        popupMenu.Add(propertiesItem);

        Gtk.ImageMenuItem camPropsItem = new Gtk.ImageMenuItem("Camera Properties");
        camPropsItem.Activated += OnCameraPropertiesActivated;
        //camPropsItem.Image = Image(EditorStock.CameraMenuImage); //TODO: find out how to set custom image
        popupMenu.Add(camPropsItem);

        Gtk.MenuItem resizeItem = new Gtk.MenuItem("Resize");
        resizeItem.Activated += OnResizeActivated;
        popupMenu.Add(resizeItem);

        Gtk.MenuItem createNewItem = new Gtk.ImageMenuItem(Gtk.Stock.New, null);
        createNewItem.Activated += OnCreateNew;
        popupMenu.Add(createNewItem);

        Gtk.MenuItem deleteItem = new Gtk.ImageMenuItem(Gtk.Stock.Delete, null);
        deleteItem.Activated += OnDeleteActivated;
        popupMenu.Add(deleteItem);

        Gtk.MenuItem CheckIDsItem = new Gtk.MenuItem("Check all tilemaps for bad tile IDs");
        CheckIDsItem.Activated += OnCheckIDs;
        popupMenu.Append(CheckIDsItem);

        popupMenu.ShowAll();
        popupMenu.Popup();
    }
コード例 #27
0
ファイル: TestMenus.cs プロジェクト: saraa/fishtastic
        static Menu Create_Menu(int depth, bool tearoff)
        {
            if (depth < 1)
                return null;

            Menu menu = new Menu ();
            MenuItem menuitem = null;
            string label = null;
            GLib.SList group = new GLib.SList (IntPtr.Zero);

            if (tearoff) {
                menuitem = new TearoffMenuItem ();
                menu.Append (menuitem);
                menuitem.Show ();
            }

            for (int i = 0, j = 1; i < 5; i++, j++) {

                label = String.Format ("item {0} - {1}", depth, j);
                menuitem = new RadioMenuItem (group, label);
                group = ((RadioMenuItem) menuitem).Group;
                menuitem = new MenuItem (label);
                menu.Append (menuitem);

                if (i == 3)
                    menuitem.Sensitive = false;

                Menu child = Create_Menu ((depth - 1), true);

                if (child != null)
                    menuitem.Submenu = child;
            }

            return menu;
        }
コード例 #28
0
        private MenuBar CreateShortcutsBar()
        {
            // Adds a hidden menubar that contains to enable keyboard
            // shortcuts to close the log
            MenuBar menu_bar = new MenuBar ();

                MenuItem file_item = new MenuItem ("File");

                    Menu file_menu = new Menu ();

                        MenuItem close_1 = new MenuItem ("Close1");
                        MenuItem close_2 = new MenuItem ("Close2");

                        // adds specific Ctrl+W and Esc key accelerators to Log Window
                        AccelGroup accel_group = new AccelGroup ();
                        AddAccelGroup (accel_group);

                        // Close on Esc
                        close_1.AddAccelerator ("activate", accel_group, new AccelKey (Gdk.Key.W, Gdk.ModifierType.ControlMask,
                            AccelFlags.Visible));

                        close_1.Activated += delegate { HideAll (); };

                        // Close on Ctrl+W
                        close_2.AddAccelerator ("activate", accel_group, new AccelKey (Gdk.Key.Escape, Gdk.ModifierType.None,
                            AccelFlags.Visible));
                        close_2.Activated += delegate { HideAll (); };

                    file_menu.Append (close_1);
                    file_menu.Append (close_2);

                file_item.Submenu = file_menu;

            menu_bar.Append (file_item);

            // Hacky way to hide the menubar, but the accellerators
            // will simply be disabled when using Hide ()
            menu_bar.HeightRequest = 1;
            menu_bar.ModifyBg (StateType.Normal, Style.Background (StateType.Normal));

            return menu_bar;
        }
コード例 #29
0
ファイル: TrackActions.cs プロジェクト: kelsieflynn/banshee
        // Called when the Add to Playlist action is highlighted.
        // Generates the menu of playlists to which you can add the selected tracks.
        private void OnAddToPlaylistMenu(object o, List<Source> children)
        {
            Source active_source = ServiceManager.SourceManager.ActiveSource;

            // TODO find just the menu that was activated instead of modifying all proxies
            foreach (Widget proxy_widget in ((Gtk.Action)o).Proxies) {
                MenuItem menu = proxy_widget as MenuItem;
                if (menu == null)
                    continue;

                Menu submenu = new Menu ();
                menu.Submenu = submenu;

                submenu.Append (this ["AddToNewPlaylistAction"].CreateMenuItem ());
                bool separator_added = false;

                foreach (Source child in children) {
                    PlaylistSource playlist = child as PlaylistSource;
                    if (playlist != null) {
                        if (!separator_added) {
                            submenu.Append (new SeparatorMenuItem ());
                            separator_added = true;
                        }

                        PlaylistMenuItem item = new PlaylistMenuItem (playlist);
                        item.Image = new Gtk.Image ("playlist-source", IconSize.Menu);
                        item.Activated += OnAddToExistingPlaylist;
                        item.Sensitive = playlist != active_source;
                        submenu.Append (item);
                    }
                }

                submenu.ShowAll ();
            }
        }
コード例 #30
0
		void AddLanguageMenuItems (Menu menu, SolutionTemplate template)
		{
			foreach (string language in template.AvailableLanguages.OrderBy (item => item)) {
				var menuItem = new MenuItem (language);
				menuItem.Activated += (o, e) => {
					templateTextRenderer.SelectedLanguage = language;
					controller.SelectedLanguage = language;
					templatesTreeView.QueueDraw ();
					ShowSelectedTemplate ();
				};
				menu.Append (menuItem);
			}
		}
コード例 #31
0
 private MenuBar CreateNormalMenu()
 {
     MenuBar menubar = new MenuBar ();
        AccelGroup agrp = new AccelGroup();
        this.AddAccelGroup(agrp);
        Menu iFolderMenu = new Menu();
        NewMenuItem = new ImageMenuItem (Util.GS("_Upload a folder..."));
        NewMenuItem.Image = new Image(
      new Gdk.Pixbuf(Util.ImagesPath("ifolder24.png")));
        iFolderMenu.Append(NewMenuItem);
        NewMenuItem.AddAccelerator("activate", agrp,
     new AccelKey(Gdk.Key.N, Gdk.ModifierType.ControlMask,
     AccelFlags.Visible));
        NewMenuItem.Activated += new EventHandler(AddiFolderHandler);
        DownloadMenuItem =
     new MenuItem (Util.GS("_Download..."));
        iFolderMenu.Append(DownloadMenuItem);
        DownloadMenuItem.Activated += new EventHandler(DownloadAvailableiFolderHandler);
        DeleteMenuItem =
     new ImageMenuItem (Util.GS("Dele_te from server"));
        DeleteMenuItem.Image = new Image(Stock.Delete, Gtk.IconSize.Menu);
        iFolderMenu.Append(DeleteMenuItem);
        DeleteMenuItem.Activated += new EventHandler(DeleteFromServerHandler);
        RemoveMenuItem =
     new ImageMenuItem (Util.GS("Re_move my membership"));
        RemoveMenuItem.Image = new Image(Stock.Delete, Gtk.IconSize.Menu);
        iFolderMenu.Append(RemoveMenuItem);
        RemoveMenuItem.Activated += new EventHandler(RemoveMembershipHandler);
        iFolderMenu.Append(new SeparatorMenuItem());
        OpenMenuItem = new ImageMenuItem ( Stock.Open, agrp );
        iFolderMenu.Append(OpenMenuItem);
        OpenMenuItem.Activated += new EventHandler(OnOpenSynchronizedFolder);
        ShareMenuItem = new MenuItem (Util.GS("Share _with..."));
        iFolderMenu.Append(ShareMenuItem);
        ShareMenuItem.Activated += new EventHandler(OnShareSynchronizedFolder);
        ConflictMenuItem = new MenuItem (Util.GS("Resolve conflic_ts"));
        iFolderMenu.Append(ConflictMenuItem);
        ConflictMenuItem.Activated +=
      new EventHandler(OnResolveConflicts);
        SyncNowMenuItem = new MenuItem(Util.GS("S_ynchronize now"));
        iFolderMenu.Append(SyncNowMenuItem);
        SyncNowMenuItem.Activated += new EventHandler(OnSynchronizeNow);
        RevertMenuItem =
     new ImageMenuItem (Util.GS("C_hange to a normal folder"));
        RevertMenuItem.Image = new Image(Stock.Undo, Gtk.IconSize.Menu);
        iFolderMenu.Append(RevertMenuItem);
        RevertMenuItem.Activated += new EventHandler(RemoveiFolderHandler);
        PropMenuItem = new ImageMenuItem (Stock.Properties, agrp);
        iFolderMenu.Append(PropMenuItem);
        PropMenuItem.Activated += new EventHandler(OnShowFolderProperties);
        iFolderMenu.Append(new SeparatorMenuItem());
        CloseMenuItem = new ImageMenuItem (Stock.Close, agrp);
        iFolderMenu.Append(CloseMenuItem);
        CloseMenuItem.Activated += new EventHandler(CloseEventHandler);
        QuitMenuItem = new ImageMenuItem(Stock.Quit, agrp);
        iFolderMenu.Append(QuitMenuItem);
        QuitMenuItem.Activated += new EventHandler(QuitEventHandler);
        MenuItem iFolderMenuItem = new MenuItem(Util.GS("i_Folder"));
        iFolderMenuItem.Submenu = iFolderMenu;
        menubar.Append (iFolderMenuItem);
        Menu EditMenu = new Menu();
        AccountsMenuItem =
     new MenuItem (Util.GS("_Account Settings..."));
        EditMenu.Append(AccountsMenuItem);
        AccountsMenuItem.Activated += new EventHandler(AccountsMenuItemHandler);
        PreferencesMenuItem = new ImageMenuItem(Util.GS("_Preferences"));
        PreferencesMenuItem.Image = new Image(Stock.Preferences, Gtk.IconSize.Menu);
        EditMenu.Append(PreferencesMenuItem);
        PreferencesMenuItem.Activated += new EventHandler(ShowPreferencesHandler);
        MenuItem EditMenuItem = new MenuItem(Util.GS("_Edit"));
        EditMenuItem.Submenu = EditMenu;
        menubar.Append(EditMenuItem);
        Menu ViewMenu = new Menu();
        RefreshMenuItem =
     new ImageMenuItem(Stock.Refresh, agrp);
        ViewMenu.Append(RefreshMenuItem);
        RefreshMenuItem.Activated +=
      new EventHandler(RefreshiFoldersHandler);
        ViewMenu.Append(new SeparatorMenuItem());
        SyncLogMenuItem =
     new MenuItem (Util.GS("Synchronization _Log"));
        ViewMenu.Append(SyncLogMenuItem);
        SyncLogMenuItem.Activated += new EventHandler(SyncLogMenuItemHandler);
        ViewMenu.Append(new SeparatorMenuItem());
        ViewServeriFoldersMenuItem =
     new CheckMenuItem(Util.GS("View _available iFolders"));
        ViewMenu.Append(ViewServeriFoldersMenuItem);
        ViewServeriFoldersMenuItem.Toggled +=
     new EventHandler(OnToggleViewServeriFoldersMenuItem);
        MenuItem showColorPaletteMenuItem =
     new MenuItem("Show _Color Palette (FIXME: Remove this before shipping)...");
        ViewMenu.Append(showColorPaletteMenuItem);
        showColorPaletteMenuItem.Activated += ShowColorPalette;
        MenuItem ViewMenuItem = new MenuItem(Util.GS("_View"));
        ViewMenuItem.Submenu = ViewMenu;
        menubar.Append(ViewMenuItem);
        Menu HelpMenu = new Menu();
        HelpMenuItem =
     new ImageMenuItem(Stock.Help, agrp);
        HelpMenu.Append(HelpMenuItem);
        HelpMenuItem.Activated += new EventHandler(OnHelpMenuItem);
        AboutMenuItem = new ImageMenuItem(Util.GS("A_bout"));
        AboutMenuItem.Image = new Image(Gnome.Stock.About,
        Gtk.IconSize.Menu);
        HelpMenu.Append(AboutMenuItem);
        AboutMenuItem.Activated += new EventHandler(OnAbout);
        MenuItem MainHelpMenuItem = new MenuItem(Util.GS("_Help"));
        MainHelpMenuItem.Submenu = HelpMenu;
        menubar.Append(MainHelpMenuItem);
        return menubar;
 }
コード例 #32
0
        public Menu BuildLocationlMenu()
        {
            Menu etMenu = new Menu();

            Gtk.Action home_action = new Gtk.Action("Home", Catalog.GetString("Home"));
            etMenu.Append(home_action.CreateMenuItem());
            home_action.Activated += HandleHome_actionActivated;
            int iCount = 0;
            foreach (Location loc in m_locations.Values)
            {
                Gtk.Action action = new Gtk.Action(loc.Name, loc.Name);
                etMenu.Append(action.CreateMenuItem());
                action.Activated += HandleActionActivated;
                iCount ++;

            }
            etMenu.Append(new MenuItem());
            gpsdAction = new ToggleAction("UseGPSD", Catalog.GetString("GPSD Position"),null, null);
            //gpsdAction.Active = UIMonitor.getInstance().Configuration.UseGPSD;
            gpsdAction.Toggled += HandleGpsdActionToggled;
            etMenu.Append(gpsdAction.CreateMenuItem());
            etMenu.ShowAll();
            return etMenu;
        }
コード例 #33
0
 private void OniFolderClicked(object o, iFolderClickedArgs args)
 {
     iFolderHolder holder = args.Holder;
        if (holder == null) return;
        switch(args.Button)
        {
     case 3:
      Menu menu = new Menu();
      if (holder.iFolder.IsSubscription)
      {
       MenuItem item_download =
        new MenuItem(Util.GS("Download..."));
       menu.Append(item_download);
       item_download.Activated += new EventHandler(
     DownloadAvailableiFolderHandler);
       menu.Append(new SeparatorMenuItem());
       DomainInformation domain =
        domainController.GetDomain(holder.iFolder.DomainID);
       if (domain == null ||
        domain.MemberUserID == holder.iFolder.OwnerID)
       {
        MenuItem item_delete = new MenuItem (
      Util.GS("Delete from server"));
        menu.Append (item_delete);
        item_delete.Activated += new EventHandler(
      DeleteFromServerHandler);
       }
       else
       {
        MenuItem item_remove_membership = new MenuItem (
      Util.GS("Remove my membership"));
        menu.Append (item_remove_membership);
        item_remove_membership.Activated +=
     new EventHandler(
      RemoveMembershipHandler);
       }
      }
      else
      {
       MenuItem item_open =
        new MenuItem (Util.GS("Open..."));
       menu.Append (item_open);
       item_open.Activated += new EventHandler(
     OnOpenFolderMenu);
       menu.Append(new SeparatorMenuItem());
       if(holder.iFolder.HasConflicts)
       {
        MenuItem item_resolve = new MenuItem (
      Util.GS("Resolve conflicts..."));
        menu.Append (item_resolve);
        item_resolve.Activated += new EventHandler(
     OnResolveConflicts);
        menu.Append(new SeparatorMenuItem());
       }
       MenuItem item_sync =
        new MenuItem(Util.GS("Synchronize now"));
       menu.Append (item_sync);
       item_sync.Activated += new EventHandler(
     OnSynchronizeNow);
       MenuItem item_share =
        new MenuItem (Util.GS("Share with..."));
       menu.Append (item_share);
       item_share.Activated += new EventHandler(
     OnShareSynchronizedFolder);
       if (!holder.iFolder.Role.Equals("Master"))
       {
        MenuItem item_revert = new MenuItem (
      Util.GS("Revert to a normal folder"));
        menu.Append (item_revert);
        item_revert.Activated += new EventHandler(
      RemoveiFolderHandler);
       }
       else if(holder.iFolder.OwnerID !=
       holder.iFolder.CurrentUserID)
       {
        MenuItem item_delete = new MenuItem (
      Util.GS("Revert to a normal folder"));
        menu.Append (item_delete);
        item_delete.Activated += new EventHandler(
      RemoveiFolderHandler);
       }
       menu.Append(new SeparatorMenuItem());
       MenuItem item_properties =
        new MenuItem (Util.GS("Properties"));
       menu.Append (item_properties);
       item_properties.Activated +=
        new EventHandler(OnShowFolderProperties);
      }
      menu.ShowAll();
      menu.Popup(null, null, null,
       IntPtr.Zero, 3,
       Gtk.Global.CurrentEventTime);
      break;
     default:
      break;
        }
 }
コード例 #34
0
 private void OniFolderIconViewBackgroundClicked(object o, iFolderClickedArgs args)
 {
     iFoldersIconView.UnselectAll();
        if (args.Button == 3)
        {
     Menu menu = new Menu();
     MenuItem item_refresh =
      new MenuItem(Util.GS("Refresh"));
     menu.Append(item_refresh);
     item_refresh.Activated += new EventHandler(
      RefreshiFoldersHandler);
     menu.ShowAll();
     menu.Popup(null, null, null,
      IntPtr.Zero, 3,
      Gtk.Global.CurrentEventTime);
        }
 }
コード例 #35
0
 private MenuBar CreateWelcomeMenuBar()
 {
     MenuBar menubar = new MenuBar ();
        AccelGroup agrp = new AccelGroup();
        this.AddAccelGroup(agrp);
        Menu menu = new Menu();
        ImageMenuItem imageMenuItem = new ImageMenuItem (Util.GS("Connect to a _server"));
        Gdk.Pixbuf pixbuf = new Gdk.Pixbuf(Util.ImagesPath("add-account.png"));
        pixbuf = pixbuf.ScaleSimple(24, 24, Gdk.InterpType.Bilinear);
        imageMenuItem.Image = new Image(pixbuf);
        menu.Append(imageMenuItem);
        imageMenuItem.AddAccelerator("activate", agrp,
     new AccelKey(Gdk.Key.S, Gdk.ModifierType.ControlMask,
     AccelFlags.Visible));
        imageMenuItem.Activated += new EventHandler(OnAddNewAccount);
        menu.Append(new SeparatorMenuItem());
        imageMenuItem = new ImageMenuItem (Stock.Close, agrp);
        menu.Append(imageMenuItem);
        imageMenuItem.Activated += new EventHandler(CloseEventHandler);
        imageMenuItem = new ImageMenuItem(Stock.Quit, agrp);
        menu.Append(imageMenuItem);
        imageMenuItem.Activated += new EventHandler(QuitEventHandler);
        MenuItem menuItem = new MenuItem(Util.GS("i_Folder"));
        menuItem.Submenu = menu;
        menubar.Append (menuItem);
        menu = new Menu();
        imageMenuItem = new ImageMenuItem(Util.GS("_Preferences"));
        imageMenuItem.Image = new Image(Stock.Preferences, Gtk.IconSize.Menu);
        menu.Append(imageMenuItem);
        imageMenuItem.Activated += new EventHandler(ShowPreferencesHandler);
        menuItem = new MenuItem(Util.GS("_Edit"));
        menuItem.Submenu = menu;
        menubar.Append(menuItem);
        menu = new Menu();
        imageMenuItem = new ImageMenuItem(Stock.Help, agrp);
        menu.Append(imageMenuItem);
        imageMenuItem.Activated += new EventHandler(OnHelpMenuItem);
        imageMenuItem = new ImageMenuItem(Util.GS("A_bout"));
        imageMenuItem.Image = new Image(Gnome.Stock.About,
        Gtk.IconSize.Menu);
        menu.Append(imageMenuItem);
        imageMenuItem.Activated += new EventHandler(OnAbout);
        menuItem = new MenuItem(Util.GS("_Help"));
        menuItem.Submenu = menu;
        menubar.Append(menuItem);
        return menubar;
 }
コード例 #36
0
ファイル: Servers.cs プロジェクト: pengpercy/lphant
        public TServers(CInterfaceGateway in_krnGateway, Glade.XML gxml, Gtk.TextView log)

        /*public TServers (Gtk.TreeView tv, Gtk.TextView log, CInterfaceGateway in_krnGateway,
         *                                      Gtk.Button btn1,Gtk.Button btn2,Gtk.Entry txt1,Gtk.Entry txt2,Gtk.Entry txt3)*/
        {
            krnGateway = in_krnGateway;
            krnGateway.OnLogMessage += new LogEvent(m_Log);
            krnGateway.OnNewServer  += new ServerEvent(OnNewServer);
            //btnAddServer = btn1;
            btnAddServer = (gxml.GetWidget("btnAddServer") as Button);
            //btnDownloadServers = btn2;
            btnDownloadServers = (gxml.GetWidget("btnDownloadServers") as Button);
            //txtDownloadServers = txt1;
            txtDownloadServers = (gxml.GetWidget("txtDownloadServers") as Entry);
            //txtServerIp = txt2;
            txtServerIp = (gxml.GetWidget("txtServerIp") as Entry);
            //txtServerPort = txt3;
            txtServerPort = (gxml.GetWidget("txtServerPort") as Entry);
            txtServerLog  = log;            //I don't use gxml due to problems with buffer
            buffer        = txtServerLog.Buffer;
            /*tvServers = tv;*/
            tvServers = (gxml.GetWidget("tvServers") as TreeView);

            stServers = new TreeStore(typeof(string), typeof(string), typeof(string),
                                      typeof(string), typeof(string), typeof(string));
            tvServers.Model = stServers;

            Gtk.TreeViewColumn tvc = new TreeViewColumn("Server Name", new CellRendererText(), "text", 0);
            tvServers.AppendColumn(tvc);
            tvc.SortColumnId = 0;
            tvc.Resizable    = true;

            tvc = new TreeViewColumn("Address", new CellRendererText(), "text", 1);
            tvServers.AppendColumn(tvc);
            tvc.SortColumnId = 1;
            tvc.Resizable    = true;

            tvc = new TreeViewColumn("Failed", new CellRendererText(), "text", 2);
            tvServers.AppendColumn(tvc);
            tvc.SortColumnId = 2;
            tvc.Resizable    = true;

            tvc = new TreeViewColumn("Files", new CellRendererText(), "text", 3);
            tvServers.AppendColumn(tvc);
            tvc.SortColumnId = 3;
            tvc.Resizable    = true;

            tvc = new TreeViewColumn("Users", new CellRendererText(), "text", 4);
            tvServers.AppendColumn(tvc);
            tvc.SortColumnId = 4;
            tvc.Resizable    = true;

            tvc = new TreeViewColumn("Priority", new CellRendererText(), "text", 5);
            tvServers.AppendColumn(tvc);
            tvc.SortColumnId = 5;
            tvc.Resizable    = true;

            menu = new Gtk.Menu();
            MenuItem it_Connect = new MenuItem("Connect");

            it_Connect.Activated += new EventHandler(ConnectTo);
            MenuItem it_Copy = new MenuItem("Copy to clipboard");

            it_Copy.Activated += new EventHandler(CopyLink);
            MenuItem it_Delete = new MenuItem("Delete");

            it_Delete.Activated += new EventHandler(Delete);

            menu.Append(it_Connect);
            menu.Append(it_Copy);
            menu.Append(it_Delete);

            tvServers.ButtonPressEvent += new ButtonPressEventHandler(ButtonPressEvent);
            // tvServers.PopupMenu += new PopupMenuHandler(PopupMenuEvent);
            loadServers();
        }
コード例 #37
0
ファイル: EditActions.cs プロジェクト: JoeyScarr/Pinta
        public void CreateMainMenu(Gtk.Menu menu)
        {
            menu.Append(Undo.CreateAcceleratedMenuItem(Gdk.Key.Z, Gdk.ModifierType.ControlMask));

            ImageMenuItem redo = Redo.CreateAcceleratedMenuItem(Gdk.Key.Z, Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask);

            redo.AddAccelerator("activate", PintaCore.Actions.AccelGroup, new AccelKey(Gdk.Key.Y, Gdk.ModifierType.ControlMask, AccelFlags.Visible));
            menu.Append(redo);

            menu.AppendSeparator();
            menu.Append(Cut.CreateAcceleratedMenuItem(Gdk.Key.X, Gdk.ModifierType.ControlMask));
            menu.Append(Copy.CreateAcceleratedMenuItem(Gdk.Key.C, Gdk.ModifierType.ControlMask));
            menu.Append(CopyMerged.CreateAcceleratedMenuItem(Gdk.Key.C, Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask));
            menu.Append(Paste.CreateAcceleratedMenuItem(Gdk.Key.V, Gdk.ModifierType.ControlMask));
            menu.Append(PasteIntoNewLayer.CreateAcceleratedMenuItem(Gdk.Key.V, Gdk.ModifierType.ShiftMask | Gdk.ModifierType.ControlMask));
            menu.Append(PasteIntoNewImage.CreateAcceleratedMenuItem(Gdk.Key.V, Gdk.ModifierType.Mod1Mask | Gdk.ModifierType.ControlMask));

            menu.AppendSeparator();
            menu.Append(SelectAll.CreateAcceleratedMenuItem(Gdk.Key.A, Gdk.ModifierType.ControlMask));

            ImageMenuItem deslect = Deselect.CreateAcceleratedMenuItem(Gdk.Key.A, Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask);

            deslect.AddAccelerator("activate", PintaCore.Actions.AccelGroup, new AccelKey(Gdk.Key.D, Gdk.ModifierType.ControlMask, AccelFlags.Visible));
            menu.Append(deslect);

            menu.AppendSeparator();
            menu.Append(EraseSelection.CreateAcceleratedMenuItem(Gdk.Key.Delete, Gdk.ModifierType.None));
            menu.Append(FillSelection.CreateAcceleratedMenuItem(Gdk.Key.BackSpace, Gdk.ModifierType.None));
            menu.Append(InvertSelection.CreateAcceleratedMenuItem(Gdk.Key.I, Gdk.ModifierType.ControlMask));

            menu.AppendSeparator();
            Gtk.Action menu_action  = new Gtk.Action("Palette", Mono.Unix.Catalog.GetString("Palette"), null, null);
            Menu       palette_menu = (Menu)menu.AppendItem(menu_action.CreateSubMenuItem()).Submenu;

            palette_menu.Append(LoadPalette.CreateMenuItem());
            palette_menu.Append(SavePalette.CreateMenuItem());
            palette_menu.Append(ResetPalette.CreateMenuItem());
            palette_menu.Append(ResizePalette.CreateMenuItem());
        }
コード例 #38
0
        void MiniScreenSettings()
        {
            //Console.WriteLine("Right Click");

            Gtk.Menu     menu_settings = new Gtk.Menu();
            Gtk.MenuItem menuitem1     = new Gtk.MenuItem(Mono.Unix.Catalog.GetString("MiniScreen Resolution"));
            menu_settings.Append(menuitem1);
            // Submenu 1
            Gtk.Menu     menu_dim    = new Gtk.Menu();
            Gtk.MenuItem menuitem1_0 = new Gtk.MenuItem("300 x 240 (5:4)");
            menu_dim.Append(menuitem1_0);
            menuitem1_0.Show();
            menuitem1.Submenu = menu_dim;

            Gtk.MenuItem menuitem1_1 = new Gtk.MenuItem("400 x 320 (5:4)");
            menu_dim.Append(menuitem1_1);
            menuitem1_1.Show();

            Gtk.MenuItem menuitem1_6 = new Gtk.MenuItem("400 x 235 (16:9)");
            menu_dim.Append(menuitem1_6);
            menuitem1_6.Show();

            Gtk.MenuItem menuitem1_7 = new Gtk.MenuItem("300 x 176 (16:9)");
            menu_dim.Append(menuitem1_7);
            menuitem1_7.Show();

            Gtk.MenuItem menuitem1_2 = new Gtk.MenuItem("300 x 225 (4:3)");
            menu_dim.Append(menuitem1_2);
            menuitem1_2.Show();

            Gtk.MenuItem menuitem1_3 = new Gtk.MenuItem("200 x 150 (4:3)");
            menu_dim.Append(menuitem1_3);
            menuitem1_3.Show();

            Gtk.MenuItem menuitem1_4 = new Gtk.MenuItem("300 x 166 (9:5)");
            menu_dim.Append(menuitem1_4);
            menuitem1_4.Show();

            Gtk.MenuItem menuitem1_5 = new Gtk.MenuItem("200 x 111 (9:5)");
            menu_dim.Append(menuitem1_5);
            menuitem1_5.Show();


            // Opcio refreshRate

            Gtk.MenuItem menuitemRefreshRate = new Gtk.MenuItem(Mono.Unix.Catalog.GetString("Set Refresh Rate"));
            menu_settings.Append(menuitemRefreshRate);

            Gtk.Menu     menu_ref_rate    = new Gtk.Menu();
            Gtk.MenuItem menuitem_ref_500 = new Gtk.MenuItem(Mono.Unix.Catalog.GetString("500 ms (high refresh rate)"));
            menu_ref_rate.Append(menuitem_ref_500);
            menuitem_ref_500.Show();
            menuitemRefreshRate.Submenu = menu_ref_rate;

            Gtk.MenuItem menuitem_ref_750 = new Gtk.MenuItem(Mono.Unix.Catalog.GetString("750 ms"));
            menu_ref_rate.Append(menuitem_ref_750);
            menuitem_ref_750.Show();

            Gtk.MenuItem menuitem_ref_1000 = new Gtk.MenuItem(Mono.Unix.Catalog.GetString("1000 ms"));
            menu_ref_rate.Append(menuitem_ref_1000);
            menuitem_ref_1000.Show();

            Gtk.MenuItem menuitem_ref_1500 = new Gtk.MenuItem(Mono.Unix.Catalog.GetString("1500 ms"));
            menu_ref_rate.Append(menuitem_ref_1500);
            menuitem_ref_1500.Show();

            Gtk.MenuItem menuitem_ref_2000 = new Gtk.MenuItem(Mono.Unix.Catalog.GetString("2000 ms (low refresh rate)"));
            menu_ref_rate.Append(menuitem_ref_2000);
            menuitem_ref_2000.Show();



            // Opció 2

            Gtk.MenuItem menuitem2 = new Gtk.MenuItem(Mono.Unix.Catalog.GetString("Set path color"));
            menu_settings.Append(menuitem2);


            // Opció 3 - Submenú posició


            Gtk.Menu     menu_position = new Gtk.Menu();
            Gtk.MenuItem menuitem3     = new Gtk.MenuItem(Mono.Unix.Catalog.GetString("Window position"));
            menu_settings.Append(menuitem3);

            // Submenu 3
            Gtk.MenuItem menuitem3_0 = new Gtk.MenuItem(Mono.Unix.Catalog.GetString("Left"));
            menu_position.Append(menuitem3_0);
            menuitem3_0.Show();
            menuitem3.Submenu = menu_position;

            Gtk.MenuItem menuitem3_1 = new Gtk.MenuItem(Mono.Unix.Catalog.GetString("Right"));
            menu_position.Append(menuitem3_1);
            menuitem3_1.Show();

            // Opció 4 - Eixir
            Gtk.ImageMenuItem menuitem4 = new Gtk.ImageMenuItem(Stock.Quit, grup);
            menuitem4.RenderIcon(Stock.Quit, IconSize.Menu, Mono.Unix.Catalog.GetString("Exit from MiniScreen"));
            menu_settings.Append(menuitem4);

            // Opció 5 - About


            //Gtk.MenuItem menuitem5=new Gtk.MenuItem(Mono.Unix.Catalog.GetString("About"));
            //Gtk.ImageMenuItem menuitem5=new Gtk.MenuItem((Mono.Unix.Catalog.GetString("About"));


            Gtk.ImageMenuItem menuitem5 = new Gtk.ImageMenuItem(Stock.About, grup);
            menuitem5.RenderIcon(Stock.About, IconSize.Menu, Mono.Unix.Catalog.GetString("About LliureX MiniScreen"));
            menu_settings.Append(menuitem5);

            menuitem1.Show();
            menuitemRefreshRate.Show();
            menuitem2.Show();
            menuitem3.Show();
            menuitem4.Show();
            menuitem5.ShowAll();
            menuitem5.Show();

            menu_settings.Popup();

            menuitem1_0.ButtonPressEvent += HandleMenuitem1ButtonPressEvent;
            menuitem1_1.ButtonPressEvent += HandleMenuitem1ButtonPressEvent;
            menuitem1_2.ButtonPressEvent += HandleMenuitem1ButtonPressEvent;
            menuitem1_3.ButtonPressEvent += HandleMenuitem1ButtonPressEvent;
            menuitem1_4.ButtonPressEvent += HandleMenuitem1ButtonPressEvent;
            menuitem1_5.ButtonPressEvent += HandleMenuitem1ButtonPressEvent;
            menuitem1_6.ButtonPressEvent += HandleMenuitem1ButtonPressEvent;
            menuitem1_7.ButtonPressEvent += HandleMenuitem1ButtonPressEvent;


            menuitem_ref_500.ButtonPressEvent  += HandleMenuitem_ref_500ButtonPressEvent;
            menuitem_ref_750.ButtonPressEvent  += HandleMenuitem_ref_750ButtonPressEvent;
            menuitem_ref_1000.ButtonPressEvent += HandleMenuitem_ref_1000ButtonPressEvent;
            menuitem_ref_1500.ButtonPressEvent += HandleMenuitem_ref_1500ButtonPressEvent;
            menuitem_ref_2000.ButtonPressEvent += HandleMenuitem_ref_2000ButtonPressEvent;



            menuitem2.ButtonPressEvent += HandleMenuitem2ButtonPressEvent;

            menuitem3_0.ButtonPressEvent += HandleMenuitem3_0ButtonPressEvent;
            menuitem3_1.ButtonPressEvent += HandleMenuitem3_1ButtonPressEvent;
            menuitem4.ButtonPressEvent   += HandleMenuitem4ButtonPressEvent;
            menuitem5.ButtonPressEvent   += HandleMenuitem5ButtonPressEvent;
        }
コード例 #39
0
 public static void MakeMenuSeparator(Gtk.Menu menu)
 {
     Gtk.SeparatorMenuItem i = new Gtk.SeparatorMenuItem();
     menu.Append(i);
     i.Show();
 }