Esempio n. 1
0
        private void BuildHeader()
        {
            source_actions_align = new Gtk.Alignment(0f, .5f, 1f, 0f)
            {
                RightPadding = 0,
                LeftPadding  = 0,
                NoShowAll    = true
            };

            if (Hyena.PlatformDetection.IsMeeGo)
            {
                source_actions_align.RightPadding = 5;
                source_actions_align.TopPadding   = 5;
            }

            footer = new VBox();

            source_actions_box = new EventBox()
            {
                Visible = true
            };

            BuildSearchEntry();

            InterfaceActionService uia = ServiceManager.Get <InterfaceActionService> ();

            if (uia != null)
            {
                Gtk.Action action = uia.GlobalActions["WikiSearchHelpAction"];
                if (action != null)
                {
                    MenuItem item = new SeparatorMenuItem();
                    item.Show();
                    search_entry.Menu.Append(item);

                    item            = new ImageMenuItem(Stock.Help, null);
                    item.Activated += delegate { action.Activate(); };
                    item.Show();
                    search_entry.Menu.Append(item);
                }
            }

            source_actions_box.ShowAll();
            source_actions_align.Add(source_actions_box);
            source_actions_align.Hide();
            search_entry.Show();


            context_pane = new Banshee.ContextPane.ContextPane();
            context_pane.ExpandHandler = b => {
                SetChildPacking(content.Widget, !b, true, 0, PackType.Start);
                SetChildPacking(context_pane, b, b, 0, PackType.End);
            };

            // Top to bottom, their order is reverse of this:
            PackEnd(footer, false, false, 0);
            PackEnd(context_pane, false, false, 0);
            PackEnd(source_actions_align, false, false, 0);
            PackEnd(new ConnectedMessageBar(), false, true, 0);
        }
Esempio n. 2
0
        public static void AppendSeparator(this Menu menu)
        {
            SeparatorMenuItem smi = new SeparatorMenuItem();

            smi.Show();
            menu.Append(smi);
        }
    public ImageMenuItem AddCustomColor(Color color)
    {
        ImageMenuItem item = CreateImageMenuItem(color, "Custom");

        if (!(Menu is Menu))
        {
            Menu = new Menu();
        }
        Menu m = Menu as Menu;

        if (numCustomItems == 0)
        {
            SeparatorMenuItem sep = new SeparatorMenuItem();
            m.Prepend(sep);
            sep.Show();
        }

        m.Prepend(item);
        numCustomItems++;

        if (numCustomItems > 5)
        {
            m.Remove(m.Children[5]);
            numCustomItems--;
        }

        item.ShowAll();
        return(item);
    }
Esempio n. 4
0
 void UpdateGlobalWarningLabel()
 {
     KeyBindingConflict[] conflicts = currentBindings.CheckKeyBindingConflicts(IdeApp.CommandService.GetCommands());
     if (conflicts.Length == 0)
     {
         globalWarningBox.Hide();
         return;
     }
     globalWarningBox.Show();
     conflicButton.MenuCreator = delegate {
         Menu menu = new Menu();
         foreach (KeyBindingConflict conf in conflicts)
         {
             if (menu.Children.Length > 0)
             {
                 SeparatorMenuItem it = new SeparatorMenuItem();
                 it.Show();
                 menu.Insert(it, -1);
             }
             foreach (Command cmd in conf.Commands)
             {
                 string   txt      = currentBindings.GetBinding(cmd) + " - " + cmd.Text;
                 MenuItem item     = new MenuItem(txt);
                 Command  localCmd = cmd;
                 item.Activated += delegate {
                     SelectCommand(localCmd);
                 };
                 item.Show();
                 menu.Insert(item, -1);
             }
         }
         return(menu);
     };
 }
    public ColorToolButton(Color color, string name) :
        base(new ColorBlockWidget(color), name)
    {
        Menu = new Menu();

        SeparatorMenuItem sep = new SeparatorMenuItem();

        (Menu as Menu).Append(sep);
        sep.Show();

        // TODO: Figure out how to replace "new AccelGroup()"
        ImageMenuItem colors = new ImageMenuItem(Stock.ColorPicker,
                                                 new AccelGroup());

        if (colors.Child is Label)
        {
            (colors.Child as Label).Text =
                "More Colors...";
        }
        colors.Activated += MoreColorsActivated;
        (Menu as Menu).Append(colors);
        colors.Show();

        SetMainColor(AddColor(color, name));

        numCustomItems = 0;
    }
Esempio n. 6
0
        public SearchEntry()
        {
            BuildSearchEntry();

            InterfaceActionService uia = ServiceManager.Get <InterfaceActionService> ();

            if (uia != null)
            {
                Gtk.Action action = uia.GlobalActions["WikiSearchHelpAction"];
                if (action != null)
                {
                    MenuItem item = new SeparatorMenuItem();
                    item.Show();
                    Menu.Append(item);

                    item            = new ImageMenuItem(Stock.Help, null);
                    item.Activated += delegate { action.Activate(); };
                    item.Show();
                    Menu.Append(item);
                }
            }

            SearchSensitive = true;
            Show();
        }
    public ImageMenuItem AddCustomColor(Color color)
    {
        ImageMenuItem item = CreateImageMenuItem(color, "Custom");

        if(!(Menu is Menu)) {
            Menu = new Menu();
        }
        Menu m = Menu as Menu;

        if(numCustomItems == 0) {
            SeparatorMenuItem sep = new SeparatorMenuItem();
            m.Prepend(sep);
            sep.Show();
        }

        m.Prepend(item);
        numCustomItems++;

        if(numCustomItems > 5) {
            m.Remove(m.Children[5]);
            numCustomItems--;
        }

        item.ShowAll();
        return item;
    }
Esempio n. 8
0
        void OnPopulatePopup(object o, PopulatePopupArgs args)
        {
            Menu     menu = args.Menu;
            MenuItem item;

            item = new SeparatorMenuItem();
            item.Show();
            menu.Prepend(item);

            item = new ImageMenuItem(Stock.Redo, null)
            {
                Sensitive = UndoManager.CanRedo
            };
            item.Activated += delegate { UndoManager.Redo(); };
            item.AddAccelerator("activate", accel_group, (uint)Gdk.Key.z,
                                Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask,
                                AccelFlags.Visible);
            item.Show();
            menu.Prepend(item);

            item = new ImageMenuItem(Stock.Undo, null)
            {
                Sensitive = UndoManager.CanUndo
            };
            item.Activated += delegate { UndoManager.Undo(); };
            item.AddAccelerator("activate", accel_group, (uint)Gdk.Key.z,
                                Gdk.ModifierType.ControlMask, AccelFlags.Visible);
            item.Show();
            menu.Prepend(item);
        }
        void TextViewPopulatePopup(object o, PopulatePopupArgs args)
        {
            MenuItem          item = new MenuItem(GettextCatalog.GetString("Clear"));
            SeparatorMenuItem sep  = new SeparatorMenuItem();

            item.Activated += ClearActivated;
            item.Show();
            sep.Show();

            args.Menu.Add(sep);
            args.Menu.Add(item);
        }
Esempio n. 10
0
		void TextViewPopulatePopup (object o, PopulatePopupArgs args)
		{
			MenuItem item = new MenuItem (GettextCatalog.GetString ("Clear"));
			SeparatorMenuItem sep = new SeparatorMenuItem ();
			
			item.Activated += ClearActivated;
			item.Show ();
			sep.Show ();
			
			args.Menu.Add (sep);
			args.Menu.Add (item);
		}
        private void ConstruirPopupMenu()
        {
            popupMenu = new Menu();

            MenuItem menuInformacoesDiretorioArquivo = new MenuItem("Informações do Diretório / Arquivo");

            menuInformacoesDiretorioArquivo.Activated += new EventHandler(OnInformacoesDiretorioArquivoActivated);
            menuInformacoesDiretorioArquivo.Show();
            popupMenu.Append(menuInformacoesDiretorioArquivo);

            MenuItem menuExcluirDiretorioSelecionado = new MenuItem("Excluir Diretório Selecionado");

            menuExcluirDiretorioSelecionado.Activated += new EventHandler(OnExcluirDiretorioSelecionadoActivated);
            menuExcluirDiretorioSelecionado.Show();
            popupMenu.Append(menuExcluirDiretorioSelecionado);

            MenuItem menuExpandirDiretorios2 = new MenuItem("Expandir Diretórios");

            menuExpandirDiretorios2.Activated += new EventHandler(OnExpandirDiretorios2Activated);
            menuExpandirDiretorios2.Show();
            popupMenu.Append(menuExpandirDiretorios2);

            MenuItem menuColapsarDiretorios2 = new MenuItem("Colapsar Diretórios");

            menuColapsarDiretorios2.Activated += new EventHandler(OnColapsarDiretorios2Activated);
            menuColapsarDiretorios2.Show();
            popupMenu.Append(menuColapsarDiretorios2);

            SeparatorMenuItem separador2 = new SeparatorMenuItem();

            separador2.Show();
            popupMenu.Append(separador2);

            MenuItem menuIncluirNovaAba2 = new MenuItem("Incluir nova aba");

            menuIncluirNovaAba2.Activated += new EventHandler(OnIncluirNovaAba2Activated);
            menuIncluirNovaAba2.Show();
            popupMenu.Append(menuIncluirNovaAba2);

            MenuItem menuAlterarNomeAbaAtiva2 = new MenuItem("Alterar nome da aba ativa");

            menuAlterarNomeAbaAtiva2.Activated += new EventHandler(OnAlterarNomeAbaAtiva2Activated);
            menuAlterarNomeAbaAtiva2.Show();
            popupMenu.Append(menuAlterarNomeAbaAtiva2);

            MenuItem menuExcluirAbaAtiva2 = new MenuItem("Excluir aba ativa");

            menuExcluirAbaAtiva2.Activated += new EventHandler(OnExcluirAbaAtiva2Activated);
            menuExcluirAbaAtiva2.Show();
            popupMenu.Append(menuExcluirAbaAtiva2);
        }
Esempio n. 12
0
        void TextViewPopulatePopup(object o, PopulatePopupArgs args)
        {
            //ReplaceGtkIconsByOwnOnes(args.Menu);

            SeparatorMenuItem sep = new SeparatorMenuItem();

            sep.Show();
            args.Menu.Add(sep);

            TaggedLocalizedImageMenuItem newitem = new TaggedLocalizedImageMenuItem("Clear");

            newitem.Image      = new Image(Gdk.Pixbuf.LoadFromResource("Docking.Framework.Resources.Broom-16.png"));
            newitem.Activated += (object sender, EventArgs e) => Clear();
            newitem.ShowAll();

            args.Menu.Add(newitem);

            Localization.LocalizeMenu(args.Menu);
        }
Esempio n. 13
0
    public ColorToolButton(Color color, string name) :
        base(new ColorBlockWidget(color), name)
    {
        Menu = new Menu();

        SeparatorMenuItem sep = new SeparatorMenuItem();
        (Menu as Menu).Append(sep);
        sep.Show();

        // TODO: Figure out how to replace "new AccelGroup()"
        ImageMenuItem colors = new ImageMenuItem(Stock.ColorPicker,
            new AccelGroup());
        if(colors.Child is Label) (colors.Child as Label).Text =
            "More Colors...";
        colors.Activated += MoreColorsActivated;
        (Menu as Menu).Append(colors);
        colors.Show();

        SetMainColor(AddColor(color, name));

        numCustomItems = 0;
    }
Esempio n. 14
0
            protected override void InsertProxy(Gtk.Action menuAction, Widget parent, Widget afterItem)
            {
                int    position = 0;
                Widget item     = null;

                if (parent is MenuItem || parent is Menu)
                {
                    Menu parent_menu = ((parent is MenuItem) ? (parent as MenuItem).Submenu : parent) as Menu;
                    position = (afterItem != null) ? Array.IndexOf(parent_menu.Children, afterItem as MenuItem) + 1 : 0;
                    item     = GetNewMenuItem();
                    if (item != null)
                    {
                        var separator1 = new SeparatorMenuItem();
                        var separator2 = new SeparatorMenuItem();
                        //fix for separators that potentially already exist below the insert position
                        bool alreadyHasSeparator2 = ((parent_menu.Children [position]) as SeparatorMenuItem != null);
                        parent_menu.Insert(separator2, position);
                        parent_menu.Insert(item, position);
                        parent_menu.Insert(separator1, position);
                        item.Shown += (o, e) => {
                            separator1.Show();
                            if (!alreadyHasSeparator2)
                            {
                                separator2.Show();
                            }
                        };
                        item.Hidden += (o, e) => {
                            separator1.Hide();
                            separator2.Hide();
                        };
                    }
                }
                var activatable = item as IActivatable;

                if (activatable != null)
                {
                    activatable.RelatedAction = action;
                }
            }
Esempio n. 15
0
        public SearchEntry ()
        {
            BuildSearchEntry ();

            InterfaceActionService uia = ServiceManager.Get<InterfaceActionService> ();
            if (uia != null) {
                Gtk.Action action = uia.GlobalActions["WikiSearchHelpAction"];
                if (action != null) {
                    MenuItem item = new SeparatorMenuItem ();
                    item.Show ();
                    Menu.Append (item);

                    item = new ImageMenuItem (Stock.Help, null);
                    item.Activated += delegate { action.Activate (); };
                    item.Show ();
                    Menu.Append (item);
                }
            }

            SearchSensitive = true;
            Show ();
        }
Esempio n. 16
0
	public Browser (string basedir, IEnumerable<string> sources, string engine)
	{
#if MACOS
		try {
			InitMacAppHandlers();
		} catch (Exception ex) {
			Console.Error.WriteLine ("Installing Mac AppleEvent handlers failed. Skipping.\n" + ex);
		}
#endif
	
		this.engine = engine;		
		ui = new Glade.XML (null, "browser.glade", "window1", null);
		ui.Autoconnect (this);

		MainWindow = (Gtk.Window) ui["window1"];
		MainWindow.DeleteEvent += new DeleteEventHandler (delete_event_cb);
                
		MainWindow.KeyPressEvent += new KeyPressEventHandler (keypress_event_cb);
		MainWindow.KeyReleaseEvent += new KeyReleaseEventHandler (keyrelease_event_cb);
                
		Stream icon = GetResourceImage ("monodoc.png");

		if (icon != null) {
			monodoc_pixbuf = new Gdk.Pixbuf (icon);
			MainWindow.Icon = monodoc_pixbuf;
		}

		//ellipsizing label for the title
		title_label = new ELabel ("");
		title_label.Xalign = 0;
		Pango.FontDescription fd = new Pango.FontDescription ();
		fd.Weight = Pango.Weight.Bold;
		title_label.ModifyFont (fd);
		title_label.Layout.FontDescription = fd;
		title_label_box.Add (title_label);
		title_label.Show ();
		
		//colour the bar according to the current style
		bar_style = bar_eb.Style.Copy ();
		bar_eb.Style = bar_style;
		MainWindow.StyleSet += new StyleSetHandler (BarStyleSet);
		BarStyleSet (null, null);

		help_tree = Driver.LoadTree (basedir, sources);
		tree_browser = new TreeBrowser (help_tree, reference_tree, this);
		
		// Bookmark Manager init;
		bookmark_manager = new BookmarkManager(this);
		
		//
		// Tab Notebook and first tab
		//
		tabs_nb = new Notebook(); //the Notebook that holds tabs
		tabs_nb.Scrollable = true;
		tabs_nb.SwitchPage += new SwitchPageHandler(ChangeTab);
		help_container.Add(tabs_nb);

		AddTab();
			
			
		if ((capabilities & Capabilities.Fonts) != 0) {
			// Add Menu entries for changing the font
			Menu aux = (Menu) view1.Submenu;
			MenuItem sep = new SeparatorMenuItem ();
			sep.Show ();
			aux.Append (sep);
			AccelGroup accel = new AccelGroup ();
			MainWindow.AddAccelGroup (accel);

			textLarger = new MenuItem ("_Larger text");
			textLarger.Activated += new EventHandler (TextLarger);
			textLarger.Show ();
			aux.Append (textLarger);
			AccelKey ak = new AccelKey (Gdk.Key.plus, Gdk.ModifierType.ControlMask, AccelFlags.Visible);
			textLarger.AddAccelerator ("activate", accel, ak);
		
			textSmaller = new MenuItem ("_Smaller text");
			textSmaller.Activated += new EventHandler (TextSmaller);
			textSmaller.Show ();
			aux.Append (textSmaller);
			ak = new AccelKey (Gdk.Key.minus, Gdk.ModifierType.ControlMask, AccelFlags.Visible);
			textSmaller.AddAccelerator ("activate", accel, ak);
	
			textNormal = new MenuItem ("_Original size");
			textNormal.Activated += new EventHandler (TextNormal);
			textNormal.Show ();
			aux.Append (textNormal);
			ak = new AccelKey (Gdk.Key.Key_0, Gdk.ModifierType.ControlMask, AccelFlags.Visible);
			textNormal.AddAccelerator ("activate", accel, ak);
		}

		// restore the editing setting
		editing1.Active = SettingsHandler.Settings.EnableEditing;

		comments1.Active = SettingsHandler.Settings.ShowComments;

		cut1.Sensitive = false;
		paste1.Sensitive = false;

		//
		// Other bits
		//
		search_index = help_tree.GetSearchIndex();
		if (search_index == null) {
			ppanel = new ProgressPanel ("<b>No Search index found</b>", "Generate", RootTree.MakeSearchIndex, CreateSearchPanel); 
			search_vbox.Add (ppanel);
			search_vbox.Show ();
		} else {
			CreateSearchPanel ();
		}
		bookList = new ArrayList ();

		index_browser = IndexBrowser.MakeIndexBrowser (this);
		MainWindow.ShowAll();
		
#if MACOS
		try {
			InstallMacMainMenu ();
			((MenuBar)ui["menubar1"]).Hide ();
		} catch (Exception ex) {
			Console.Error.WriteLine ("Installing Mac IGE Main Menu failed. Skipping.\n" + ex);
		}
#endif
	}
Esempio n. 17
0
        void DoPopUp()
        {
            popup = new Menu();

            ImageMenuItem newItem = new ImageMenuItem("New");

            Gtk.Image newImage = new Gtk.Image(Stock.New, IconSize.Menu);
            newItem.Image      = newImage;
            newItem.Activated += new EventHandler(OnNewEntryActivate);
            newItem.Show();

            popup.Append(newItem);

            Gdk.Pixbuf    pb         = Gdk.Pixbuf.LoadFromResource("document-save.png");
            ImageMenuItem exportItem = new ImageMenuItem("Export");

            exportItem.Image      = new Gtk.Image(pb);
            exportItem.Activated += new EventHandler(OnExportActivate);
            exportItem.Show();

            popup.Append(exportItem);

            ImageMenuItem deleteItem = new ImageMenuItem("Delete");

            Gtk.Image deleteImage = new Gtk.Image(Stock.Delete, IconSize.Menu);
            deleteItem.Image      = deleteImage;
            deleteItem.Activated += new EventHandler(OnDeleteActivate);
            deleteItem.Show();

            popup.Append(deleteItem);

            ImageMenuItem propItem = new ImageMenuItem("Properties");

            Gtk.Image propImage = new Gtk.Image(Stock.Properties, IconSize.Menu);
            propItem.Image      = propImage;
            propItem.Activated += new EventHandler(OnEditActivate);
            propItem.Show();

            popup.Append(propItem);

            bool users = false;

            if (viewPlugin.Name.ToLower() == "users")
            {
                SeparatorMenuItem sm = new SeparatorMenuItem();
                sm.Show();
                popup.Append(sm);

                Gdk.Pixbuf    pwdImage = Gdk.Pixbuf.LoadFromResource("locked16x16.png");
                ImageMenuItem pwdItem  = new ImageMenuItem("Change password");
                pwdItem.Image      = new Gtk.Image(pwdImage);
                pwdItem.Activated += new EventHandler(OnPwdActivate);
                pwdItem.Show();

                popup.Append(pwdItem);
                users = true;
            }

            if (users || viewPlugin.Name.ToLower() == "contacts")
            {
                if (!users)
                {
                    SeparatorMenuItem sm = new SeparatorMenuItem();
                    sm.Show();
                    popup.Append(sm);
                }

                pb = Gdk.Pixbuf.LoadFromResource("mail-message-new.png");
                ImageMenuItem mailItem = new ImageMenuItem("Send email");
                mailItem.Image      = new Gtk.Image(pb);
                mailItem.Activated += new EventHandler(OnEmailActivate);
                mailItem.Show();

                popup.Append(mailItem);

                Gdk.Pixbuf    wwwImage = Gdk.Pixbuf.LoadFromResource("go-home.png");
                ImageMenuItem wwwItem  = new ImageMenuItem("Open home page");
                wwwItem.Image      = new Gtk.Image(wwwImage);
                wwwItem.Activated += new EventHandler(OnWWWActivate);
                wwwItem.Show();

                popup.Append(wwwItem);
            }

            popup.Popup(null, null, null, 3, Gtk.Global.CurrentEventTime);
        }
Esempio n. 18
0
        private void BuildHeader()
        {
            header = new HBox();
            footer = new VBox();

            EventBox title_box = new EventBox();

            title_label           = new Label();
            title_label.Xalign    = 0.0f;
            title_label.Ellipsize = Pango.EllipsizeMode.End;

            title_box.Add(title_label);

            // Show the source context menu when the title is right clicked
            title_box.PopupMenu += delegate {
                ServiceManager.Get <InterfaceActionService> ().SourceActions ["SourceContextMenuAction"].Activate();
            };

            title_box.ButtonPressEvent += delegate(object o, ButtonPressEventArgs press) {
                if (press.Event.Button == 3)
                {
                    ServiceManager.Get <InterfaceActionService> ().SourceActions ["SourceContextMenuAction"].Activate();
                }
            };

            header_box = new EventBox();

            BuildSearchEntry();

            search_label = new Label(Catalog.GetString("_Search:"));
            search_label.MnemonicWidget = search_entry.InnerEntry;

            header.PackStart(title_box, true, true, 0);
            header.PackStart(header_box, false, false, 0);
            header.PackStart(search_label, false, false, 5);
            header.PackStart(search_entry, false, false, 0);

            InterfaceActionService uia = ServiceManager.Get <InterfaceActionService> ();

            if (uia != null)
            {
                Gtk.Action action = uia.GlobalActions["WikiSearchHelpAction"];
                if (action != null)
                {
                    MenuItem item = new SeparatorMenuItem();
                    item.Show();
                    search_entry.Menu.Append(item);

                    item            = new ImageMenuItem(Stock.Help, null);
                    item.Activated += delegate { action.Activate(); };
                    item.Show();
                    search_entry.Menu.Append(item);
                }
            }

            header.ShowAll();
            search_entry.Show();

            PackStart(header, false, false, 0);
            PackEnd(footer, false, false, 0);

            context_pane = new Banshee.ContextPane.ContextPane();
            context_pane.ExpandHandler = b => {
                SetChildPacking(content.Widget, !b, true, 0, PackType.Start);
                SetChildPacking(context_pane, b, b, 0, PackType.End);
            };
            PackEnd(context_pane, false, false, 0);

            PackEnd(new ConnectedMessageBar(), false, true, 0);
        }
Esempio n. 19
0
        void TextViewPopulatePopup(object o, PopulatePopupArgs args)
        {
            MenuItem item = new MenuItem (GettextCatalog.GetString ("Clear"));
            SeparatorMenuItem sep = new SeparatorMenuItem ();

            item.Activated += ClearActivated;
            item.Show ();
            sep.Show ();

            args.Menu.Add (sep);
            args.Menu.Add (item);

            foreach (var menu_command in menuCommands)
            {
                var tmp = new MenuItem(menu_command.Item1);
                tmp.Activated += menu_command.Item2;
                tmp.Show();
                args.Menu.Add(tmp);
            }
        }
		void UpdateGlobalWarningLabel ()
		{
			KeyBindingConflict[] conflicts = currentBindings.CheckKeyBindingConflicts (IdeApp.CommandService.GetCommands ());
			if (conflicts.Length == 0) {
				globalWarningBox.Hide ();
				return;
			}
			globalWarningBox.Show ();
			conflicButton.MenuCreator = delegate {
				Menu menu = new Menu ();
				foreach (KeyBindingConflict conf in conflicts) {
					if (menu.Children.Length > 0) {
						SeparatorMenuItem it = new SeparatorMenuItem ();
						it.Show ();
						menu.Insert (it, -1);
					}
					foreach (Command cmd in conf.Commands) {
						string txt = currentBindings.GetBinding (cmd) + " - " + cmd.Text;
						MenuItem item = new MenuItem (txt);
						Command localCmd = cmd;
						item.Activated += delegate {
							SelectCommand (localCmd);
						};
						item.Show ();
						menu.Insert (item, -1);
					}
				}
				return menu;
			};
		}
Esempio n. 21
0
 public static void AppendSeparator(this Menu menu)
 {
     SeparatorMenuItem smi = new SeparatorMenuItem ();
     smi.Show ();
     menu.Append (smi);
 }
Esempio n. 22
0
        void TextViewPopulatePopup(object o, PopulatePopupArgs args)
        {
            //ReplaceGtkIconsByOwnOnes(args.Menu);

             SeparatorMenuItem sep = new SeparatorMenuItem();
             sep.Show();
             args.Menu.Add(sep);

             TaggedLocalizedImageMenuItem newitem = new TaggedLocalizedImageMenuItem("Clear");
             newitem.Image = Docking.Tools.ResourceLoader_Docking.LoadImage("Broom-16.png");
             newitem.Activated += (object sender, EventArgs e) => Clear();
             newitem.ShowAll();

             args.Menu.Add(newitem);

             Localization.LocalizeMenu(args.Menu);
        }
Esempio n. 23
0
        void DoPopUp()
        {
            popup = new Menu();

            ImageMenuItem newItem = new ImageMenuItem ("New");
            Gtk.Image newImage = new Gtk.Image (Stock.New, IconSize.Menu);
            newItem.Image = newImage;
            newItem.Activated += new EventHandler (OnNewEntryActivate);
            newItem.Show ();

            popup.Append (newItem);

            Gdk.Pixbuf pb = Gdk.Pixbuf.LoadFromResource ("document-save.png");
            ImageMenuItem exportItem = new ImageMenuItem ("Export");
            exportItem.Image = new Gtk.Image (pb);
            exportItem.Activated += new EventHandler (OnExportActivate);
            exportItem.Show ();

            popup.Append (exportItem);

            ImageMenuItem deleteItem = new ImageMenuItem ("Delete");
            Gtk.Image deleteImage = new Gtk.Image (Stock.Delete, IconSize.Menu);
            deleteItem.Image = deleteImage;
            deleteItem.Activated += new EventHandler (OnDeleteActivate);
            deleteItem.Show ();

            popup.Append (deleteItem);

            ImageMenuItem propItem = new ImageMenuItem ("Properties");
            Gtk.Image propImage = new Gtk.Image (Stock.Properties, IconSize.Menu);
            propItem.Image = propImage;
            propItem.Activated += new EventHandler (OnEditActivate);
            propItem.Show ();

            popup.Append (propItem);

            bool users = false;
            if (viewPlugin.Name.ToLower() == "users") {

                SeparatorMenuItem sm = new SeparatorMenuItem ();
                sm.Show ();
                popup.Append (sm);

                Gdk.Pixbuf pwdImage = Gdk.Pixbuf.LoadFromResource ("locked16x16.png");
                ImageMenuItem pwdItem = new ImageMenuItem ("Change password");
                pwdItem.Image = new Gtk.Image (pwdImage);
                pwdItem.Activated += new EventHandler (OnPwdActivate);
                pwdItem.Show ();

                popup.Append (pwdItem);
                users = true;
            }

            if (users || viewPlugin.Name.ToLower() == "contacts") {

                if (!users) {
                    SeparatorMenuItem sm = new SeparatorMenuItem ();
                    sm.Show ();
                    popup.Append (sm);
                }

                pb = Gdk.Pixbuf.LoadFromResource ("mail-message-new.png");
                ImageMenuItem mailItem = new ImageMenuItem ("Send email");
                mailItem.Image = new Gtk.Image (pb);
                mailItem.Activated += new EventHandler (OnEmailActivate);
                mailItem.Show ();

                popup.Append (mailItem);

                Gdk.Pixbuf wwwImage = Gdk.Pixbuf.LoadFromResource ("go-home.png");
                ImageMenuItem wwwItem = new ImageMenuItem ("Open home page");
                wwwItem.Image = new Gtk.Image (wwwImage);
                wwwItem.Activated += new EventHandler (OnWWWActivate);
                wwwItem.Show ();

                popup.Append (wwwItem);
            }

            popup.Popup(null, null, null, 3, Gtk.Global.CurrentEventTime);
        }
        public static void Main()
        {
            Application.Init();
            if (!modFunctions.RunningLock())
            {
                return;
            }
            GLib.ExceptionManager.UnhandledException += unhandledException;
            System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo(1033);
            if (CurrentOS.IsMac)
            {
                try
                {
                    string sOldConfig = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), modFunctions.CompanyName);
                    if (Directory.Exists(sOldConfig))
                    {
                        modFunctions.MoveDirectory(sOldConfig, Path.Combine(modFunctions.LocalAppData, modFunctions.CompanyName));
                        AppSettings cSettings = new AppSettings();
                        cSettings.HistoryDir = modFunctions.AppData;
                        cSettings.Save();
                        Directory.Delete(sOldConfig, true);
                    }
                }
                catch (Exception)
                {
                }
            }
            try
            {
                string sUpdatePath = Path.Combine(modFunctions.AppData, "Setup");
                if (CurrentOS.IsMac)
                {
                    sUpdatePath += ".dmg";
                }
                else if (CurrentOS.IsLinux)
                {
                    sUpdatePath += ".bz2.sh";
                }
                if (File.Exists(sUpdatePath))
                {
                    File.Delete(sUpdatePath);
                }
            }
            catch (Exception)
            {
            }
            fMain = new frmMain();
            if (CurrentOS.IsMac)
            {
                try
                {
                    ApplicationEvents.Quit += delegate(object sender, ApplicationQuitEventArgs e)
                    {
                        Application.Quit();
                        e.Handled = true;
                    };
                    ApplicationEvents.Reopen += delegate(object sender, ApplicationEventArgs e)
                    {
                        fMain.ShowFromTray();
                        e.Handled = true;
                    };
                    ApplicationEvents.Prefs += delegate(object sender, ApplicationEventArgs e)
                    {
                        fMain.cmdConfig_Click(new object(), new EventArgs());
                        e.Handled = true;
                    };
                }
                catch (Exception)
                {
                }
                bool bMenu = false;
                try
                {
                    IgeMacMenuGroup appGroup = IgeMacMenu.AddAppMenuGroup();
                    if (appGroup != null)
                    {
                        MenuItem mnuAbout = new MenuItem();
                        mnuAbout.Activated += delegate(object sender, EventArgs e)
                        {
                            fMain.cmdAbout_Click(new object(), new EventArgs());
                        };
                        appGroup.AddMenuItem(mnuAbout, "About " + modFunctions.ProductName);
                        appGroup.AddMenuItem(new MenuItem(), "-");
                        MenuItem mnuHistory = new MenuItem();
                        mnuHistory.Activated += delegate(object sender, EventArgs e)
                        {
                            fMain.cmdHistory_Click(new object(), new EventArgs());
                        };
                        appGroup.AddMenuItem(mnuHistory, "Usage History");
                        MenuItem mnuConfig = new MenuItem();
                        mnuConfig.Activated += delegate(object sender, EventArgs e)
                        {
                            fMain.cmdConfig_Click(new object(), new EventArgs());
                        };
                        appGroup.AddMenuItem(mnuConfig, "Preferences...");
                    }
                    MenuBar  srtMenu      = new MenuBar();
                    Menu     helpMenu     = new Menu();
                    MenuItem helpMenuItem = new MenuItem("Help");

                    MenuItem mnuFAQ = new MenuItem("Frequently Asked Questions");
                    mnuFAQ.Activated += delegate(object sender, EventArgs e)
                    {
                        System.Diagnostics.Process.Start("http://srt.realityripple.com/faq.php");
                    };
                    helpMenu.Append(mnuFAQ);
                    mnuFAQ.Show();

                    MenuItem mnuChanges = new MenuItem("What's New in " + modFunctions.ProductName + " v" + modFunctions.ProductVersion);
                    mnuChanges.Activated += delegate(object sender, EventArgs e)
                    {
                        System.Diagnostics.Process.Start("http://srt.realityripple.com/For-MONO/changes.php");
                    };
                    helpMenu.Append(mnuChanges);
                    mnuChanges.Show();

                    MenuItem mnuHelpSpace1 = new MenuItem("-");
                    helpMenu.Append(mnuHelpSpace1);
                    mnuHelpSpace1.Show();

                    MenuItem mnuWebsite = new MenuItem("Visit the " + modFunctions.ProductName + " Home Page");
                    mnuWebsite.Activated += delegate(object sender, EventArgs e)
                    {
                        System.Diagnostics.Process.Start("http://srt.realityripple.com/For-MONO/mac.php");
                    };
                    helpMenu.Append(mnuWebsite);
                    mnuWebsite.Show();

                    MenuItem mnuBug = new MenuItem("Report a Bug");
                    mnuBug.Activated += delegate(object sender, EventArgs e)
                    {
                        System.Diagnostics.Process.Start("http://bugs.realityripple.com/bug_report_page.php?project_id=2");
                    };
                    helpMenu.Append(mnuBug);
                    mnuBug.Show();

                    helpMenuItem.Submenu = helpMenu;
                    helpMenu.Show();
                    srtMenu.Append(helpMenuItem);
                    helpMenuItem.Show();

                    IgeMacMenu.MenuBar = srtMenu;
                    srtMenu.Show();
                    bMenu = true;
                }
                catch (Exception)
                {
                }
                if (bMenu == false)
                {
                    try
                    {
                        MenuBar  srtMenu      = new MenuBar();
                        Menu     helpMenu     = new Menu();
                        MenuItem helpMenuItem = new MenuItem("Help");

                        MenuItem mnuFAQ = new MenuItem("Frequently Asked Questions");
                        mnuFAQ.Activated += delegate(object sender, EventArgs e)
                        {
                            System.Diagnostics.Process.Start("http://srt.realityripple.com/faq.php");
                        };
                        helpMenu.Append(mnuFAQ);
                        mnuFAQ.Show();

                        MenuItem mnuChanges = new MenuItem("What's New in " + modFunctions.ProductName + " v" + modFunctions.ProductVersion);
                        mnuChanges.Activated += delegate(object sender, EventArgs e)
                        {
                            System.Diagnostics.Process.Start("http://srt.realityripple.com/For-MONO/changes.php");
                        };
                        helpMenu.Append(mnuChanges);
                        mnuChanges.Show();

                        SeparatorMenuItem mnuHelpSpace1 = new SeparatorMenuItem();
                        helpMenu.Append(mnuHelpSpace1);
                        mnuHelpSpace1.Show();

                        MenuItem mnuWebsite = new MenuItem("Visit the " + modFunctions.ProductName + " Home Page");
                        mnuWebsite.Activated += delegate(object sender, EventArgs e)
                        {
                            System.Diagnostics.Process.Start("http://srt.realityripple.com/For-MONO/mac.php");
                        };
                        helpMenu.Append(mnuWebsite);
                        mnuWebsite.Show();

                        MenuItem mnuBug = new MenuItem("Report a Bug");
                        mnuBug.Activated += delegate(object sender, EventArgs e)
                        {
                            System.Diagnostics.Process.Start("http://bugs.realityripple.com/bug_report_page.php?project_id=2");
                        };
                        helpMenu.Append(mnuBug);
                        mnuBug.Show();

                        helpMenuItem.Submenu = helpMenu;
                        helpMenu.Show();
                        srtMenu.Append(helpMenuItem);
                        helpMenuItem.Show();

                        GtkOSXApplication.MenuBar = srtMenu;
                        srtMenu.Show();

                        GtkMacMenuGroup appGroup = GtkOSXApplication.AddAppMenuGroup();
                        if (appGroup != null)
                        {
                            MenuItem mnuAbout = new MenuItem("About " + modFunctions.ProductName);
                            mnuAbout.Activated += delegate(object sender, EventArgs e)
                            {
                                fMain.cmdAbout_Click(new object(), new EventArgs());
                            };
                            appGroup.AddMenuItem(mnuAbout);
                            mnuAbout.Show();
                            SeparatorMenuItem mnuAppSpace1 = new SeparatorMenuItem();
                            appGroup.AddMenuItem(mnuAppSpace1);
                            mnuAppSpace1.Show();
                            MenuItem mnuHistory = new MenuItem("Usage History");
                            mnuHistory.Activated += delegate(object sender, EventArgs e)
                            {
                                fMain.cmdHistory_Click(new object(), new EventArgs());
                            };
                            appGroup.AddMenuItem(mnuHistory);
                            mnuHistory.Show();
                            MenuItem mnuConfig = new MenuItem("Preferences...");
                            mnuConfig.Activated += delegate(object sender, EventArgs e)
                            {
                                fMain.cmdConfig_Click(new object(), new EventArgs());
                            };
                            appGroup.AddMenuItem(mnuConfig);
                            mnuConfig.Show();
                            SeparatorMenuItem mnuAppSpace2 = new SeparatorMenuItem();
                            appGroup.AddMenuItem(mnuAppSpace2);
                            mnuAppSpace2.Show();
                        }
                        bMenu = true;
                    }
                    catch (Exception)
                    {
                    }
                }
            }
            fMain.Show();
            Application.Run();
        }
Esempio n. 25
0
        private void BuildHeader ()
        {
            source_actions_align = new Gtk.Alignment (0f, .5f, 1f, 0f) {
                RightPadding = 0,
                LeftPadding = 0,
                NoShowAll = true
            };

            if (Hyena.PlatformDetection.IsMeeGo) {
                source_actions_align.RightPadding = 5;
                source_actions_align.TopPadding = 5;
            }

            footer = new VBox ();

            source_actions_box = new EventBox () { Visible = true };

            BuildSearchEntry ();

            InterfaceActionService uia = ServiceManager.Get<InterfaceActionService> ();
            if (uia != null) {
                Gtk.Action action = uia.GlobalActions["WikiSearchHelpAction"];
                if (action != null) {
                    MenuItem item = new SeparatorMenuItem ();
                    item.Show ();
                    search_entry.Menu.Append (item);

                    item = new ImageMenuItem (Stock.Help, null);
                    item.Activated += delegate { action.Activate (); };
                    item.Show ();
                    search_entry.Menu.Append (item);
                }
            }

            source_actions_box.ShowAll ();
            source_actions_align.Add (source_actions_box);
            source_actions_align.Hide ();
            search_entry.Show ();


            context_pane = new Banshee.ContextPane.ContextPane ();
            context_pane.ExpandHandler = b => {
                SetChildPacking (content.Widget, !b, true, 0, PackType.Start);
                SetChildPacking (context_pane, b, b, 0, PackType.End);
            };

            // Top to bottom, their order is reverse of this:
            PackEnd (footer, false, false, 0);
            PackEnd (context_pane, false, false, 0);
            PackEnd (source_actions_align, false, false, 0);
            PackEnd (new ConnectedMessageBar (), false, true, 0);
        }
        private void BuildHeader ()
        {
            header_align = new Alignment (0.0f, 0.5f, 1.0f, 1.0f);
            if (Hyena.PlatformDetection.IsMeeGo) {
                header_align.RightPadding = 5;
                header_align.TopPadding = 5;
            }

            header = new HBox ();
            footer = new VBox ();

            default_title_box = new EventBox ();
            title_label = new Label ();
            title_label.Xalign = 0.0f;
            title_label.Ellipsize = Pango.EllipsizeMode.End;

            default_title_box.Add (title_label);

            // Show the source context menu when the title is right clicked
            default_title_box.PopupMenu += delegate {
                ServiceManager.Get<InterfaceActionService> ().SourceActions ["SourceContextMenuAction"].Activate ();
            };

            default_title_box.ButtonPressEvent += delegate (object o, ButtonPressEventArgs press) {
                if (press.Event.Button == 3) {
                    ServiceManager.Get<InterfaceActionService> ().SourceActions ["SourceContextMenuAction"].Activate ();
                }
            };

            header_box = new EventBox ();

            custom_title_box = new HBox () { Visible = false };

            BuildSearchEntry ();

            header.PackStart (default_title_box, true, true, 0);
            header.PackStart (custom_title_box, true, true, 0);
            header.PackStart (header_box, false, false, 0);
            header.PackStart (search_entry, false, false, 0);

            InterfaceActionService uia = ServiceManager.Get<InterfaceActionService> ();
            if (uia != null) {
                Gtk.Action action = uia.GlobalActions["WikiSearchHelpAction"];
                if (action != null) {
                    MenuItem item = new SeparatorMenuItem ();
                    item.Show ();
                    search_entry.Menu.Append (item);

                    item = new ImageMenuItem (Stock.Help, null);
                    item.Activated += delegate { action.Activate (); };
                    item.Show ();
                    search_entry.Menu.Append (item);
                }
            }

            header_align.Add (header);
            header_align.ShowAll ();
            search_entry.Show ();

            PackStart (header_align, false, false, 0);
            PackEnd (footer, false, false, 0);

            context_pane = new Banshee.ContextPane.ContextPane ();
            context_pane.ExpandHandler = b => {
                SetChildPacking (content.Widget, !b, true, 0, PackType.Start);
                SetChildPacking (context_pane, b, b, 0, PackType.End);
            };
            PackEnd (context_pane, false, false, 0);

            PackEnd (new ConnectedMessageBar (), false, true, 0);
        }