Example #1
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);
        }
Example #2
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);
        }
		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 ();
		}
 public ShortcutDialog(UIManager uiManager)
 {
     this.Build();
     this.uiManager = uiManager;
     MyAccelMap.AccelMapChanges.Clear();
     this.SetupTreeView();
 }
Example #5
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);
        }
Example #6
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();
        }
Example #7
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);
			
		}
 private void OnRealized(object sender, System.EventArgs args) {
     if ((this.uimanager != null)) {
         Gtk.Widget w;
         w = this.child.Toplevel;
         if (((w != null) && typeof(Gtk.Window).IsInstanceOfType(w))) {
             ((Gtk.Window)(w)).AddAccelGroup(this.uimanager.AccelGroup);
             this.uimanager = null;
         }
     }
 }
Example #9
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 ();
		}
Example #10
0
 private void OnRealized(object sender, EventArgs args)
 {
     if ((_uimanager != null)) {
         Widget w;
         w = _child.Toplevel;
         if (((w != null)
             && typeof(Window).IsInstanceOfType (w))) {
             ((Window)(w)).AddAccelGroup (_uimanager.AccelGroup);
             _uimanager = null;
         }
     }
 }
 private void OnRealized(object sender, System.EventArgs args)
 {
     if ((this.uimanager != null))
     {
         Gtk.Widget w;
         w = this.child.Toplevel;
         if (((w != null) && typeof(Gtk.Window).IsInstanceOfType(w)))
         {
             ((Gtk.Window)(w)).AddAccelGroup(this.uimanager.AccelGroup);
             this.uimanager = null;
         }
     }
 }
Example #12
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();
        }
Example #13
0
        public PrintDialog(Inventory inv, UIManager uiManager)
		: this(new Builder("print_dialog.ui"))
        {
			Inventory = inv;
			
			pagePreview = new PagePreview( (GtkSettings)inv.Settings);
			pagePreviewBox.Add(pagePreview);
			
			labelPreview = new LabelPreview( (GtkSettings)inv.Settings );
			labelPreviewBox.Add(labelPreview);
			
			labelFont.ShowSize = false;
			
			Inventory.Settings.LabelLayout.PropertyChanged += OnLayoutPropertyChanged;
			Inventory.Settings.PageLayout.PropertyChanged += OnLayoutPropertyChanged;
			
			this.Icon = ((GtkSettings)Inventory.Settings).WindowIcon;
			
			UpdateLayoutWidgets();
		}
Example #14
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);
        }
Example #15
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);
        }
Example #16
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");
	    }
Example #17
0
        void RegisterUIManager()
        {
            var newTaskAction = new ActionEntry ("NewTaskAction", Stock.New,
                Catalog.GetString ("New Task ..."), null, null, delegate {
                // Show the TaskWindow and then cause a new task to be created
                TaskWindow.ShowWindow (application);
                TaskWindow.GrabNewTaskEntryFocus (application);
            });

            var refreshAction =	new ActionEntry ("RefreshAction", Stock.Execute,
                Catalog.GetString ("Refresh Tasks ..."), null, null,
                delegate { application.BackendManager.ReInitializeBackend ();
            });

            var trayActionGroup = new ActionGroup ("Tray");
            trayActionGroup.Add (new ActionEntry [] {
                newTaskAction,
                new ActionEntry ("AboutAction", Stock.About, OnAbout),
                new ActionEntry ("PreferencesAction", Stock.Preferences,
                                 delegate { application.ShowPreferences (); }),
                refreshAction,
                new ActionEntry ("QuitAction", Stock.Quit,
                                 delegate { application.Exit (); })
            });

            ToggleTaskWindowAction = new Gtk.Action ("ToggleTaskWindowAction", Catalog.GetString ("Toggle Task Window"));
            ToggleTaskWindowAction.ActionGroup = trayActionGroup;
            ToggleTaskWindowAction.Activated += delegate { TaskWindow.ToggleWindowVisible (application); };

            uiManager = new UIManager ();
            uiManager.AddUiFromString (MenuXml);
            uiManager.InsertActionGroup (trayActionGroup, 0);

            SwitchBackendItems (false);
        }
Example #18
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 ();
        }
Example #19
0
 public ActionManager ()
 {
     ui_manager = new UIManager ();
 }
Example #20
0
 public CustomActionProxy(UIManager ui, Gtk.Action proxiedAction)
 {
     this.action = proxiedAction;
     this.ui = ui;
 }
Example #21
0
	public MainWindow (): base (MainClass.AppName)
	{
		this.Build();
				
		_views = new IGedcomView[]
		{
			SummaryViewView,
			FamilyViewView,
			IndividualViewView
		};
		_viewActions = new Gtk.Action[]
		{
			SummaryViewAction,
			FamilyViewAction,
			IndividualViewAction,
			SourceViewAction,
			MultimediaViewAction,
			RepositoryViewAction,
			PedigreeViewAction,
			NoteViewAction
		};
		
		foreach (IGedcomView view in _views)
		{
			view.MoreInformation += new EventHandler<IndividualArgs>(OnMoreInformation);
			view.MoreFamilyInformation += new EventHandler<FamilyArgs>(OnMoreFamilyInformation);
		    view.SpouseSelect += new EventHandler<SpouseSelectArgs>(OnSpouseSelect);
		    view.ShowSourceCitation += new EventHandler<SourceCitationArgs>(OnShowSourceCitation);
			view.SelectNewChild += new EventHandler<IndividualArgs>(OnSelectNewChild);
			view.SelectNewSpouse += new EventHandler<IndividualArgs>(OnSelectNewSpouse);
			view.SelectNewNote += new EventHandler<NoteArgs>(OnSelectNewNote);
			view.ShowScrapBook += new EventHandler<ScrapBookArgs>(OnShowScrapBook);
			view.ShowName += new EventHandler<IndividualArgs>(OnShowName);
			view.DeleteIndividual += new EventHandler<IndividualArgs>(OnDeleteIndividual);
			view.MoreFactInformation += new EventHandler<FactArgs>(OnMoreFactInformation);
		}

		SourceViewView.ShowScrapBook += new EventHandler<ScrapBookArgs>(OnShowScrapBook);
		SourceViewView.ShowSourceCitation += new EventHandler<SourceCitationArgs>(OnShowSourceCitation);
		MultimediaViewView.AddFile += new EventHandler<MultimediaFileArgs>(OnMultimediaView_AddFile);
		MultimediaViewView.OpenFile += new EventHandler<MultimediaFileArgs>(OnMultimediaView_OpenFile);
		MultimediaViewView.ShowSourceCitation += new EventHandler<SourceCitationArgs>(OnShowSourceCitation);
		RepositoryViewView.ShowSourceCitation += new EventHandler<SourceCitationArgs>(OnShowSourceCitation);
		NotesViewView.ShowSourceCitation += new EventHandler<SourceCitationArgs>(OnShowSourceCitation);
		
		// FIXME: not working via property in designer show all kicking in?
		NotesViewView.NoteOnly = true;
		
		ViewNotebook.ShowTabs = false;		
		ViewNotebook.Page = 0;
		_currentView = _views[0];
		
		ViewNotebook.Sensitive = false;
		Merge.Sensitive = false;
		Save.Sensitive = false;
		SaveAs.Sensitive = false;
		PropertiesAction.Sensitive = false;


		_viewGroup = View.ActionGroup;
		_toolsGroup = Tools.ActionGroup;
		_reportsGroup = Reports.ActionGroup;
		_defaultGroup = New.ActionGroup;		
		
		// get all report related actions, make insensitive
		foreach (Gtk.Action action in _reportsGroup.ListActions())
		{
			action.Sensitive = false;
		}
		
		// get all tools related actions, make insensitive
		foreach (Gtk.Action action in _toolsGroup.ListActions())
		{
			action.Sensitive = false;
		}
		
		// get all view related actions, make insensitive
		foreach (Gtk.Action action in _viewGroup.ListActions())
		{
			action.Sensitive = false;
		}
		SummaryViewAction.ActionGroup.Sensitive = true;

		NewIndividual.Sensitive = false;
		NewMedia.Sensitive = false;
		NewRepository.Sensitive = false;
		NewSource.Sensitive = false;
		NewNote.Sensitive = false;	

		// dropdown actions, not supported by stetic
		Gtk.UIManager manager = new Gtk.UIManager();
		GtkDropDownAction newDropDown = new GtkDropDownAction("New", "New", string.Empty, Gtk.Stock.New);
		newDropDown.Activated += OnNew_Activated;
		newDropDown.UIManager = manager;
		newDropDown.MenuPath = "/newpopup";
		manager.InsertActionGroup(_defaultGroup, 0);
		manager.AddUiFromString("<ui><popup name='newpopup'><menuitem action='NewDatabase'/><menuitem action='NewIndividual'/><menuitem action='NewMedia'/><menuitem action='NewRepository'/><menuitem action='NewSource'/><menuitem action='NewNote'/></popup></ui>");
		Gtk.Widget newButton = newDropDown.CreateToolItem();
		newDropDown.ConnectProxy(newButton);
		
		toolbar1.Insert((Gtk.ToolItem)newButton, 0);
		
		// gtk recent actions, not supported by stetic or gtk# 2.10
		_recentManager = Gtk.RecentManager.Default;
		//_recentManager.Limit = 4; // FIXME: don't hardcode max recent file count
		
		Gtk.RecentChooserMenu menu = new RecentChooserMenu(_recentManager);
		menu.LocalOnly = true;
		menu.SortType = RecentSortType.Mru;
		
		Gtk.RecentFilter filter = new RecentFilter();
		filter.Name = "GEDCOM files";
		filter.AddMimeType("application/x-gedcom");
		menu.AddFilter(filter);		
		menu.Filter = filter;
		menu.ItemActivated += RecentMenu_ItemActivated;
		_toolbarRecentMenu = menu;
		
		GtkDropDownAction recentDropDown = new GtkDropDownAction("Open", "Open", "Open File", Gtk.Stock.Open);
		recentDropDown.Menu = menu;
		recentDropDown.Activated += OnOpen_Activated;
		Gtk.Widget openButton = recentDropDown.CreateToolItem();
		recentDropDown.ConnectProxy(openButton);
		
		toolbar1.Insert((Gtk.ToolItem)openButton, 1);
	}
Example #22
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);
            };
        }
Example #23
0
		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 ();
		}
        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;
        }
Example #25
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");
		}
Example #26
0
        /// <summary>
        /// Sets up the UI elements using the UI manager and connecting
        /// the events.
        /// </summary>
        private UIManager SetupUI()
        {
            // Set up our action entries
            ActionEntry[] entries = new ActionEntry[] {
                new ActionEntry("FileMenu", null, "_File", null,
                    null, null),

                new ActionEntry("Reload", null, "Re_load", "<control>R",
                    "Reload", new EventHandler(OnReload)),
                new ActionEntry("ZoomIn", null, "Zoom _In", "<control>I",
                    "Zoom In", new EventHandler(OnZoomIn)),
                new ActionEntry("ZoomOut", null, "Zoom _Out", "<control>O",
                    "Zoom Out", new EventHandler(OnZoomOut)),
                new ActionEntry("ZoomReset", null, "Zoom _Reset", "<control>0",
                    "Zoom Reset", new EventHandler(OnZoomReset)),

                new ActionEntry("Quit", Stock.Quit, "_Quit", "<control>Q",
                    "Quit", new EventHandler(OnDelete)),
            };

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

            // Create the UI to populate data
            uim = new UIManager();
            uim.InsertActionGroup(actions, 0);
            AddAccelGroup(uim.AccelGroup);
            uim.AddUiFromResource("ui.xml");

            // Return the results
            return uim;
        }
Example #27
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.
        }
Example #28
0
        private void RegisterUIManager()
        {
            ActionGroup trayActionGroup = new ActionGroup ("Tray");
            trayActionGroup.Add (new ActionEntry [] {
                new ActionEntry ("NewTaskAction",
                                 Stock.New,
                                 Catalog.GetString ("New Task ..."),
                                 null,
                                 null,
                                 OnNewTask),

                new ActionEntry ("ShowTasksAction",
                                 null,
                                 Catalog.GetString ("Show Tasks ..."),
                                 null,
                                 null,
                                 OnShowTaskWindow),

                new ActionEntry ("AboutAction",
                                 Stock.About,
                                 OnAbout),

                new ActionEntry ("PreferencesAction",
                                 Stock.Preferences,
                                 OnPreferences),

                new ActionEntry ("RefreshAction",
                                 Stock.Execute,
                                 Catalog.GetString ("Refresh Tasks ..."),
                                 null,
                                 null,
                                 OnRefreshAction),

                new ActionEntry ("QuitAction",
                                 Stock.Quit,
                                 OnQuit)
            });

            uiManager = new UIManager ();
            uiManager.AddUiFromString (menuXml);
            uiManager.InsertActionGroup (trayActionGroup, 0);
        }
Example #29
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 ();
        }
		void AddActions ()
		{
			ActionEntry[] actions = 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[] toggleActions = new ToggleActionEntry[]
				{
					new ToggleActionEntry ("Bold", Stock.Bold, "_Bold", "<control>B", "Bold", new EventHandler (ActionActivated), true)
				};

			RadioActionEntry[] colorActions = 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[] shapeActions = 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 group = new ActionGroup ("AppWindowActions");
			group.Add (actions);
			group.Add (toggleActions);
			group.Add (colorActions, (int)Color.Red, new ChangedHandler (RadioActionActivated));
			group.Add (shapeActions, (int)Shape.Square, new ChangedHandler (RadioActionActivated));

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

			AddAccelGroup (uim.AccelGroup);
		}
 public void SetUiManager(Gtk.UIManager uim)
 {
     this.uimanager       = uim;
     this.child.Realized += new System.EventHandler(this.OnRealized);
 }
Example #32
0
 public void Load()
 {
     ui_manager = Runtime.UIManager;
     ui_manager.InsertActionGroup(debug_actions, 0);
     merge_id = ui_manager.AddUiFromResource("DebugPluginMenus.xml");
 }
 public RatingActionProxy(UIManager ui, Gtk.Action action)
     : base(ui, action)
 {
 }
		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);
				};
			}
		}
Example #35
0
		public static int Main3 (string[] args)
		{
			Application.Init ();
			Window win = new Window ("Action Demo");
			win.DefaultSize = new Gdk.Size (200, 150);
			win.DeleteEvent += new DeleteEventHandler (OnWindowDelete);
			
			box = new VBox (false, 0);
			win.Add (box);
			
			group = new ActionGroup ("TestActions");
			group.Add (entries);
			group.Add (toggleEntries);
			group.Add (radioEntries, (int)Justify.Left, new ChangedHandler (OnRadio));
			group.Add (toolbarEntries, (int)ToolbarStyle.BothHoriz, new ChangedHandler (OnToolbarStyle));
			
			uim = new UIManager ();
			uim.AddWidget += new AddWidgetHandler (OnWidgetAdd);
			uim.ConnectProxy += new ConnectProxyHandler (OnProxyConnect);
			uim.InsertActionGroup (group, 0);
			uim.AddUiFromString (ui_info);
			
			statusbar = new Statusbar ();
			box.PackEnd (statusbar, false, true, 0);

			VBox vbox = new VBox (false, 5);
			Button button = new Button ("Blah");
			vbox.PackEnd (button, true, true, 0);
			HBox hbox = new HBox (false, 5);
			spin = new SpinButton (new Adjustment (100, 100, 10000, 1, 100, 100), 100, 0);
			hbox.PackStart (spin, true, true, 0);
			button = new Button ("Remove");
			button.Clicked += new EventHandler (OnDynamicRemove);
			hbox.PackEnd (button, false, false, 0);
			button = new Button ("Add");
			button.Clicked += new EventHandler (OnDynamicAdd);
			hbox.PackEnd (button, false, false, 0);
			vbox.PackEnd (hbox, false, false, 0);
			box.PackEnd (vbox, true, true, 0);

			win.ShowAll ();
			Application.Run ();
			return 0;
		}
Example #36
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;
		}
 public void SetUiManager(UIManager uim)
 {
     uimanager       = uim;
     child.Realized += OnRealized;
 }