コード例 #1
0
ファイル: ViewActions.cs プロジェクト: asitti/Pinta
        public ViewActions()
        {
            Gtk.IconFactory fact = new Gtk.IconFactory();
            fact.Add("Menu.View.ActualSize.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Menu.View.ActualSize.png")));
            fact.Add("Menu.View.Grid.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Menu.View.Grid.png")));
            fact.Add("Menu.View.Rulers.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Menu.View.Rulers.png")));
            fact.Add("Menu.View.ZoomIn.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Menu.View.ZoomIn.png")));
            fact.Add("Menu.View.ZoomOut.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Menu.View.ZoomOut.png")));
            fact.Add("Menu.View.ZoomToSelection.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Menu.View.ZoomToSelection.png")));
            fact.Add("Menu.View.ZoomToWindow.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Menu.View.ZoomToWindow.png")));
            fact.AddDefault();

            ZoomIn          = new Gtk.Action("ZoomIn", Catalog.GetString("Zoom In"), null, Stock.ZoomIn);
            ZoomOut         = new Gtk.Action("ZoomOut", Catalog.GetString("Zoom Out"), null, Stock.ZoomOut);
            ZoomToWindow    = new Gtk.Action("ZoomToWindow", Catalog.GetString("Best Fit"), null, Stock.ZoomFit);
            ZoomToSelection = new Gtk.Action("ZoomToSelection", Catalog.GetString("Zoom to Selection"), null, "Menu.View.ZoomToSelection.png");
            ActualSize      = new Gtk.Action("ActualSize", Catalog.GetString("Normal Size"), null, Stock.Zoom100);
            ToolBar         = new Gtk.ToggleAction("Toolbar", Catalog.GetString("Toolbar"), null, null);
            PixelGrid       = new Gtk.ToggleAction("PixelGrid", Catalog.GetString("Pixel Grid"), null, "Menu.View.Grid.png");
            Rulers          = new Gtk.ToggleAction("Rulers", Catalog.GetString("Rulers"), null, "Menu.View.Rulers.png");
            Pixels          = new Gtk.RadioAction("Pixels", Catalog.GetString("Pixels"), null, null, 0);
            Inches          = new Gtk.RadioAction("Inches", Catalog.GetString("Inches"), null, null, 1);
            Centimeters     = new Gtk.RadioAction("Centimeters", Catalog.GetString("Centimeters"), null, null, 2);
            Fullscreen      = new Gtk.Action("Fullscreen", Catalog.GetString("Fullscreen"), null, Stock.Fullscreen);

            ZoomCollection = new string[] {
                ToPercent(36),
                ToPercent(24),
                ToPercent(16),
                ToPercent(12),
                ToPercent(8),
                ToPercent(7),
                ToPercent(6),
                ToPercent(5),
                ToPercent(4),
                ToPercent(3),
                ToPercent(2),
                ToPercent(1.75),
                ToPercent(1.5),
                ToPercent(1.25),
                ToPercent(1),
                ToPercent(0.66),
                ToPercent(0.5),
                ToPercent(0.33),
                ToPercent(0.25),
                ToPercent(0.16),
                ToPercent(0.12),
                ToPercent(0.08),
                ToPercent(0.05),
                Catalog.GetString("Window")
            };
            ZoomComboBox = new ToolBarComboBox(90, DefaultZoomIndex(), true, ZoomCollection);

            // Make sure these are the same group so only one will be selected at a time
            Inches.Group      = Pixels.Group;
            Centimeters.Group = Pixels.Group;

            // The toolbar is shown by default.
            ToolBar.Active = true;
        }
コード例 #2
0
ファイル: ViewActions.cs プロジェクト: manish/Pinta
        public ViewActions()
        {
            Gtk.IconFactory fact = new Gtk.IconFactory ();
            fact.Add ("Menu.View.ActualSize.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.View.ActualSize.png")));
            fact.Add ("Menu.View.Grid.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.View.Grid.png")));
            fact.Add ("Menu.View.Rulers.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.View.Rulers.png")));
            fact.Add ("Menu.View.ZoomIn.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.View.ZoomIn.png")));
            fact.Add ("Menu.View.ZoomOut.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.View.ZoomOut.png")));
            fact.Add ("Menu.View.ZoomToSelection.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.View.ZoomToSelection.png")));
            fact.Add ("Menu.View.ZoomToWindow.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.View.ZoomToWindow.png")));
            fact.AddDefault ();

            ZoomIn = new Gtk.Action ("ZoomIn", Catalog.GetString ("Zoom In"), null, Stock.ZoomIn);
            ZoomOut = new Gtk.Action ("ZoomOut", Catalog.GetString ("Zoom Out"), null, Stock.ZoomOut);
            ZoomToWindow = new Gtk.Action ("ZoomToWindow", Catalog.GetString ("Best Fit"), null, Stock.ZoomFit);
            ZoomToSelection = new Gtk.Action ("ZoomToSelection", Catalog.GetString ("Zoom to Selection"), null, "Menu.View.ZoomToSelection.png");
            ActualSize = new Gtk.Action ("ActualSize", Catalog.GetString ("Normal Size"), null, Stock.Zoom100);
            ToolBar = new Gtk.ToggleAction ("Toolbar", Catalog.GetString ("Toolbar"), null, null);
            PixelGrid = new Gtk.ToggleAction ("PixelGrid", Catalog.GetString ("Pixel Grid"), null, "Menu.View.Grid.png");
            Rulers = new Gtk.ToggleAction ("Rulers", Catalog.GetString ("Rulers"), null, "Menu.View.Rulers.png");
            Pixels = new Gtk.RadioAction ("Pixels", Catalog.GetString ("Pixels"), null, null, 0);
            Inches = new Gtk.RadioAction ("Inches", Catalog.GetString ("Inches"), null, null, 1);
            Centimeters = new Gtk.RadioAction ("Centimeters", Catalog.GetString ("Centimeters"), null, null, 2);
            Fullscreen = new Gtk.Action ("Fullscreen", Catalog.GetString ("Fullscreen"), null, Stock.Fullscreen);

            ZoomCollection = new string[] { "3600%", "2400%", "1600%", "1200%", "800%", "700%", "600%", "500%", "400%", "300%", "200%", "175%", "150%", "125%", "100%", "66%", "50%", "33%", "25%", "16%", "12%", "8%", "5%", "Window" };
            ZoomComboBox = new ToolBarComboBox (75, DefaultZoomIndex(), true, ZoomCollection);

            // Make sure these are the same group so only one will be selected at a time
            Inches.Group = Pixels.Group;
            Centimeters.Group = Pixels.Group;
        }
コード例 #3
0
        public ViewActions()
        {
            Gtk.IconFactory fact = new Gtk.IconFactory();
            fact.Add("Menu.View.ActualSize.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Menu.View.ActualSize.png")));
            fact.Add("Menu.View.Grid.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Menu.View.Grid.png")));
            fact.Add("Menu.View.Rulers.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Menu.View.Rulers.png")));
            fact.Add("Menu.View.ZoomIn.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Menu.View.ZoomIn.png")));
            fact.Add("Menu.View.ZoomOut.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Menu.View.ZoomOut.png")));
            fact.Add("Menu.View.ZoomToSelection.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Menu.View.ZoomToSelection.png")));
            fact.Add("Menu.View.ZoomToWindow.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Menu.View.ZoomToWindow.png")));
            fact.AddDefault();

            ZoomIn          = new Gtk.Action("ZoomIn", Catalog.GetString("Zoom In"), null, Stock.ZoomIn);
            ZoomOut         = new Gtk.Action("ZoomOut", Catalog.GetString("Zoom Out"), null, Stock.ZoomOut);
            ZoomToWindow    = new Gtk.Action("ZoomToWindow", Catalog.GetString("Best Fit"), null, Stock.ZoomFit);
            ZoomToSelection = new Gtk.Action("ZoomToSelection", Catalog.GetString("Zoom to Selection"), null, "Menu.View.ZoomToSelection.png");
            ActualSize      = new Gtk.Action("ActualSize", Catalog.GetString("Normal Size"), null, Stock.Zoom100);
            ToolBar         = new Gtk.ToggleAction("Toolbar", Catalog.GetString("Toolbar"), null, null);
            PixelGrid       = new Gtk.ToggleAction("PixelGrid", Catalog.GetString("Pixel Grid"), null, "Menu.View.Grid.png");
            Rulers          = new Gtk.ToggleAction("Rulers", Catalog.GetString("Rulers"), null, "Menu.View.Rulers.png");
            Pixels          = new Gtk.RadioAction("Pixels", Catalog.GetString("Pixels"), null, null, 0);
            Inches          = new Gtk.RadioAction("Inches", Catalog.GetString("Inches"), null, null, 1);
            Centimeters     = new Gtk.RadioAction("Centimeters", Catalog.GetString("Centimeters"), null, null, 2);
            Fullscreen      = new Gtk.Action("Fullscreen", Catalog.GetString("Fullscreen"), null, Stock.Fullscreen);

            ZoomCollection = new string[] { "3600%", "2400%", "1600%", "1200%", "800%", "700%", "600%", "500%", "400%", "300%", "200%", "175%", "150%", "125%", "100%", "66%", "50%", "33%", "25%", "16%", "12%", "8%", "5%", Catalog.GetString("Window") };
            ZoomComboBox   = new ToolBarComboBox(75, DefaultZoomIndex(), true, ZoomCollection);

            // Make sure these are the same group so only one will be selected at a time
            Inches.Group      = Pixels.Group;
            Centimeters.Group = Pixels.Group;
        }
コード例 #4
0
ファイル: WindowActions.cs プロジェクト: RudoCris/Pinta
        public RadioAction AddDocument(Document doc)
        {
            RadioAction action = new RadioAction (doc.Guid.ToString (), doc.Filename, string.Empty, null, 0);

            // Tie these all together as a radio group
            if (OpenWindows.Count > 0)
                action.Group = OpenWindows[0].Group;

            action.Active = true;
            action.Activated += (o, e) => { if ((o as Gtk.ToggleAction).Active) PintaCore.Workspace.SetActiveDocumentInternal (doc); };

            OpenWindows.Add (action);
            CheckMenuItem menuitem;

            // We only assign accelerators up to Alt-9
            if (OpenWindows.Count < 10)
                menuitem = action.CreateAcceleratedMenuItem (IntegerToNumKey (OpenWindows.Count), Gdk.ModifierType.Mod1Mask);
            else
                menuitem = (CheckMenuItem)action.CreateMenuItem ();

            action_menu_items.Add (action, menuitem);
            window_menu.Add (menuitem);

            doc.Renamed += (o, e) => { UpdateMenuLabel (action, o as Document); };
            doc.IsDirtyChanged += (o, e) => { UpdateMenuLabel (action, o as Document); };

            return action;
        }
コード例 #5
0
ファイル: ActionGroup.cs プロジェクト: mhutch/gtk-sharp
        public void Add(RadioActionEntry[] entries, int value, ChangedHandler changed)
        {
            GLib.SList    group   = new GLib.SList(typeof(RadioAction));
            RadioAction[] actions = new RadioAction[entries.Length];
            for (int i = 0; i < entries.Length; i++)
            {
                actions[i] = new RadioAction(entries[i].name, entries[i].label,
                                             entries[i].tooltip, entries[i].stock_id, entries[i].value);
                actions[i].Group  = group;
                group             = actions[i].Group;
                actions[i].Active = value == entries[i].value;
                if (entries[i].accelerator == null)
                {
                    Add(actions[i]);
                }
                else
                {
                    Add(actions[i], entries[i].accelerator);
                }
            }

            // Add the ChangedHandler when we're done adding all the actions.
            // Otherwise, setting the Active property will trigger a premature event.
            if (changed != null)
            {
                actions[0].Changed += changed;
            }
        }
コード例 #6
0
        void _(Gtk.RadioAction active)
        {
            var child = (Image)Child;

            child.Stock       = active.StockId;
            child.IconName    = active.IconName;
            child.TooltipText = active.Tooltip;
        }
コード例 #7
0
 static void Changed_cb(IntPtr inst, IntPtr current)
 {
     try {
         RadioAction __obj = GLib.Object.GetObject(inst, false) as RadioAction;
         __obj.OnChanged(GLib.Object.GetObject(current) as Gtk.RadioAction);
     } catch (Exception e) {
         GLib.ExceptionManager.RaiseUnhandledException(e, false);
     }
 }
コード例 #8
0
ファイル: PlaysTreeView.cs プロジェクト: youmery/longomatch
        private void SetCategoriesMenu()
        {
            Gtk.Action  edit, editProp, sortMenu;
            UIManager   manager;
            ActionGroup g;

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

            edit           = new Gtk.Action("EditAction", Mono.Unix.Catalog.GetString("Edit name"), 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);
            editProp       = new Gtk.Action("EditPropAction", Mono.Unix.Catalog.GetString("Edit properties"), null, "gtk-edit");

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


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

            manager.InsertActionGroup(g, 0);

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

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

            edit.Activated           += OnEdit;
            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 Category, null);
            };
        }
コード例 #9
0
 public Menu BuildBookmarkMenu()
 {
     Menu bookmarkMenu = new Menu();
     string[] bookmarks = m_App.CacheStore.GetBookmarkLists();
     int count = 0;
     RadioAction noList = new RadioAction("None", Catalog.GetString("None"), null, null, count);
     noList.Active = true;
     noList.Toggled += HandleNoListToggled;
     bookmarkMenu.Append(noList.CreateMenuItem());
     foreach(string bookmark in bookmarks)
     {
         RadioAction action = new RadioAction(bookmark, bookmark, null, null, count);
         action.Group = noList.Group;
         if (bookmark == m_App.CacheStore.ActiveBookmarkList)
             action.Active = true;
         action.Toggled += HandleActionToggled;
         bookmarkMenu.Append(action.CreateMenuItem());
     }
     return bookmarkMenu;
 }
コード例 #10
0
		public void Add (RadioActionEntry[] entries, int value, ChangedHandler changed)
		{
			RadioAction[] group = null;
			RadioAction[] actions = new RadioAction[entries.Length];
			for (int i = 0; i < entries.Length; i++) {
				actions[i] = new RadioAction (entries[i].name, entries[i].label,
				                              entries[i].tooltip, entries[i].stock_id, entries[i].value);
				actions[i].Group = group;
				group = actions[i].Group;
				actions[i].Active = value == entries[i].value;
				if (entries[i].accelerator == null)
					Add (actions[i]);
				else
					Add (actions[i], entries[i].accelerator);
			}

			// Add the ChangedHandler when we're done adding all the actions.
			// Otherwise, setting the Active property will trigger a premature event.
			if (changed != null)
				actions[0].Changed += changed;
		}
コード例 #11
0
        internal static Gtk.RadioAction CreateRadioAction(string name,
                                                          string label,
                                                          string tooltip,
                                                          string stockid,
                                                          int value,
                                                          GLib.SList grp,
                                                          EventHandler activated)
        {
            Gtk.RadioAction a = new Gtk.RadioAction(name, label, tooltip, stockid, value);

            if (grp != null)
            {
                a.Group = grp;
            }

            if (activated != null)
            {
                a.Activated += activated;
            }

            return(a);
        }
コード例 #12
0
ファイル: ViewActions.cs プロジェクト: msiyer/Pinta
		public ViewActions ()
		{
			Gtk.IconFactory fact = new Gtk.IconFactory ();
			fact.Add ("Menu.View.ActualSize.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.View.ActualSize.png")));
			fact.Add ("Menu.View.Grid.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.View.Grid.png")));
			fact.Add ("Menu.View.Rulers.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.View.Rulers.png")));
			fact.Add ("Menu.View.ZoomIn.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.View.ZoomIn.png")));
			fact.Add ("Menu.View.ZoomOut.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.View.ZoomOut.png")));
			fact.Add ("Menu.View.ZoomToSelection.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.View.ZoomToSelection.png")));
			fact.Add ("Menu.View.ZoomToWindow.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.View.ZoomToWindow.png")));
			fact.AddDefault ();
			
			ZoomIn = new Gtk.Action ("ZoomIn", Catalog.GetString ("Zoom In"), null, Stock.ZoomIn);
			ZoomOut = new Gtk.Action ("ZoomOut", Catalog.GetString ("Zoom Out"), null, Stock.ZoomOut);
			ZoomToWindow = new Gtk.Action ("ZoomToWindow", Catalog.GetString ("Best Fit"), null, Stock.ZoomFit);
			ZoomToSelection = new Gtk.Action ("ZoomToSelection", Catalog.GetString ("Zoom to Selection"), null, "Menu.View.ZoomToSelection.png");
			ActualSize = new Gtk.Action ("ActualSize", Catalog.GetString ("Normal Size"), null, Stock.Zoom100);
            ToolBar = new Gtk.ToggleAction ("Toolbar", Catalog.GetString ("Toolbar"), null, null);
            ImageTabs = new Gtk.ToggleAction ("ImageTabs", Catalog.GetString ("Image Tabs"), null, null);
            PixelGrid = new Gtk.ToggleAction ("PixelGrid", Catalog.GetString ("Pixel Grid"), null, "Menu.View.Grid.png");
			Rulers = new Gtk.ToggleAction ("Rulers", Catalog.GetString ("Rulers"), null, "Menu.View.Rulers.png");
			Pixels = new Gtk.RadioAction ("Pixels", Catalog.GetString ("Pixels"), null, null, 0);
			Inches = new Gtk.RadioAction ("Inches", Catalog.GetString ("Inches"), null, null, 1);
			Centimeters = new Gtk.RadioAction ("Centimeters", Catalog.GetString ("Centimeters"), null, null, 2);
			Fullscreen = new Gtk.Action ("Fullscreen", Catalog.GetString ("Fullscreen"), null, Stock.Fullscreen);

			ZoomCollection = new string[] {
				ToPercent (36),
				ToPercent (24),
				ToPercent (16),
				ToPercent (12),
				ToPercent (8),
				ToPercent (7),
				ToPercent (6),
				ToPercent (5),
				ToPercent (4),
				ToPercent (3),
				ToPercent (2),
				ToPercent (1.75),
				ToPercent (1.5),
				ToPercent (1.25),
				ToPercent (1),
				ToPercent (0.66),
				ToPercent (0.5),
				ToPercent (0.33),
				ToPercent (0.25),
				ToPercent (0.16),
				ToPercent (0.12),
				ToPercent (0.08),
				ToPercent (0.05),
				Catalog.GetString ("Window")
			};
			ZoomComboBox = new ToolBarComboBox (90, DefaultZoomIndex(), true, ZoomCollection);

			// Make sure these are the same group so only one will be selected at a time
			Inches.Group = Pixels.Group;
			Centimeters.Group = Pixels.Group;

            // The toolbar is shown by default.
            ToolBar.Active = true;
            ImageTabs.Active = true;
		}
コード例 #13
0
ファイル: WindowActions.cs プロジェクト: RodH257/Pinta
 private void UpdateMenuLabel(RadioAction action, Document doc)
 {
     action.Label = string.Format ("{0}{1}", doc.Filename, doc.IsDirty ? "*" : string.Empty);
 }
コード例 #14
0
ファイル: PlaysTreeView.cs プロジェクト: GNOME/longomatch
        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);
            };
        }
コード例 #15
0
ファイル: ViewUIHandler.cs プロジェクト: chergert/adroit
        void AddViewActions(ActionGroup actionGroup)
        {
            var guiService = ServiceManager.Get<GuiService> ();

            var view = new Gtk.Action ("view", Catalog.GetString ("_View"));
            actionGroup.Add (view);

            var planning = new Gtk.RadioAction ("planning", Catalog.GetString ("Planning"), Catalog.GetString ("Select the Planning mode"), null, 0);
            var context = new Gtk.RadioAction ("context", Catalog.GetString ("Context"), Catalog.GetString ("Select the Context mode"), null, 1);
            var calendar = new Gtk.RadioAction ("calendar", Catalog.GetString ("Calendar"), Catalog.GetString ("Select the Calendar mode"), null, 2);

            context.Group = planning.Group;
            calendar.Group = planning.Group;

            planning.CurrentValue = 0;

            guiService.Window.ModeChanged += delegate {
                if (!m_inModeUpdate) {
                    m_inModeUpdate = true;
                    planning.CurrentValue = guiService.Window.Mode;
                    m_inModeUpdate = false;
                }
            };

            planning.Activated += delegate {
                if (!m_inModeUpdate) {
                    m_inModeUpdate = true;
                    guiService.Window.Mode = 0;
                    m_inModeUpdate = false;
                }
            };

            context.Activated += delegate {
                if (!m_inModeUpdate) {
                    m_inModeUpdate = true;
                    guiService.Window.Mode = 1;
                    m_inModeUpdate = false;
                }
            };

            calendar.Activated += delegate {
                if (!m_inModeUpdate) {
                    m_inModeUpdate = true;
                    guiService.Window.Mode = 2;
                    m_inModeUpdate = false;
                }
            };

            actionGroup.Add (planning, "<Alt>1");
            actionGroup.Add (context, "<Alt>2");
            actionGroup.Add (calendar, "<Alt>3");

            var attachments = new Gtk.ToggleAction ("attachments", Catalog.GetString ("Show _Attachments"), Catalog.GetString ("Show attachments"), null);
            attachments.Active = true;
            attachments.Activated += delegate {
                if (attachments.Active)
                    guiService.Window.ShowAttachments ();
                else
                    guiService.Window.HideAttachments ();
            };
            actionGroup.Add (attachments);

            var sidebar = new Gtk.ToggleAction ("sidebar", Catalog.GetString ("Show _Sidebar"), Catalog.GetString ("Show the sidebar"), null);
            sidebar.Active = true;
            sidebar.Activated += delegate {
                if (sidebar.Active)
                    guiService.Window.ShowSidebar ();
                else
                    guiService.Window.HideSidebar ();
            };
            actionGroup.Add (sidebar, "F9");

            var fullscreen = new Gtk.Action ("fullscreen", null, null, Gtk.Stock.Fullscreen);
            actionGroup.Add (fullscreen, "F11");

            var compact = new Gtk.ToggleAction ("compact", Catalog.GetString ("Compact Mode"), Catalog.GetString ("Enable compact mode"), null);
            compact.Active = guiService.Window.Planning.CompactMode;
            compact.Activated += delegate {
                guiService.Window.Planning.CompactMode = compact.Active;
            };
            actionGroup.Add (compact);
        }
コード例 #16
0
ファイル: WindowActions.cs プロジェクト: RudoCris/Pinta
 private void UpdateMenuLabel(RadioAction action, Document doc)
 {
     action.Label = string.Format ("{0}{1}", doc.Filename, doc.IsDirty ? "*" : string.Empty);
     PintaCore.Workspace.ResetTitle ();
 }
コード例 #17
0
#pragma warning disable 219
	public void UpdateBookmarkList(List<string> items)
	{
		Menu bookmarksSub = new Menu();
		Menu addAllSub = new Menu();
		Menu addSelSub = new Menu();
	
		CacheStore store = Engine.getInstance().Store;
		int count = 0;
		GLib.SList grp = new GLib.SList(IntPtr.Zero);
		RadioAction noList = new RadioAction("None", Catalog.GetString("None"), null, null, count);
		noList.Active = true;
		noList.Toggled += HandleNoListToggled;
		bookmarksSub.Append(noList.CreateMenuItem());
		bookmarksSub.Append(new MenuItem());
		foreach (string str in items)
		{
			RadioAction action = new RadioAction(str, str, null, null, count);
			action.Group = noList.Group;
			action.Toggled += HandleActionToggled;
			bookmarksSub.Append(action.CreateMenuItem());
			MenuItem bookmarkAll = new MenuItem(str);
			if (store.BookmarkList == str)
				bookmarkAll.Sensitive = false;
			bookmarkAll.Activated += HandleBookmarkAllActivated;
			addAllSub.Append(bookmarkAll);
			MenuItem bookmarkSel = new MenuItem(str);
			if (store.BookmarkList == str)
				bookmarkSel.Sensitive = false;
			bookmarkSel.Activated += HandleBookmarkSelActivated;
			addSelSub.Append(bookmarkSel);
			if (str == store.BookmarkList)
				action.Active = true;
			count++;
		}
		if (items.Count != 0)
		{
			bmrkLists.Submenu = bookmarksSub;
			bmrkLists.Sensitive = true;
			addVisibleCaches.Submenu = addAllSub;
			addVisibleCaches.Sensitive = true;
			addCacheTo.Submenu = addSelSub;
			addCacheTo.Sensitive = true;
		}
		else
		{
			bmrkLists.Sensitive = false;
			bmrkLists.Submenu = null;
			addVisibleCaches.Submenu = null;
			addVisibleCaches.Sensitive = false;
			addCacheTo.Submenu = null;
			addCacheTo.Sensitive = false;
		}
		bmrkLists.ShowAll();
		addVisibleCaches.ShowAll();
		addCacheTo.ShowAll();		
	}