Beispiel #1
0
        public virtual void StartMainLoop()
        {
            Gtk.UIManager uiManager = Tomboy.ActionManager.UI;

            ActionGroup mainMenuActionGroup = new ActionGroup("Mac");

            mainMenuActionGroup.Add(new ActionEntry [] {
                new ActionEntry("WindowMenuAction",
                                null,
                                // Translators: This is the name of "Window" menu in the Mac menubar
                                Catalog.GetString("_Window"),
                                null,
                                null,
                                null)
            });

            uiManager.AddUiFromString(osxMenuXml);
            uiManager.InsertActionGroup(mainMenuActionGroup, 1);

            Gtk.MenuShell mainMenu = uiManager.GetWidget("/MainWindowMenubar") as Gtk.MenuShell;
            mainMenu.Show();
            IgeMacMenu.MenuBar = mainMenu;
            WindowMenuManager.UpdateWindowMenu();

            Gtk.MenuItem about_item = uiManager.GetWidget("/MainWindowMenubar/HelpMenu/ShowAbout") as Gtk.MenuItem;
            Gtk.MenuItem prefs_item = uiManager.GetWidget("/MainWindowMenubar/EditMenu/ShowPreferences") as Gtk.MenuItem;
            Gtk.MenuItem quit_item  = uiManager.GetWidget("/MainWindowMenubar/FileMenu/QuitTomboy") as Gtk.MenuItem;

            (about_item.Child as Gtk.Label).Text = Catalog.GetString("About Tomboy");
            (prefs_item.Child as Gtk.Label).Text = Catalog.GetString("Preferences...");

            IgeMacMenuGroup about_group = IgeMacMenu.AddAppMenuGroup();
            IgeMacMenuGroup prefs_group = IgeMacMenu.AddAppMenuGroup();

            about_group.AddMenuItem(about_item, null);
            prefs_group.AddMenuItem(prefs_item, null);

            IgeMacMenu.QuitMenuItem = quit_item;

            IgeMacDock dock = new IgeMacDock();

            dock.Clicked += delegate(object sender, EventArgs args) {
                if (Tomboy.Tray.TomboyTrayMenu.Visible)
                {
                    Tomboy.Tray.TomboyTrayMenu.Hide();
                }
                else
                {
                    Tomboy.Tray.Tray.ShowMenu(false);
                }
            };
            dock.QuitActivate += delegate(object sender, EventArgs args) { Exit(0); };

            Tomboy.ActionManager ["CloseWindowAction"].Visible = false;

            Gtk.Application.Run();
        }
		public Navbar (Gtk.IconSize size)
		{
			address = new Entry ("address");
			// FIXME: this doesnt't seem to work yet
			// address.Completion = new EntryCompletion ();
			address.WidthChars = 50;
			address.Activated += new EventHandler (OnGoUrl);

			ActionEntry[] actions = new ActionEntry[]
			{
				new ActionEntry ("back", Gtk.Stock.GoBack, null, null, GettextCatalog.GetString ("Go back"), new EventHandler (OnBackClicked)),
				new ActionEntry ("forward", Gtk.Stock.GoForward, null, null, GettextCatalog.GetString ("Go forward"), new EventHandler (OnForwardClicked)),
				new ActionEntry ("stop", Gtk.Stock.Stop, null, null, GettextCatalog.GetString ("Stop loading"), new EventHandler (OnStopClicked)),
				new ActionEntry ("reload", Gtk.Stock.Refresh, null, null, GettextCatalog.GetString ("Address"), new EventHandler (OnReloadClicked)),
				new ActionEntry ("go", Gtk.Stock.Ok, null, null, GettextCatalog.GetString ("Load address"), new EventHandler (OnGoUrl))
			};

			ActionGroup ag = new ActionGroup ("navbarGroup");
			ag.Add (actions);

			UIManager uim = new UIManager ();
			uim.InsertActionGroup (ag, 0);
			uim.AddWidget += new AddWidgetHandler (OnAddWidget);
			uim.AddUiFromString (uiInfo);

			ToolItem item = new ToolItem ();
			item.Add (address);
	
			Toolbar tb = uim.GetWidget ("/ui/toolbar") as Toolbar;
			tb.IconSize = size;
			tb.Add (item);
			this.ShowAll ();
		}
Beispiel #3
0
        public MainWindow(string[] files) : base(Gtk.WindowType.Toplevel)
        {
            Build();

            this.files   = new RobotFile[Constants.MAX_ROBOTS];
            robotlist    = new RobotWidget[Constants.MAX_ROBOTS];
            robotactions = new RobotActions[Constants.MAX_ROBOTS];

            // FIXME: Have to wait until MonoDevelop 2.0 for UIManager integration, it seems.
            uimanager = new Gtk.UIManager();

            basicactions = new BasicActions();
            uimanager.InsertActionGroup(basicactions, -1);
            for (int i = 1; i <= Constants.MAX_ROBOTS; i++)
            {
                robotactions[i - 1] = new RobotActions(i);
                uimanager.InsertActionGroup(robotactions[i - 1], -1);
            }
            connectActions();

            uimanager.AddUiFromString(basicactions.buildMenuDescription());
            mainvbox.PackStart(uimanager.GetWidget("/Menubar"));

            gametimer = 0;
            reset_game();
            open_robots(files);
        }
Beispiel #4
0
        public MainWindow(string[] files)
            : base(Gtk.WindowType.Toplevel)
        {
            Build();

            this.files = new RobotFile[Constants.MAX_ROBOTS];
            robotlist = new RobotWidget[Constants.MAX_ROBOTS];
            robotactions = new RobotActions[Constants.MAX_ROBOTS];

            // FIXME: Have to wait until MonoDevelop 2.0 for UIManager integration, it seems.
            uimanager = new Gtk.UIManager();

            basicactions = new BasicActions();
            uimanager.InsertActionGroup(basicactions, -1);
            for (int i = 1; i <= Constants.MAX_ROBOTS; i++)
            {
                robotactions[i-1] = new RobotActions(i);
                uimanager.InsertActionGroup(robotactions[i-1], -1);
            }
            connectActions();

            uimanager.AddUiFromString(basicactions.buildMenuDescription());
            mainvbox.PackStart(uimanager.GetWidget("/Menubar"));

            gametimer = 0;
            reset_game();
            open_robots(files);
        }
Beispiel #5
0
		public MainWindow (): base (Gtk.WindowType.Toplevel)
		{
			// this window
			this.Title= "Supos";
			this.DeleteEvent += OnDeleteEvent;
			// main vbox
			mainBox = new VBox(false, 0);
			this.Add(mainBox);
			// actiongroup and uimanager stuff (menubar)
			actgroup = new ActionGroup ("TestActions");
			SetUpActionGroup();			
			uim = new UIManager ();
			uim.InsertActionGroup (actgroup, 0);
			this.AddAccelGroup(uim.AccelGroup);
			SetUpUiManager();
			Gtk.Widget menubar = uim.GetWidget("/MenuBar");
			mainBox.PackStart(menubar, false, false, 0);
			actgroup.GetAction("disconnect").Sensitive=false;
			// main panned view
			mainPaned = new HPaned();
			mainPaned.Sensitive = false;
			mainPaned.Name = "toucharea";			
			mainBox.PackStart(mainPaned, true, true, 0);
			// order editing view
			orderview = new ViewOrderEdit();
			mainPaned.Pack2(orderview, false, false);
			// categories product paned view
			HPaned hpan2;
			hpan2 = new HPaned();
			mainPaned.Pack1(hpan2, true, false);
			// categories view	
			catview = new ViewNameIcon();
			catview.DataMember="Categories";
			catview.SelectionChanged += this.OnCatSelectionChanged;
			catview.WidthRequest= 200;
			hpan2.Pack1(catview, false, false);
			// products view
			prodview = new ViewNameIcon();
			prodview.DataMember = "Products";
			prodview.RowActivated += this.OnProdRowActivated;			
			prodview.WidthRequest= 400;
			hpan2.Pack2(prodview, true, false);
			// status bar
			Statusbar statusbar;
			statusbar = new Statusbar();
			mainBox.PackStart(statusbar, false, false, 0);
			// clock
			Clock clock;
			clock = new Clock();
			clock.BorderWidth = 6;			
			statusbar.PackStart(clock, false, false, 0);
			// END build interface
			
			this.ApplyViewPreferences(SettingsHandler.Settings.viewSettings);
			
		}
Beispiel #6
0
        //------------------------------------------------------------------------------
        public MainMenu()
        {
            uim = new Gtk.UIManager();

            Gtk.ActionGroup actions = new Gtk.ActionGroup("MenuBarActions" + Guid.NewGuid());

            actions.Add(getActionEntries());
            uim.InsertActionGroup(actions, 0);

            // Put the XML definition of the controls (widgets) into the UIManager's buffer -and- create controls (widgets).
            uim.AddUiFromString(UI.ToString());

            instance = (Gtk.MenuBar)uim.GetWidget("/menubar");
            instance.ShowAll();
        }
Beispiel #7
0
        public ChatWindow()
            : base(Gtk.WindowType.Toplevel)
        {
            this.Title = "#gnome-hackers on irc.gimp.net - Logopathy";
            this.DeleteEvent += OnDeleteEvent;

            this.Table = new Gtk.Table(5, 5, false);
            this.Add(this.Table);

            this.ActionGroup = new Gtk.ActionGroup("General");
            SetUpActionGroup();

            UiManager = new Gtk.UIManager();
            UiManager.InsertActionGroup(this.ActionGroup, 0);
            AddAccelGroup(UiManager.AccelGroup);
            SetUpUiManager();

            this.MenuBar = UiManager.GetWidget("/MenuBar");
            this.Table.Attach(this.MenuBar, 0, 5, 0, 1, Gtk.AttachOptions.Fill, Gtk.AttachOptions.Fill, 0, 0);

            MainPaned = new Gtk.HPaned();
            this.Table.Attach(MainPaned, 0, 5, 1, 2);

            LeftSidebar = new Gtk.VPaned();
            MainPaned.Pack1(LeftSidebar, true, true);

            ServerView = new Logopathy.Gui.ServerListView();
            ServerViewSW = new Gtk.ScrolledWindow(new Gtk.Adjustment(0, 0, 0, 0, 0, 0), new Gtk.Adjustment(0, 0, 0, 0, 0, 0));
            ServerViewSW.Add(ServerView);
            LeftSidebar.Pack1(ServerViewSW, true, true);

            UserView = new Logopathy.Gui.UserView();
            UserViewSW = new Gtk.ScrolledWindow(new Gtk.Adjustment(0, 0, 0, 0, 0, 0), new Gtk.Adjustment(0, 0, 0, 0, 0, 0));
            UserViewSW.Add(UserView);
            LeftSidebar.Pack2(UserViewSW, true, true);

            ChatNotebook = new Logopathy.Gui.ChatNotebook(new TpServer());
            MainPaned.Pack2(ChatNotebook, true, true);
        }
Beispiel #8
0
        public ChatWindow() : base(Gtk.WindowType.Toplevel)
        {
            this.Title        = "#gnome-hackers on irc.gimp.net - Logopathy";
            this.DeleteEvent += OnDeleteEvent;

            this.Table = new Gtk.Table(5, 5, false);
            this.Add(this.Table);

            this.ActionGroup = new Gtk.ActionGroup("General");
            SetUpActionGroup();

            UiManager = new Gtk.UIManager();
            UiManager.InsertActionGroup(this.ActionGroup, 0);
            AddAccelGroup(UiManager.AccelGroup);
            SetUpUiManager();

            this.MenuBar = UiManager.GetWidget("/MenuBar");
            this.Table.Attach(this.MenuBar, 0, 5, 0, 1, Gtk.AttachOptions.Fill, Gtk.AttachOptions.Fill, 0, 0);

            MainPaned = new Gtk.HPaned();
            this.Table.Attach(MainPaned, 0, 5, 1, 2);

            LeftSidebar = new Gtk.VPaned();
            MainPaned.Pack1(LeftSidebar, true, true);

            ServerView   = new Logopathy.Gui.ServerListView();
            ServerViewSW = new Gtk.ScrolledWindow(new Gtk.Adjustment(0, 0, 0, 0, 0, 0), new Gtk.Adjustment(0, 0, 0, 0, 0, 0));
            ServerViewSW.Add(ServerView);
            LeftSidebar.Pack1(ServerViewSW, true, true);

            UserView   = new Logopathy.Gui.UserView();
            UserViewSW = new Gtk.ScrolledWindow(new Gtk.Adjustment(0, 0, 0, 0, 0, 0), new Gtk.Adjustment(0, 0, 0, 0, 0, 0));
            UserViewSW.Add(UserView);
            LeftSidebar.Pack2(UserViewSW, true, true);

            ChatNotebook = new Logopathy.Gui.ChatNotebook(new TpServer());
            MainPaned.Pack2(ChatNotebook, true, true);
        }
Beispiel #9
0
        public Window(Inventory inventory)
            : this(new Builder("window.ui"))
        {
            Inventory = inventory;

            // load the menues and toolbars
            uiManager = new UIManager();

            // create the file actions
            Gtk.Action saveInventoryAction = new Gtk.Action("saveFile","Save","Save the active inventory",Stock.Save);
            saveInventoryAction.Activated += OnSaveInventory;
            Gtk.Action printLabelsAction = new Gtk.Action("printLabels","Print Labels","Print labels for items.",Stock.Print);
            printLabelsAction.Activated += OnPrintLabels;
            Gtk.Action quitAction = new Gtk.Action("quit","Quit","Quit the application",Stock.Quit);
            quitAction.Activated += OnQuit;
            Gtk.Action fileAction = new Gtk.Action("file","File");
            ActionGroup fileActionGroup = new ActionGroup("file");
            fileActionGroup.Add(saveInventoryAction);
            fileActionGroup.Add(printLabelsAction);
            fileActionGroup.Add(quitAction);
            fileActionGroup.Add(fileAction);
            uiManager.InsertActionGroup(fileActionGroup,0);

            // create items box
            itemsBox = new ItemsBox(inventory.Items, uiManager);
            itemsBox.DrawDescriptionEntry += OnDrawDescriptionEntry;
            itemsBox.ShowMe += OnShowItemsBox;
            itemsAlign.Add(itemsBox);

            // create locations box
            locationsBox = new LocationsBox(inventory.Locations, uiManager);
            locationsBox.DrawDescriptionEntry += OnDrawDescriptionEntry;
            locationsBox.ShowMe += OnShowLocationsBox;
            locationsBox.GotoItem += OnGotoLocationsItem;
            locationsAlign.Add(locationsBox);

            // create tags box
            tagsBox = new TagsBox(inventory.Tags, uiManager);
            tagsBox.ShowMe += OnShowTagsBox;
            tagsAlign.Add(tagsBox);

            // create tool and menubar
            uiManager.AddUiFromResource("window_menues.xml");
            menuBar = (MenuBar) uiManager.GetWidget("/menuBar");
            toolbar = (Toolbar) uiManager.GetWidget("/toolbar");
            toolbar.IconSize = IconSize.LargeToolbar;
            toolbar.ToolbarStyle = ToolbarStyle.Both;

            mainBox.PackStart(menuBar,false,true,0);
            mainBox.PackStart(toolbar,false,true,0);

            // laod category icons
            itemsTabImage.Pixbuf = ((GtkSettings)Inventory.Settings).ItemsTabIcon;
            locationsTabImage.Pixbuf = ((GtkSettings)Inventory.Settings).LocationsTabIcon;
            tagsTabImage.Pixbuf = ((GtkSettings)Inventory.Settings).TagsTabIcon;

            this.Icon = ((GtkSettings)Inventory.Settings).WindowIcon;
            this.Resize(((GtkSettings)Inventory.Settings).MainWindowWidth,((GtkSettings)Inventory.Settings).MainWindowHeight);
        }
Beispiel #10
0
		void AddActionUI ()
		{
			ActionEntry[] actions = new ActionEntry[]
			{
				new ActionEntry ("FileMenu", null, "_File", null, null, null),
				new ActionEntry ("Quit", Stock.Quit, "_Quit", "<control>Q", "Quit", new EventHandler (QuitActivated)),
				new ActionEntry ("HelpMenu", null, "_Help", null, null, null),
				new ActionEntry ("About", null, "_About IlContrast...", "<control>A", "About IlContrast", new EventHandler (AboutActivated)),
			};

			ActionGroup group = new ActionGroup ("group");
			group.Add (actions);

			UIManager uim = new UIManager ();
			uim.InsertActionGroup (group, (int) uim.NewMergeId ());
			uim.AddUiFromString (uiInfo);
			main_vbox.PackStart (uim.GetWidget ("/MenuBar"), false, true, 0);
			//main_vbox.PackStart (uim.GetWidget ("/ToolBar"), false, true, 0);
		}
Beispiel #11
0
        public ConfigDialog(VirtualMachine machine, MainWindow parent)
            : base("Configure Virtual Machine", parent, DialogFlags.NoSeparator, Stock.Cancel, ResponseType.Cancel,
                  Stock.Ok, ResponseType.Ok)
        {
            this.mainWindow = parent;
            this.machine = machine;

            IconThemeUtils.SetWindowIcon (this);

            ActionEntry[] actionList = {
                new ActionEntry ("AddHardDisk", null,
                                 Catalog.GetString ("Hard Disk"), null,
                                 Catalog.GetString ("Add a hard disk"),
                                 OnAddHardDisk),
                new ActionEntry ("AddCdDrive", null,
                                 Catalog.GetString ("CD-ROM"), null,
                                 Catalog.GetString ("Add a CD-ROM drive"),
                                 OnAddCdDrive),
                new ActionEntry ("AddEthernet", null,
                                 Catalog.GetString ("Ethernet"), null,
                                 Catalog.GetString ("Add an ethernet device"),
                                 OnAddEthernet),
                new ActionEntry ("AddFloppy", null,
                                 Catalog.GetString ("Floppy"), null,
                                 Catalog.GetString ("Add a floppy drive"),
                                 OnAddFloppy),

            };

            actions = new ActionGroup ("VmxManager Device Actions");
            actions.Add (actionList);

            ui = new UIManager ();
            ui.InsertActionGroup (actions, 0);
            ui.AddUiFromResource ("vmx-manager-config.xml");

            Glade.XML xml = new Glade.XML ("vmx-manager.glade", "configDialogContent");
            xml.Autoconnect (this);

            guestOsCombo.Model = new OSModel ();

            CellRendererText renderer = new CellRendererText ();
            guestOsCombo.PackStart (renderer, false);
            guestOsCombo.AddAttribute (renderer, "text", 0);
            guestOsCombo.Changed += OnGuestOsChanged;

            devview = new DeviceView ();
            devview.RowActivated += delegate {
                OnConfigureDevice (this, new EventArgs ());
            };

            devview.Selection.Changed += OnDeviceSelectionChanged;
            devmodel = new DeviceModel (machine);
            devview.Model = devmodel;
            deviceContent.Add (devview);
            devview.Show ();

            addDeviceButton.Toggled += delegate {
                if (addDeviceButton.Active) {
                    Menu popup = (Menu) ui.GetWidget ("/ui/AddDevicePopup");
                    popup.Unmapped += delegate {
                        addDeviceButton.Active = false;
                    };

                    popup.Popup (null, null, OnPopupPosition, 0, Gtk.Global.CurrentEventTime);
                }
            };

            removeDeviceButton.Clicked += OnRemoveDevice;
            configureDeviceButton.Clicked += OnConfigureDevice;

            VBox.Add (configDialogContent);
            DefaultHeight = 400;

            int maxmem = Utility.GetHostMemorySize ();
            if (maxmem > 0) {
                memorySpin.SetRange (1.0, (double) (maxmem - 128));
            }

            Load ();
        }
Beispiel #12
0
        private void SetCategoriesMenu()
        {
            Gtk.Action editProp, sortMenu;
            UIManager manager;
            ActionGroup g;

            manager = new UIManager ();
            g = new ActionGroup ("CategoriesMenuGroup");

            editProp = new Gtk.Action ("EditPropAction", Mono.Unix.Catalog.GetString ("Edit properties"), null, "gtk-edit");
            sortMenu = new Gtk.Action ("SortMenuAction", Mono.Unix.Catalog.GetString ("Sort Method"), null, null);
            sortByName = new Gtk.RadioAction ("SortByNameAction", Mono.Unix.Catalog.GetString ("Sort by name"), null, null, 1);
            sortByStart = new Gtk.RadioAction ("SortByStartAction", Mono.Unix.Catalog.GetString ("Sort by start time"), null, null, 2);
            sortByStop = new Gtk.RadioAction ("SortByStopAction", Mono.Unix.Catalog.GetString ("Sort by stop time"), null, null, 3);
            sortByDuration = new Gtk.RadioAction ("SortByDurationAction", Mono.Unix.Catalog.GetString ("Sort by duration"), null, null, 3);

            sortByName.Group = new GLib.SList (System.IntPtr.Zero);
            sortByStart.Group = sortByName.Group;
            sortByStop.Group = sortByName.Group;
            sortByDuration.Group = sortByName.Group;

            g.Add (editProp, null);
            g.Add (sortMenu, null);
            g.Add (sortByName, null);
            g.Add (sortByStart, null);
            g.Add (sortByStop, null);
            g.Add (sortByDuration, null);

            manager.InsertActionGroup (g, 0);

            manager.AddUiFromString ("<ui>" +
            "  <popup action='CategoryMenu'>" +
            "    <menuitem action='EditPropAction'/>" +
            "    <menu action='SortMenuAction'>" +
            "      <menuitem action='SortByNameAction'/>" +
            "      <menuitem action='SortByStartAction'/>" +
            "      <menuitem action='SortByStopAction'/>" +
            "      <menuitem action='SortByDurationAction'/>" +
            "    </menu>" +
            "  </popup>" +
            "</ui>");

            categoriesMenu = manager.GetWidget ("/CategoryMenu") as Menu;

            sortByName.Activated += OnSortActivated;
            sortByStart.Activated += OnSortActivated;
            sortByStop.Activated += OnSortActivated;
            sortByDuration.Activated += OnSortActivated;
            editProp.Activated += delegate(object sender, EventArgs e) {
                EditProperties (GetValueFromPath (Selection.GetSelectedRows () [0]) as EventType);
            };
        }
Beispiel #13
0
        /// <summary>
        /// Constructs the menu and related components.
        /// </summary>
        private Widget CreateMenu()
        {
            // Start by loading the UI from a resource
            UIManager ui = new UIManager();
            ui.AddUiFromResource("Wordplay.menu.xml");

            // Set up the actions
            ActionEntry[] entries = new[]
                                    {
                                        // "File" Menu
                                        new ActionEntry(
                                            "GameMenu",
                                            null,
                                            Translate("Menu/Game"),
                                            null,
                                            null,
                                            null),
                                        new ActionEntry(
                                            "NewGame",
                                            Stock.New,
                                            Translate("Menu/NewGame"),
                                            "<control>N",
                                            "New",
                                            OnNewGameAction),
                                        new ActionEntry(
                                            "ShuffleBoard",
                                            null,
                                            Translate("Menu/ShuffleBoard"),
                                            "<control>S",
                                            "Shuffle",
                                            OnShuffleBoardAction),
                                        new ActionEntry(
                                            "Preferences",
                                            null,
                                            Translate("Menu/Preferences"),
                                            "<control>P",
                                            "Preferences",
                                            OnPreferencesAction),
                                        new ActionEntry(
                                            "HighScores",
                                            null,
                                            Translate("Menu/HighScores"),
                                            "<control>H",
                                            "HighScores",
                                            OnHighScoresAction),
                                        new ActionEntry(
                                            "Quit",
                                            Stock.Quit,
                                            Translate("Menu/Quit"),
                                            "<control>Q",
                                            "Quit",
                                            OnQuitAction),
                                    };

            // Install the actions
            ActionGroup actions = new ActionGroup("group");
            actions.Add(entries);
            ui.InsertActionGroup(actions, 0);
            window.AddAccelGroup(ui.AccelGroup);

            // Construct the results
            return ui.GetWidget("/MenuBar");
        }
Beispiel #14
0
        void BuildUIManager()
        {
            this.m_UIManager = new UIManager ();
            this.AddAccelGroup (this.m_UIManager.AccelGroup);

            var uiHandlerList = AddinManager.GetExtensionNodes ("/Adroit/Gui/UIHandlers");
            var uiHandlers = new List<IUIHandler> ();

            foreach (TypeExtensionNode uiHandlerNode in uiHandlerList) {
                uiHandlers.Add ((IUIHandler) uiHandlerNode.CreateInstance ());
            }

            uiHandlers.Sort (delegate (IUIHandler x, IUIHandler y) {
                if (x.Priority < y.Priority)
                    return -1;
                else if (x.Priority == y.Priority)
                    return 0;
             	else
                    return 1;
            });

            uiHandlers.Reverse ();

            foreach (IUIHandler uiHandler in uiHandlers) {
                m_UIManager.InsertActionGroup (uiHandler.Actions, 0);
            }

            var uiProviderList = AddinManager.GetExtensionNodes ("/Adroit/Gui/UIProviders");

            foreach (TypeExtensionNode uiProviderNode in uiProviderList) {
                var uiProvider = (IUIProvider) uiProviderNode.CreateInstance ();
                uiProvider.Initialize (m_UIManager);
            }

            var menu = m_UIManager.GetWidget ("/menubar");
            this.m_menuContainer.Add (menu);
            menu.Show ();

            var toolbar = m_UIManager.GetWidget ("/toolbar");
            this.m_toolbarContainer.Add (toolbar);
            toolbar.Hide (); // we want to rip out the children at some point
                             // and add them to an hbox because the toolbar
                             // is so insanely f*****g ugly.
        }
Beispiel #15
0
        void CreateMenu()
        {
            Gtk.Action select_all;
            Gtk.Action select_none;
            UIManager manager;
            ActionGroup g;

            manager = new UIManager ();
            g = new ActionGroup ("MenuGroup");

            select_all = new Gtk.Action ("AllAction", Mono.Unix.Catalog.GetString ("Select all"), null, "gtk-edit");
            select_none = new Gtk.Action ("NoneAction", Mono.Unix.Catalog.GetString ("Unselect all"), null, "gtk-edit");

            g.Add (select_all, null);
            g.Add (select_none, null);

            manager.InsertActionGroup (g, 0);

            manager.AddUiFromString ("<ui>" +
            "  <popup action='Menu'>" +
            "    <menuitem action='AllAction'/>" +
            "    <menuitem action='NoneAction'/>" +
            "  </popup>" +
            "</ui>");

            playersMenu = manager.GetWidget ("/Menu") as Menu;

            select_all.Activated += (sender, e) => Select (true);
            select_none.Activated += (sender, e) => Select (false);
        }
		void CreateMenu ()
		{
			if (menu == null)
			{
				ActionGroup group = new ActionGroup ("Popup");

				Gtk.Action copy = new Gtk.Action ("copy", GettextCatalog.GetString ("_Copy"),
				                          GettextCatalog.GetString ("Copy comment task"), Gtk.Stock.Copy);
				copy.Activated += new EventHandler (OnGenTaskCopied);
				group.Add (copy, "<Control><Mod2>c");

				Gtk.Action jump = new Gtk.Action ("jump", GettextCatalog.GetString ("_Go to"),
				                          GettextCatalog.GetString ("Go to comment task"), Gtk.Stock.JumpTo);
				jump.Activated += new EventHandler (OnGenTaskJumpto);
				group.Add (jump);

				Gtk.Action delete = new Gtk.Action ("delete", GettextCatalog.GetString ("_Delete"),
				                          GettextCatalog.GetString ("Delete comment task"), Gtk.Stock.Delete);
				delete.Activated += new EventHandler (OnGenTaskDelete);
				group.Add (delete);

				Gtk.Action columns = new Gtk.Action ("columns", GettextCatalog.GetString ("Columns"));
				group.Add (columns, null);

				ToggleAction columnLine = new ToggleAction ("columnLine", GettextCatalog.GetString ("Line"),
				                                            GettextCatalog.GetString ("Toggle visibility of Line column"), null);
				columnLine.Toggled += new EventHandler (OnColumnVisibilityChanged);
				columnsActions[columnLine] = (int)Columns.Line;
				group.Add (columnLine);

				ToggleAction columnDescription = new ToggleAction ("columnDescription", GettextCatalog.GetString ("Description"),
				                                            GettextCatalog.GetString ("Toggle visibility of Description column"), null);
				columnDescription.Toggled += new EventHandler (OnColumnVisibilityChanged);
				columnsActions[columnDescription] = (int)Columns.Description;
				group.Add (columnDescription);

				ToggleAction columnFile = new ToggleAction ("columnFile", GettextCatalog.GetString ("File"),
				                                            GettextCatalog.GetString ("Toggle visibility of File column"), null);
				columnFile.Toggled += new EventHandler (OnColumnVisibilityChanged);
				columnsActions[columnFile] = (int)Columns.File;
				group.Add (columnFile);

				ToggleAction columnPath = new ToggleAction ("columnPath", GettextCatalog.GetString ("Path"),
				                                            GettextCatalog.GetString ("Toggle visibility of Path column"), null);
				columnPath.Toggled += new EventHandler (OnColumnVisibilityChanged);
				columnsActions[columnPath] = (int)Columns.Path;
				group.Add (columnPath);

				UIManager uiManager = new UIManager ();
				uiManager.InsertActionGroup (group, 0);
				
				string uiStr = "<ui><popup name='popup'>"
					+ "<menuitem action='copy'/>"
					+ "<menuitem action='jump'/>"
					+ "<menuitem action='delete'/>"
					+ "<separator/>"
					+ "<menu action='columns'>"
					+ "<menuitem action='columnLine' />"
					+ "<menuitem action='columnDescription' />"
					+ "<menuitem action='columnFile' />"
					+ "<menuitem action='columnPath' />"
					+ "</menu>"
					+ "</popup></ui>";

				uiManager.AddUiFromString (uiStr);
				menu = (Menu)uiManager.GetWidget ("/popup");
				menu.ShowAll ();

				menu.Shown += delegate (object o, EventArgs args)
				{
					columnLine.Active = view.Columns[(int)Columns.Line].Visible;
					columnDescription.Active = view.Columns[(int)Columns.Description].Visible;
					columnFile.Active = view.Columns[(int)Columns.File].Visible;
					columnPath.Active = view.Columns[(int)Columns.Path].Visible;
					copy.Sensitive = jump.Sensitive = delete.Sensitive =
						view.Selection != null &&
						view.Selection.CountSelectedRows () > 0 &&
						(columnLine.Active ||
						columnDescription.Active ||
						columnFile.Active ||
						columnPath.Active);
				};
			}
		}
Beispiel #17
0
        //------------------------------------------------------------------------------
        public MainMenu()
        {
            uim = new Gtk.UIManager ();

            Gtk.ActionGroup actions = new Gtk.ActionGroup ("MenuBarActions" + Guid.NewGuid ());

            actions.Add (getActionEntries ());
            uim.InsertActionGroup (actions, 0);

            // Put the XML definition of the controls (widgets) into the UIManager's buffer -and- create controls (widgets).
            uim.AddUiFromString (UI.ToString ());

            instance = (Gtk.MenuBar)uim.GetWidget ("/menubar");
            instance.ShowAll ();
        }
        private void SetMenu()
        {
            Gtk.Action rmv;
            UIManager manager;
            ActionGroup g;

            manager= new UIManager();
            g = new ActionGroup("SubCategoriesMenuGroup");

            edit = new Gtk.Action("EditAction",
                                  Mono.Unix.Catalog.GetString("Edit tags"),
                                  null, "gtk-edit");
            rmv = new Gtk.Action("RemoveAction",
                                    Mono.Unix.Catalog.GetString("Remove sub-category"),
                                    null, "gtk-remove");

            g.Add(edit, null);
            g.Add(rmv, null);

            manager.InsertActionGroup(g,0);

            manager.AddUiFromString("<ui>"+
                                    "  <popup action='CategoriesMenu'>"+
                                    "    <menuitem action='EditAction'/>"+
                                    "    <menuitem action='RemoveAction'/>"+
                                    "  </popup>"+
                                    "</ui>");

            menu = manager.GetWidget("/CategoriesMenu") as Menu;

            edit.Activated += OnEdit;
            rmv.Activated += OnRemove;
        }
Beispiel #19
0
        public Browser()
            : base(WindowType.Toplevel)
        {
            Title = "Summa";
            IconName = "summa";

            action_group = new Gtk.ActionGroup("general");
            factory = new IconFactory();
            factory.AddDefault();

            DestroyEvent += CloseWindow;
            DeleteEvent += CloseWindow;

            SetUpActionGroup();

            uimanager = new UIManager();
            uimanager.InsertActionGroup(action_group, 0);
            AddAccelGroup(uimanager.AccelGroup);
            SetUpUimanager();

            table = new Table(5, 5, false);
            Add(table);

            menubar = uimanager.GetWidget("/MenuBar");
            table.Attach(menubar, 0, 5, 0, 1, AttachOptions.Fill, AttachOptions.Fill, 0, 0);

            toolbar = uimanager.GetWidget("/ToolBar");
            table.Attach(toolbar, 0, 5, 1, 2, AttachOptions.Fill, AttachOptions.Fill, 0, 0);

            main_paned = new HPaned();
            table.Attach(main_paned, 0, 5, 2, 3);

            left_paned = new VPaned();
            main_paned.Pack1(left_paned, true, true);

            TagView = new TagView();
            TagView.CursorChanged += new EventHandler(TagviewChanged);
            TagView_swin = new ScrolledWindow(new Adjustment(0, 0, 0, 0, 0, 0), new Adjustment(0, 0, 0, 0, 0, 0));
            TagView_swin.Add(TagView);
            TagView_swin.ShadowType = ShadowType.In;
            TagView_swin.SetPolicy(PolicyType.Automatic, PolicyType.Automatic);
            left_paned.Pack1(TagView_swin, true, true);

            FeedView = new FeedView();
            FeedView.CursorChanged += new EventHandler(FeedviewChanged);
            FeedView_swin = new ScrolledWindow(new Adjustment(0, 0, 0, 0, 0, 0), new Adjustment(0, 0, 0, 0, 0, 0));
            FeedView_swin.Add(FeedView);
            FeedView_swin.ShadowType = ShadowType.In;
            FeedView_swin.SetPolicy(PolicyType.Automatic, PolicyType.Automatic);
            left_paned.Pack2(FeedView_swin, true, true);

            if ( Config.WidescreenView ) {
                right_paned = new HPaned();
            } else {
                right_paned = new VPaned();
            }
            main_paned.Pack2(right_paned, true, true);

            ItemView = new ItemView();
            ItemView.CursorChanged += new EventHandler(ItemviewChanged);
            ItemView_swin = new ScrolledWindow(new Adjustment(0, 0, 0, 0, 0, 0), new Adjustment(0, 0, 0, 0, 0, 0));
            ItemView_swin.Add(ItemView);
            ItemView_swin.ShadowType = ShadowType.In;
            ItemView_swin.SetPolicy(PolicyType.Automatic, PolicyType.Automatic);
            right_paned.Pack1(ItemView_swin, true, true);

            ItemNotebook = new ItemNotebook();
            right_paned.Pack2(ItemNotebook, true, true);

            StatusBar = new NotificationBar();
            table.Attach(StatusBar, 0, 5, 3, 4, AttachOptions.Fill, AttachOptions.Fill, 0, 0);

            UpdateFromConfig();
            FeedView.Populate("All");

            Database.ItemChanged += OnItemChanged;
            Database.ItemAdded += OnItemAdded;
            Notifier.ViewChanged += OnViewChanged;
        }
Beispiel #20
0
		public void ShowWindow ()
		{
			Application.Init ();
			
			gxml = new Glade.XML ("contactviewer.glade", "MainWindow");
			gxml.Autoconnect (this);
			
			ActionEntry[] entries = new ActionEntry [] {
				new ActionEntry ("FileMenuAction", null, "_File", null, null, null),
				new ActionEntry ("OpenAction", Gtk.Stock.Open,
					"_Open", "<control>O", Catalog.GetString ("Open..."), new EventHandler (OnOpenDatabase)),
				new ActionEntry ("QuitAction", Gtk.Stock.Quit,
					"_Quit", "<control>Q", Catalog.GetString ("Quit"), new EventHandler (OnQuit)),
				new ActionEntry ("HelpMenuAction", null, "_Help", null, null, null),
				new ActionEntry ("AboutAction", Gnome.Stock.About,
					"_About", null, Catalog.GetString ("About"), new EventHandler (OnAbout))
			};
			
			ActionGroup grp = new ActionGroup ("MainGroup");
			grp.Add (entries);
			
			ui_manager = new UIManager ();
			ui_manager.InsertActionGroup(grp, 0);
			ui_manager.AddUiFromResource ("menu.xml");
			MenubarHolder.Add (ui_manager.GetWidget ("/MainMenu"));
			
			// Fix the TreeView that will contain all contacts
			contact_store = new ListStore (typeof (string), typeof (string));
			
			ContactList.Model = contact_store;
			ContactList.RulesHint = true;
			ContactList.AppendColumn (Catalog.GetString ("Contacts"), new CellRendererText (), "text", 1);
			ContactList.ButtonReleaseEvent += OnContactSelected;
			
			// This ListStore will let the user choose what to see in the contact list
			contact_show_type_store = new ListStore (typeof (string), typeof (string));
			contact_show_type_store.AppendValues ("DisplayName", Catalog.GetString ("Display name"));
			contact_show_type_store.AppendValues ("PrimaryEmail", Catalog.GetString ("Primary E-mail"));
			contact_show_type_store.AppendValues ("SecondEmail", Catalog.GetString ("Secondary E-mail"));
			contact_show_type_store.AppendValues ("NickName", Catalog.GetString ("Nickname"));
			
			CellRendererText cell = new CellRendererText ();
			ListIdentifier.PackStart (cell, false);
			ListIdentifier.AddAttribute (cell, "text", 1);
			ListIdentifier.Model = contact_show_type_store;
			ListIdentifier.Active = 0;
			ListIdentifier.Changed += OnContactListTypeChanged;
			
			MainWindow.Icon = Beagle.Images.GetPixbuf ("contact-icon.png");
			MainWindow.DeleteEvent += OnDeleteEvent;
			
			LoadDatabase ();
			Application.Run ();
		}
        private void SetPlayersMenu()
        {
            Action edit;
            UIManager manager;
            ActionGroup g;

            manager= new UIManager();
            g = new ActionGroup("PlayersMenuGroup");

            edit = new Action("EditAction", Mono.Unix.Catalog.GetString("Edit name"), null, "gtk-edit");

            g.Add(edit, null);

            manager.InsertActionGroup(g,0);

            manager.AddUiFromString("<ui>"+
                                    "  <popup action='PlayersMenu'>"+
                                    "    <menuitem action='EditAction'/>"+
                                    "  </popup>"+
                                    "</ui>");

            playersMenu = manager.GetWidget("/PlayersMenu") as Menu;

            edit.Activated += OnEdit;
        }
		public MainWindow() : base(Gtk.WindowType.Toplevel) {
			//Build();
			
			this.IconList = new Gdk.Pixbuf[] { new Gdk.Pixbuf(null, "XenonFileManager.icons.xenon16.png"), new Gdk.Pixbuf(null, "XenonFileManager.icons.xenon256.png") };
			
			this.Title = Catalog.GetString("Xenon File Manager");
			this.SetSizeRequest(600, 450);
			//this.DefaultWidth = 600;
			//this.DefaultHeight = 450;
			
			VBox vbox1 = new VBox(false, 0);
					UIManager uiMgr = new UIManager();
					ActionGroup w1 = new ActionGroup("Default");
					Gtk.Action FileAction = new Gtk.Action("FileAction", global::Mono.Unix.Catalog.GetString ("_File"), null, null);
					FileAction.ShortLabel = Mono.Unix.Catalog.GetString("_File");
					w1.Add (FileAction, null);
					Gtk.Action NewTabAction = new Gtk.Action("NewTabAction", Catalog.GetString ("New _Tab"), null, null);
					NewTabAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("New _Tab");
					w1.Add (NewTabAction, "<Control>t");
					Gtk.Action CloseTabAction = new Gtk.Action("CloseTabAction", Catalog.GetString("_Close Tab"), null, null);
					CloseTabAction.ShortLabel = Catalog.GetString("_Close Tab");
					w1.Add(CloseTabAction, "<Control>F4");
					Gtk.Action NewFolderAction = new Gtk.Action("NewFolderAction", global::Mono.Unix.Catalog.GetString("New _Folder"), null, null);
					NewFolderAction.ShortLabel = global::Mono.Unix.Catalog.GetString("New _Folder");
					w1.Add(NewFolderAction, "F7");
					Gtk.Action NewFileAction = new Gtk.Action("NewFileAction", null, null, Stock.New);
					w1.Add(NewFileAction, "");
					Gtk.Action SearchAction = new Gtk.Action("SearchAction", Catalog.GetString("_Search"), null, null);
					w1.Add(SearchAction, "<Control>F");
					Gtk.Action RenameAction = new Gtk.Action("RenameAction", Catalog.GetString("_Rename"), null, null);
					w1.Add(RenameAction, "F2");
					Gtk.Action DeleteAction = new Gtk.Action("DeleteAction", null, null, Stock.Delete);
					w1.Add(DeleteAction, "Delete");
					Gtk.Action ExitAction = new Gtk.Action("ExitAction", null, null, Stock.Quit);
					w1.Add(ExitAction, null);
			
					Gtk.Action EditAction = new Gtk.Action("EditAction", global::Mono.Unix.Catalog.GetString ("_Edit"), null, null);
					w1.Add(EditAction, null);
					Gtk.Action CutAction = new Gtk.Action("CutAction", null, null, Stock.Cut);
					w1.Add(CutAction, null);
					Gtk.Action CopyAction = new Gtk.Action("CopyAction", null, null, Stock.Copy);
					w1.Add(CopyAction, null);
					Gtk.Action PasteAction = new Gtk.Action("PasteAction", null, null, Stock.Paste);
					w1.Add(PasteAction, null);
					Gtk.Action SelectAllAction = new Gtk.Action("SelectAllAction", null, null, Stock.SelectAll);
					w1.Add(SelectAllAction, "<Control>a");
					Gtk.Action SelectNoneAction = new Gtk.Action("SelectNoneAction", Catalog.GetString("Select _None"), null, null);
					w1.Add(SelectNoneAction, "<Control><Shift>a");
					Gtk.Action SettingsAction = new Gtk.Action("SettingsAction", null, null, Stock.Preferences);
					w1.Add(SettingsAction, null);
			
					Gtk.Action ViewAction = new Gtk.Action("ViewAction", Catalog.GetString("_View"), null, null);
					w1.Add(ViewAction, null);
					Gtk.Action RefreshAction = new Gtk.Action("RefreshAction", null, null, Stock.Refresh);
					w1.Add(RefreshAction, "F5");
			
					Gtk.Action HelpMenuAction = new Gtk.Action("HelpMenuAction", Catalog.GetString("_Help"), null, null);
					w1.Add(HelpMenuAction, null);
					Gtk.Action HelpAction = new Gtk.Action("HelpAction", null, null, Stock.Help);
					w1.Add(HelpAction, null);
					Gtk.Action AboutAction = new Gtk.Action("AboutAction", null, null, Stock.About);
					w1.Add(AboutAction, null);
			
					uiMgr.InsertActionGroup (w1, 0);
					this.AddAccelGroup (uiMgr.AccelGroup);
					uiMgr.AddUiFromString (
@"<ui><menubar name='menubar1'>
<menu name='FileAction' action='FileAction'><menuitem name='NewTabAction' action='NewTabAction'/><menuitem name='CloseTabAction' action='CloseTabAction'/><separator/>
<menuitem name='NewFolderAction' action='NewFolderAction'/><menu name='NewFileAction' action='NewFileAction'/><separator/>
<menuitem name='SearchAction' action='SearchAction'/><separator/>
<menuitem name='RenameAction' action='RenameAction'/><menuitem name='DeleteAction' action='DeleteAction'/><separator/>
<menuitem name='ExitAction' action='ExitAction'/></menu>
<menu name='EditAction' action='EditAction'><menuitem name='CutAction' action='CutAction'/><menuitem name='CopyAction' action='CopyAction'/><menuitem name='PasteAction' action='PasteAction'/><separator/>
<menuitem name='SelectAllAction' action='SelectAllAction'/><menuitem name='SelectNoneAction' action='SelectNoneAction'/><separator/>
<menuitem name='SettingsAction' action='SettingsAction'/></menu>
<menu name='ViewAction' action='ViewAction'><menuitem name='RefreshAction' action='RefreshAction'/></menu>
<menu name='HelpMenuAction' action='HelpMenuAction'><menuitem name='HelpAction' action='HelpAction'/><menuitem name='AboutAction' action='AboutAction'/></menu>
</menubar></ui>"
			        );
					MenuBar menubar1 = (MenuBar)uiMgr.GetWidget("/menubar1");
					menubar1.Name = "menubar1";
				vbox1.PackStart(menubar1, false, false, 0);
				toolbar = new Toolbar();
					toolbar.Insert(backButton = new ToolButton(Stock.GoBack), 0);
					toolbar.Insert(forwardButton = new ToolButton(Stock.GoForward), 1);
					toolbar.Insert(parentButton = new ToolButton(Stock.GoUp), 2);
					toolbar.Insert(new SeparatorToolItem(), 3);
					toolbar.Insert(computerButton = new ToolButton(Image.NewFromIconName("computer", IconSize.Button), Catalog.GetString("Computer")), 4);
					toolbar.Insert(homeButton = new ToolButton(Stock.Home), 5);
					toolbar.Insert(refreshButton = new ToolButton(Stock.Refresh), 6);
					computerButton.Sensitive = CommonUtil.CanLoadComputer();
					toolbar.Insert(new SeparatorToolItem(), 7);
					toolbar.Insert(cutButton = new ToolButton(Stock.Cut), 8);
					toolbar.Insert(copyButton = new ToolButton(Stock.Copy), 9);
					toolbar.Insert(pasteButton = new ToolButton(Stock.Paste), 10);
					//toolbar.Insert(new ToolButton(Stock.Preferences), 11);
				vbox1.PackStart(toolbar, false, false, 0);
				
			    locationBar = new Entry();
				vbox1.PackStart(locationBar, false, true, 0);
				
				
				nb = new Notebook();
				
				//nb.AppendPage((Widget)CommonUtil.LoadControlInstance(), new Label(""));
				nb.AppendPage((Widget)CommonUtil.LoadControlInstance(), new TabLabel(string.Empty, nb));
				vbox1.PackStart(nb, true, true, 0);
			
			this.Add(vbox1);
			
			this.DeleteEvent += OnDeleteEvent;
			locationBar.Activated += new EventHandler(LoadDirectory);
			nb.SwitchPage += new SwitchPageHandler(OnTabChanged);
			NewTabAction.Activated += new EventHandler(this.OnNewTabActionActivated);
			CloseTabAction.Activated += OnCloseTabActionActivated;
			NewFolderAction.Activated += new EventHandler(this.OnNewFolderActionActivated);
			RenameAction.Activated += OnRenameActionActivated;
			DeleteAction.Activated += OnDeleteActionActivated;
			ExitAction.Activated += OnExitActionActivated;
			CutAction.Activated += OnCutEvent;
			CopyAction.Activated += OnCopyEvent;
			PasteAction.Activated += OnPasteEvent;
			SelectAllAction.Activated += OnSelectAllActionActivated;
			SelectNoneAction.Activated += OnSelectNoneActionActivated;
			SettingsAction.Activated += new EventHandler(this.OnSettingActionActivated);
			RefreshAction.Activated += OnRefreshEvent;
			AboutAction.Activated += OnAboutActionActivated;
			
			backButton.Clicked += new EventHandler(this.OnBackEvent);
			forwardButton.Clicked += new EventHandler(this.OnForwardEvent);
			parentButton.Clicked += new EventHandler(this.OnParentEvent);
			computerButton.Clicked += new EventHandler(this.OnComputerEvent);
			homeButton.Clicked += new EventHandler(this.OnHomeEvent);
			refreshButton.Clicked += new EventHandler(this.OnRefreshEvent);
			cutButton.Clicked += OnCutEvent;
			copyButton.Clicked += OnCopyEvent;
			pasteButton.Clicked += OnPasteEvent;
			CommonUtil.DirectoryChanged += OnDirectoryChanged;
			
			
			CommonUtil.HomeButtonClicked((IDisplayInterfaceControl)nb.CurrentPageWidget);
			while(((IDisplayInterfaceControl)nb.CurrentPageWidget).CurrentLocation == null) Thread.Sleep(100);
			SetActionStates();
			
			
			progress = new ProgressWindow();
			progress.IconList = this.IconList;
			
			this.ShowAll();
		}
Beispiel #23
0
        public LocationsBox (Locations locations, UIManager uiManager)
		: this(new Builder("locations_box.ui"))
        {
			Locations = locations;
			
			// create the actions
			Gtk.Action create = new Gtk.Action("createLocation","Create Location","",Stock.Add);
			create.Activated += OnCreateLocation;
			Gtk.Action delete = new Gtk.Action("deleteLocation","Delete Location","",Stock.Remove);
			delete.Activated += OnDeleteLocation;
			Gtk.Action gotoItem = new Gtk.Action("gotoLocationItem","Goto Item","",Stock.GoForward);
			gotoItem.Activated += OnGotoLocationItem;
			Gtk.Action action = new Gtk.Action("location","Location");
			
			ActionGroup group = new ActionGroup("location");
			group.Add(create);
			group.Add(delete);
			group.Add(gotoItem);
			group.Add(action);
			uiManager.InsertActionGroup(group,0);
			
			// create item column with id
			TreeViewColumn col = new TreeViewColumn ();
			locationsItemColumn = col;
			col.Title = "Item";
			col.Expand = true;
			CellRenderer render;
			render = new CellRendererPixbuf ();
			col.PackStart (render, false);
			col.AddAttribute (render, "pixbuf", 1);
			render = new CellRendererText ();
			(render as CellRendererText).Editable = true;
			render.EditingStarted += OnStartLocationItemEdit;
			col.PackStart (render, true);
			col.AddAttribute (render, "text", 2);
			locationsView.AppendColumn(col);
			locationsView.AppendColumn ("ID", new Gtk.CellRendererText (), "text", 3);
			
			// create the labeled column
			col = new TreeViewColumn ();
			col.Title = "Labeled";
			render = new CellRendererToggle ();
			(render as CellRendererToggle).Toggled += OnLabeledToggle;
			col.PackStart (render, false);
			col.AddAttribute (render, "active", 4);
			col.AddAttribute (render, "activatable", 5);
			locationsView.AppendColumn(col);
			
			// create the amount column
			col    = new TreeViewColumn ();
			col.Title = "Amount";
			render = new CellRendererSpin ();
			(render as CellRendererText).Editable = true;
			(render as CellRendererText).Edited += OnAmountEdited;		
			Adjustment adj = new Adjustment(0, 0, 0, 0, 0, 0);  //set all limits etc to 0
			adj.Upper = 1000000000;  // assign some special values, that aren't 0
			adj.PageIncrement = 10;
			adj.StepIncrement = 1;
			(render as CellRendererSpin).Adjustment = adj;
			col.PackStart (render, false);
			col.AddAttribute (render, "text", 6);
			locationsView.AppendColumn (col);
			
			//set model etc
			locations.CollectionChanged += OnLocationCreation;
			TreeModelFilter filter = new LocationsFilter ( new LocationsModel( locations ));
			filter.Model.RowInserted += OnRowInserted;
			filter.VisibleFunc = new TreeModelFilterVisibleFunc (FilterLocations);
	 		locationsView.Model = filter;
			locationsView.Reorderable = true;
			
			// create the items chooser completion
			locationCompletion = new LocationItemChooser();
			TreeModel compModel = new TreeModelAdapter( new ItemsModel(locations.Inventory.Items));
			locationCompletion.Model = compModel;
			locationCompletion.MatchFunc = LocationItemCompletionMatch;
			locationCompletion.MinimumKeyLength = 0;
			// add the item info cell renderer to the completion	
			render = new CellRendererText ();
			locationCompletion.PackStart (render, true);
			locationCompletion.AddAttribute (render, "text", 2);
			
			// create the popups
			uiManager.AddUiFromResource("locations_box_menues.xml");
			locationPopup = (Menu) uiManager.GetWidget("/locationPopup");
	    }
		public DemoUIManager () : base ("UI Manager")
		{
			ActionEntry[] entries = new ActionEntry[] {
				new ActionEntry ("FileMenu", null, "_File", null, null, null),
				new ActionEntry ("PreferencesMenu", null, "_Preferences", null, null, null),
				new ActionEntry ("ColorMenu", null, "_Color", null, null, null),
				new ActionEntry ("ShapeMenu", null, "_Shape", null, null, null),
				new ActionEntry ("HelpMenu", null, "_Help", null, null, null),
				new ActionEntry ("New", Stock.New, "_New", "<control>N", "Create a new file", new EventHandler (ActionActivated)),
				new ActionEntry ("Open", Stock.Open, "_Open", "<control>O", "Open a file", new EventHandler (ActionActivated)),
				new ActionEntry ("Save", Stock.Save, "_Save", "<control>S", "Save current file", new EventHandler (ActionActivated)),
				new ActionEntry ("SaveAs", Stock.SaveAs, "Save _As", null, "Save to a file", new EventHandler (ActionActivated)),
				new ActionEntry ("Quit", Stock.Quit, "_Quit", "<control>Q", "Quit", new EventHandler (ActionActivated)),
				new ActionEntry ("About", null, "_About", "<control>A", "About", new EventHandler (ActionActivated)),
				new ActionEntry ("Logo", "demo-gtk-logo", null, null, "Gtk#", new EventHandler (ActionActivated))
			};

			ToggleActionEntry[] toggleEntries = new ToggleActionEntry[] {
				new ToggleActionEntry ("Bold", Stock.Bold, "_Bold", "<control>B", "Bold", new EventHandler (ActionActivated), true)
			};


			RadioActionEntry[] colorEntries = new RadioActionEntry[] {
				new RadioActionEntry ("Red", null, "_Red", "<control>R", "Blood", (int)Color.Red),
				new RadioActionEntry ("Green", null, "_Green", "<control>G", "Grass", (int)Color.Green),
				new RadioActionEntry ("Blue", null, "_Blue", "<control>B", "Sky", (int)Color.Blue)
			};

			RadioActionEntry[] shapeEntries = new RadioActionEntry[] {
				new RadioActionEntry ("Square", null, "_Square", "<control>S", "Square", (int)Shape.Square),
				new RadioActionEntry ("Rectangle", null, "_Rectangle", "<control>R", "Rectangle", (int)Shape.Rectangle),
				new RadioActionEntry ("Oval", null, "_Oval", "<control>O", "Egg", (int)Shape.Oval)
			};

			ActionGroup actions = new ActionGroup ("group");
			actions.Add (entries);
			actions.Add (toggleEntries);
			actions.Add (colorEntries, (int)Color.Red, new ChangedHandler (RadioActionActivated));
			actions.Add (shapeEntries, (int)Shape.Oval, new ChangedHandler (RadioActionActivated));

			UIManager uim = new UIManager ();
			uim.InsertActionGroup (actions, 0);
			AddAccelGroup (uim.AccelGroup);
			uim.AddUiFromString (uiInfo);

			VBox box1 = new VBox (false, 0);
			Add (box1);

			box1.PackStart (uim.GetWidget ("/MenuBar"), false, false, 0);

			Label label = new Label ("Type\n<alt>\nto start");
			label.SetSizeRequest (200, 200);
			label.SetAlignment (0.5f, 0.5f);
			box1.PackStart (label, true, true, 0);

			HSeparator separator = new HSeparator ();
			box1.PackStart (separator, false, true, 0);

			VBox box2 = new VBox (false, 10);
			box2.BorderWidth = 10;
			box1.PackStart (box2, false, true, 0);

			Button button = new Button ("close");
			button.Clicked += new EventHandler (CloseClicked);
			box2.PackStart (button, true, true, 0);
			button.CanDefault = true;
			button.GrabDefault ();

			ShowAll ();
		}
Beispiel #25
0
		Gtk.Menu CreateMenu ()
		{
			if (menu != null)
				return menu;
			
			var group = new ActionGroup ("Popup");

			var help = new Gtk.Action ("help", GettextCatalog.GetString ("Show Error Reference"),
				GettextCatalog.GetString ("Show Error Reference"), Gtk.Stock.Help);
			help.Activated += OnShowReference;
			group.Add (help, "F1");

			var copy = new Gtk.Action ("copy", GettextCatalog.GetString ("_Copy"),
				GettextCatalog.GetString ("Copy task"), Gtk.Stock.Copy);
			copy.Activated += OnTaskCopied;
			group.Add (copy, "<Control><Mod2>c");

			var jump = new Gtk.Action ("jump", GettextCatalog.GetString ("_Go to"),
				GettextCatalog.GetString ("Go to task"), Gtk.Stock.JumpTo);
			jump.Activated += OnTaskJumpto;
			group.Add (jump);

			var columns = new Gtk.Action ("columns", GettextCatalog.GetString ("Columns"));
			group.Add (columns, null);

			var columnType = new ToggleAction ("columnType", GettextCatalog.GetString ("Type"),
				GettextCatalog.GetString ("Toggle visibility of Type column"), null);
			columnType.Toggled += OnColumnVisibilityChanged;
			columnsActions[columnType] = VisibleColumns.Type;
			group.Add (columnType);

			var columnValidity = new ToggleAction ("columnValidity", GettextCatalog.GetString ("Validity"),
				GettextCatalog.GetString ("Toggle visibility of Validity column"), null);
			columnValidity.Toggled += OnColumnVisibilityChanged;
			columnsActions[columnValidity] = VisibleColumns.Marked;
			group.Add (columnValidity);

			var columnLine = new ToggleAction ("columnLine", GettextCatalog.GetString ("Line"),
				GettextCatalog.GetString ("Toggle visibility of Line column"), null);
			columnLine.Toggled += OnColumnVisibilityChanged;
			columnsActions[columnLine] = VisibleColumns.Line;
			group.Add (columnLine);

			var columnDescription = new ToggleAction ("columnDescription", GettextCatalog.GetString ("Description"),
				GettextCatalog.GetString ("Toggle visibility of Description column"), null);
			columnDescription.Toggled += OnColumnVisibilityChanged;
			columnsActions[columnDescription] = VisibleColumns.Description;
			group.Add (columnDescription);

			var columnFile = new ToggleAction ("columnFile", GettextCatalog.GetString ("File"),
				GettextCatalog.GetString ("Toggle visibility of File column"), null);
			columnFile.Toggled += OnColumnVisibilityChanged;
			columnsActions[columnFile] = VisibleColumns.File;
			group.Add (columnFile);

			var columnProject = new ToggleAction ("columnProject", GettextCatalog.GetString ("Project"),
				GettextCatalog.GetString ("Toggle visibility of Project column"), null);
			columnProject.Toggled += OnColumnVisibilityChanged;
			columnsActions[columnProject] = VisibleColumns.Project;
			group.Add (columnProject);

			var columnPath = new ToggleAction ("columnPath", GettextCatalog.GetString ("Path"),
				GettextCatalog.GetString ("Toggle visibility of Path column"), null);
			columnPath.Toggled += OnColumnVisibilityChanged;
			columnsActions[columnPath] = VisibleColumns.Path;
			group.Add (columnPath);

			var uiManager = new UIManager ();
			uiManager.InsertActionGroup (group, 0);
			
			string uiStr = "<ui><popup name='popup'>"
				+ "<menuitem action='help'/>"
				+ "<menuitem action='copy'/>"
				+ "<menuitem action='jump'/>"
				+ "<separator/>"
				+ "<menu action='columns'>"
				+ "<menuitem action='columnType' />"
				+ "<menuitem action='columnValidity' />"
				+ "<menuitem action='columnLine' />"
				+ "<menuitem action='columnDescription' />"
				+ "<menuitem action='columnFile' />"
				+ "<menuitem action='columnProject' />"
				+ "<menuitem action='columnPath' />"
				+ "</menu>"
				+ "</popup></ui>";

			uiManager.AddUiFromString (uiStr);
			menu = (Menu)uiManager.GetWidget ("/popup");
			menu.ShowAll ();

			menu.Shown += delegate {
				columnType.Active = view.Columns[VisibleColumns.Type].Visible;
				columnValidity.Active = view.Columns[VisibleColumns.Marked].Visible;
				columnLine.Active = view.Columns[VisibleColumns.Line].Visible;
				columnDescription.Active = view.Columns[VisibleColumns.Description].Visible;
				columnFile.Active = view.Columns[VisibleColumns.File].Visible;
				columnProject.Active = view.Columns[VisibleColumns.Project].Visible;
				columnPath.Active = view.Columns[VisibleColumns.Path].Visible;
				help.Sensitive = copy.Sensitive = jump.Sensitive =
					view.Selection != null &&
					view.Selection.CountSelectedRows () > 0 &&
					(columnType.Active ||
						columnValidity.Active ||
						columnLine.Active ||
						columnDescription.Active ||
						columnFile.Active ||
						columnPath.Active);
			};
			
			return menu;
		}
Beispiel #26
0
        public ItemEditBox (Items items, UIManager uiManager)
		: this(new Builder("item_edit_box.ui"))
        {
			Items = items;
			
			// create image the actions
			Gtk.Action addImageAction = new Gtk.Action("addImage","Add Image...","",Stock.Open);
			addImageAction.Activated += OnAddItemImage;
			Gtk.Action removeImageAction = new Gtk.Action("removeImage","Remove Image","",Stock.Remove);
			removeImageAction.Activated += OnRemoveItemImage;
			Gtk.Action imageAction = new Gtk.Action("itemImage","Image");
			
			ActionGroup imageActionGroup = new ActionGroup("itemImage");
			imageActionGroup.Add(addImageAction);
			imageActionGroup.Add(removeImageAction);
			imageActionGroup.Add(imageAction);
			uiManager.InsertActionGroup(imageActionGroup,0);
			
			// create the tag actions
			Gtk.Action addTagAction = new Gtk.Action("addTag","Add Tag","",Stock.Add);
			addTagAction.Activated += OnAddItemTag;
			Gtk.Action removeTagAction = new Gtk.Action("removeTag","Remove Tag","",Stock.Remove);
			removeTagAction.Activated += OnRemoveItemTag;
			Gtk.Action tagAction = new Gtk.Action("itemTag","Tag");
			
			ActionGroup tagActionGroup = new ActionGroup("itemTag");
			tagActionGroup.Add(addTagAction);
			tagActionGroup.Add(removeTagAction);
			tagActionGroup.Add(tagAction);
			uiManager.InsertActionGroup(tagActionGroup,0);
			
			// add columns to the item type combobox
			CellRenderer render = new CellRendererText ();
			itemEditType.PackStart(render, true);
			itemEditType.AddAttribute(render, "text", 0);
			
			// add columns and model to the depreciation combobox
			render = new CellRendererPixbuf ();
			itemEditDepreciationMethod.PackStart(render, false);
			itemEditDepreciationMethod.AddAttribute(render, "pixbuf", 0);
			render = new CellRendererText ();
			itemEditDepreciationMethod.PackStart(render, true);
			itemEditDepreciationMethod.AddAttribute(render, "text", 1);
			
			ListStore list = new ListStore(typeof(Gdk.Pixbuf),typeof(string),typeof(DepreciationMethod));
			list.AppendValues(new Gdk.Pixbuf(null,"degressive.png"),"Degressive",DepreciationMethod.Degressive);
			list.AppendValues(new Gdk.Pixbuf(null,"linear.png"),"Linear",DepreciationMethod.Linear);
			list.AppendValues(new Gdk.Pixbuf(null,"progressive.png"),"Progressive",DepreciationMethod.Progressive);
			itemEditDepreciationMethod.Model = list;
			
			// add columns and model to the label combobox
			render = new CellRendererPixbuf ();
			itemEditLabelMethod.PackStart(render, false);
			itemEditLabelMethod.AddAttribute(render, "pixbuf", 0);
			render = new CellRendererText ();
			itemEditLabelMethod.PackStart(render, true);
			itemEditLabelMethod.AddAttribute(render, "text", 1);
			
			list = new ListStore(typeof(Gdk.Pixbuf),typeof(string),typeof(DepreciationMethod));
			list.AppendValues(null,"Not Labelable",LabelMethod.None);
			list.AppendValues(null,"Printed Labels",LabelMethod.Print);
			list.AppendValues(null,"Painted Labels",LabelMethod.Paint);
			itemEditLabelMethod.Model = list;
			
			purchaseDatePicker = new PurchaseDatePicker();
			purchaseDatePicker.DateChanged += OnPickerDateChanged;
			itemEditShowCalendarIcon.Pixbuf = new Gdk.Pixbuf(null,"calendar.png");
			
			// create the images columns
			TreeViewColumn col = new TreeViewColumn ();
			col.Title = "images";
			render = new CellRendererToggle ();
			(render as CellRendererToggle).Toggled += OnMainImageToggle;
			(render as CellRendererToggle).Radio = true;
			col.PackStart(render, false);
			col.AddAttribute(render, "active", 1);			
			render = new CellRendererPixbuf ();
			col.PackStart       (render, false);
			col.AddAttribute(render, "pixbuf", 2);			
			render = new CellRendererText ();
			(render as CellRendererText).Editable = true;
			(render as CellRendererText).Edited += OnItemImageMemoEdited;
			render.EditingStarted += OnItemImageMemoEditingStarted;
			col.PackStart       (render, true);
			col.AddAttribute(render, "text", 3);
			col.AddAttribute(render, "foreground-gdk",4);
			itemEditImages.AppendColumn(col);
			
			itemEditImages.HeadersVisible = false;			
			TargetEntry target = new TargetEntry("text/plain",TargetFlags.OtherApp,0);
			TargetEntry[] targetArray = new TargetEntry[1];
			targetArray[0] = target;
			itemEditImages.EnableModelDragDest(targetArray, Gdk.DragAction.Copy);
			itemEditImages.DragDataReceived += OnItemImageDragDataReceived;
						
			// create the tags cells
			render = new CellRendererText ();
			itemEditTagCell = render;
			(render as CellRendererText).Editable = true;
			(render as CellRendererText).Edited += OnItemTagNameEdited;
			render.EditingStarted += OnStartItemTagEdit;
			itemEditTags.PackStart (render, false);
			itemEditTags.AddAttribute(render, "text", 1);
			
			// create the tag completion
			itemTagCompletion = new ItemTagChooser();
			itemTagCompletion.MatchFunc = ItemTabCompletionMatch;
			itemTagCompletion.MinimumKeyLength = 0;
			itemTagCompletion.PopupSetWidth = false;
			render = new CellRendererText ();
			itemTagCompletion.PackStart (render, true);
			itemTagCompletion.AddAttribute(render, "text", 1);
			
			// create the popup menues
			uiManager.AddUiFromResource("item_edit_box_menues.xml");
			itemImagePopup = (Menu) uiManager.GetWidget("/itemImagePopup");
        	itemTagPopup = (Menu) uiManager.GetWidget("/itemTagPopup");
		}