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);
        }
Пример #2
0
        private void AddEmbeddedSubtitle(int i)
        {
            string desc = ServiceManager.PlayerEngine.GetSubtitleDescription(i);

            if (String.IsNullOrEmpty(desc))
            {
                desc = String.Format(Catalog.GetString("Subtitle {0}"), i);
            }
            RadioActionEntry new_action = new RadioActionEntry(String.Format("Subtitle{0}", i), null,
                                                               desc, null,
                                                               String.Format(Catalog.GetString("Activate embedded subtitle {0}"), i), i);

            embedded_subtitles_actions.Add(new_action);
        }
Пример #3
0
        private void UpdateActions()
        {
            // Clear out the old options
            foreach (string id in shuffle_modes.Values)
            {
                Remove(String.Format("Shuffle_{0}", id));
            }
            shuffle_modes.Clear();

            var radio_group = new RadioActionEntry [shuffler.RandomModes.Count];
            int i           = 0;

            // Add all the shuffle options
            foreach (var random_by in shuffler.RandomModes)
            {
                string action_name = String.Format("Shuffle_{0}", random_by.Id);
                int    id          = shuffle_modes.Count;
                shuffle_modes[id] = random_by.Id;
                radio_group[i++]  = new RadioActionEntry(
                    action_name, null,
                    random_by.Label, null,
                    random_by.Description,
                    id);
            }

            Add(radio_group, 0, OnActionChanged);

            // Set the icons
            foreach (var random_by in shuffler.RandomModes)
            {
                this[String.Format("Shuffle_{0}", random_by.Id)].IconName = random_by.IconName ?? "media-playlist-shuffle";
            }
            this[shuffle_off_action].StockId = Gtk.Stock.MediaNext;

            var action = this[ConfigIdToActionName(ShuffleMode.Get())];

            if (action is RadioAction)
            {
                Active = (RadioAction)action;
            }
            else
            {
                Active = (RadioAction)this[shuffle_off_action];
            }

            Active.Activate();
            OnChanged();
        }
Пример #4
0
        private void UpdateActions()
        {
            // Clear out the old options
            foreach (string id in rendererActions.Values)
            {
                Remove(id);
            }
            rendererActions.Clear();

            var radio_group = new RadioActionEntry [renderers.Count];
            int i           = 0;

            // Add all the renderer options
            foreach (var rendererIterator in renderers)
            {
                string action_name = rendererIterator.GetType().FullName;
                int    id          = rendererActions.Count;
                rendererActions [id] = action_name;
                radio_group [i++]    = new RadioActionEntry(
                    action_name, null,
                    rendererIterator.Name, null,
                    rendererIterator.Name,
                    id
                    );
            }

            Add(radio_group, 0, OnActionChanged);

            var radio_action = this [ArtistListMode.Get()] as RadioAction;

            if (renderers.Count > 0 && radio_action != null)
            {
                this.renderer = renderers [radio_action.Value];

                if (this.renderer == null)
                {
                    SetRenderer(renderers [0]);
                }

                var action = this [this.renderer.GetType().FullName];
                if (action is RadioAction)
                {
                    Active = (RadioAction)action;
                }

                Active.Activate();
            }
        }
Пример #5
0
        public void SocetServerMenu()
        {
            ui.InsertActionGroup(dynGroupSocket, 0);
            mergeIdSocket = ui.NewMergeId();

            string nameStopC  = "StopConsole";
            string labelStopC = String.Format("Stop Remote Console");

            Gtk.Action actionStopC = new Gtk.Action(nameStopC, labelStopC);
            actionStopC.Activated += delegate(object sender, EventArgs e) {
                MainClass.MainWindow.StopSocetServer();
            };
            dynGroupSocket.Add(actionStopC);
            ui.AddUi(mergeIdSocket, "/menubar/ToolsAction/remoteconsole", nameStopC, nameStopC, UIManagerItemType.Menuitem, false);

            string nameStartC  = "StartConsole";
            string labelStartC = String.Format("Start Remote Console");

            Gtk.Action actionStartC = new Gtk.Action(nameStartC, labelStartC);
            actionStartC.Activated += delegate(object sender, EventArgs e) {
                MainClass.MainWindow.StartSocetServer(MainClass.Settings.RemoteIpAdress);
            };
            dynGroupSocket.Add(actionStartC);
            ui.AddUi(mergeIdSocket, "/menubar/ToolsAction/remoteconsole", nameStartC, nameStartC, UIManagerItemType.Menuitem, false);


            /*string nameRestarC = "RestartConsole";
             * string labelRestartC = String.Format("Restart Remote Console");
             * Gtk.Action actionRestartC = new Gtk.Action(nameRestarC, labelRestartC);
             * actionRestartC.Activated += delegate(object sender, EventArgs e) {
             *      MainClass.MainWindow.StopSocetServer();
             *      MainClass.MainWindow.StartSocetServer(MainClass.Settings.RemoteIpAdress);
             * };
             * dynGroupSocket.Add(actionRestartC);
             * ui.AddUi(mergeIdSocket, "/menubar/ToolsAction/remoteconsole", nameRestarC, nameRestarC, UIManagerItemType.Menuitem, false);
             */
            ui.AddUi(mergeIdSocket, "/menubar/ToolsAction/remoteconsole", null, null, UIManagerItemType.Separator, false);
            List <string> listIp = Moscrif.IDE.Tool.Network.GetIpAdress();

            int i      = 0;
            int indxIP = 0;

            List <RadioActionEntry> listIP = new List <RadioActionEntry>();

            foreach (string ip in listIp)
            {
                string           name  = "ipAdress" + ip;
                string           label = String.Format("{0}", ip);
                RadioActionEntry rae   = new RadioActionEntry(name, null, label, null, null, i);
                listIP.Add(rae);
                ui.AddUi(mergeIdSocket, "/menubar/ToolsAction/remoteconsole", name, name, UIManagerItemType.Menuitem, false);

                if (MainClass.Settings.RemoteIpAdress == ip)
                {
                    indxIP = i;
                }
                i++;
            }

            RadioActionEntry[] ipEntries = listIP.ToArray();
            dynGroupSocket.Add(ipEntries, indxIP, new ChangedHandler(RadioActionActivated));

            MainClass.Settings.RemoteIpAdress = listIP[indxIP].label;
        }
Пример #6
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();
        }