protected override void OnPressed() { //base.OnPressed (); Gtk.Menu menu = new Gtk.Menu(); if (menu.Children.Length > 0) { Gtk.SeparatorMenuItem sep = new Gtk.SeparatorMenuItem(); sep.Show(); menu.Insert(sep, -1); } Gtk.RadioMenuItem grp = new Gtk.RadioMenuItem(""); foreach (ComboItem ci in items) { Gtk.RadioMenuItem mi = new Gtk.RadioMenuItem(grp, ci.Label.Replace("_", "__")); if (ci.Item == items.CurrentItem || ci.Item.Equals(items.CurrentItem)) { mi.Active = true; } ComboItemSet isetLocal = items; ComboItem ciLocal = ci; mi.Activated += delegate { SelectItem(isetLocal, ciLocal); }; mi.ShowAll(); menu.Insert(mi, -1); } menu.Popup(null, null, PositionFunc, 0, Gtk.Global.CurrentEventTime); }
protected override void OnPressed() { //base.OnPressed (); Gtk.Menu menu = new Gtk.Menu (); if (menu.Children.Length > 0) { Gtk.SeparatorMenuItem sep = new Gtk.SeparatorMenuItem (); sep.Show (); menu.Insert (sep, -1); } Gtk.RadioMenuItem grp = new Gtk.RadioMenuItem (""); foreach (ComboItem ci in items) { Gtk.RadioMenuItem mi = new Gtk.RadioMenuItem (grp, ci.Label.Replace ("_","__")); if (ci.Item == items.CurrentItem || ci.Item.Equals (items.CurrentItem)) mi.Active = true; ComboItemSet isetLocal = items; ComboItem ciLocal = ci; mi.Activated += delegate { SelectItem (isetLocal, ciLocal); }; mi.ShowAll (); menu.Insert (mi, -1); } menu.Popup (null, null, PositionFunc, 0, Gtk.Global.CurrentEventTime); }
public RadioMenuItem(RadioMenuItem[] group, string label) : base(IntPtr.Zero) { if (GetType () != typeof (RadioMenuItem)) { CreateNativeObject (new string [0], new GLib.Value [0]); AccelLabel al = new AccelLabel (""); al.TextWithMnemonic = label; al.SetAlignment (0.0f, 0.5f); Add (al); al.AccelWidget = this; Group = group; return; } IntPtr native_label = GLib.Marshaller.StringToPtrGStrdup (label); IntPtr native_group = IntPtr.Zero; if (group != null) { GLib.List list = new GLib.List(IntPtr.Zero); foreach (RadioMenuItem item in group) { list.Append (item.Handle); } native_group = list.Handle; } Raw = gtk_radio_menu_item_new_with_mnemonic(native_group, native_label); GLib.Marshaller.Free (native_label); }
// create the context menu public VideoContextMenu() : base() { MenuItem aspect_ratio = new MenuItem ("Aspect Ratio"); ImageMenuItem fullscreen = new ImageMenuItem (Stock.Fullscreen, null); Menu aspect_menu = new Menu (); aspect_auto = new RadioMenuItem ("Auto"); aspect_4x3 = new RadioMenuItem (aspect_auto, "4:3"); aspect_16x9 = new RadioMenuItem (aspect_auto, "16:9"); aspect_16x10 = new RadioMenuItem (aspect_auto, "16:10"); aspect_menu.Add (aspect_auto); aspect_menu.Add (aspect_4x3); aspect_menu.Add (aspect_16x9); aspect_menu.Add (aspect_16x10); aspect_ratio.Submenu = aspect_menu; this.Add (aspect_ratio); showVisualisations (); this.Add (new SeparatorMenuItem ()); this.Add (fullscreen); fullscreen.Activated += fullscreen_activated; aspect_auto.ButtonReleaseEvent += aspect_auto_toggled; aspect_4x3.ButtonReleaseEvent += aspect_4x3_toggled; aspect_16x9.ButtonReleaseEvent += aspect_16x9_toggled; aspect_16x10.ButtonReleaseEvent += aspect_16x10_toggled; toggle_aspect_value (); }
public static void Main(string[] args) { Application.Init (); //MainWindow win = new MainWindow (); //win.Show (); MoonlightRuntime.Init (); Window w = new Window ("mldsp"); w.DefaultHeight = 520; w.DefaultWidth = 760; w.DeleteEvent += delegate { Application.Quit (); }; var moon = new MoonlightHost (); var xappath = System.IO.Path.Combine (System.IO.Path.GetDirectoryName (new Uri (typeof (MainClass).Assembly.CodeBase).LocalPath), "mldsp.clr.xap"); moon.LoadXap (xappath); if (args.Length > 0) { int device; if (int.TryParse (args [0], out device)) ((mldsp.App) moon.Application).OutputDeviceID = device; else { Console.WriteLine ("WARNING: wrong device ID speficication. Specify an index."); foreach (var dev in PortMidiSharp.MidiDeviceManager.AllDevices) if (dev.IsOutput) Console.WriteLine ("{0} {1}", dev.ID, dev.Name); } } var vbox = new VBox (false, 0); w.Add (vbox); var mainmenu = new MenuBar (); vbox.PackStart (mainmenu, false, true, 0); var optmi = new MenuItem ("_Options"); mainmenu.Add (optmi); var devmi = new MenuItem ("Select Device"); var optmenu = new Menu (); optmi.Submenu = optmenu; optmenu.Append (devmi); var devlist = new SList (IntPtr.Zero); var devmenu = new Menu (); devmi.Submenu = devmenu; foreach (var dev in PortMidiSharp.MidiDeviceManager.AllDevices) { if (dev.IsOutput) { var mi = new RadioMenuItem (devlist, dev.Name); mi.Data ["Device"] = dev.ID; devlist = mi.Group; int id = dev.ID; mi.Activated += delegate { ((mldsp.App) moon.Application).ResetDevice ((int) mi.Data ["Device"]); }; devmenu.Append (mi); } } vbox.PackEnd (moon); w.ShowAll (); Application.Run (); }
static void GroupChanged_cb(IntPtr inst) { try { RadioMenuItem __obj = GLib.Object.GetObject(inst, false) as RadioMenuItem; __obj.OnGroupChanged(); } catch (Exception e) { GLib.ExceptionManager.RaiseUnhandledException(e, false); } }
private Menu createMenu() { var menu = new Menu(); var mi = new Gtk.RadioMenuItem("Alphabetically"); var g = mi.Group; mi.Active = groupMethod == InstrumentGroupMethod.Alphabetically; mi.Activated += (sender, e) => { groupMethod = InstrumentGroupMethod.Alphabetically; }; menu.Insert(mi, -1); mi = new Gtk.RadioMenuItem(g, "By Currency"); mi.Active = groupMethod == InstrumentGroupMethod.ByCurrency; mi.Activated += (sender, e) => { groupMethod = InstrumentGroupMethod.ByCurrency; }; menu.Insert(mi, -1); mi = new Gtk.RadioMenuItem(g, "By Exchange"); mi.Active = groupMethod == InstrumentGroupMethod.ByExchange; mi.Activated += (sender, e) => { groupMethod = InstrumentGroupMethod.ByExchange; }; menu.Insert(mi, -1); mi = new Gtk.RadioMenuItem(g, "By Instrument Type"); mi.Active = groupMethod == InstrumentGroupMethod.ByInstrumentType; mi.Activated += (sender, e) => { groupMethod = InstrumentGroupMethod.ByInstrumentType; }; menu.Insert(mi, -1); mi = new Gtk.RadioMenuItem(g, "By Maturity"); mi.Active = groupMethod == InstrumentGroupMethod.ByMaturity; mi.Activated += (sender, e) => { groupMethod = InstrumentGroupMethod.ByMaturity; }; menu.Insert(mi, -1); mi = new Gtk.RadioMenuItem(g, "No Group"); mi.Active = groupMethod == InstrumentGroupMethod.NoGroup; mi.Activated += (sender, e) => { groupMethod = InstrumentGroupMethod.NoGroup; }; menu.Insert(mi, -1); menu.ShowAll(); return(menu); }
private void AddMenuItem(Menu miParent, string condition) { Gtk.RadioMenuItem mi = new Gtk.RadioMenuItem(g.Group, condition); //mi.Group = rbGroup; if (condition == labelText) { mi.Active = true; } else { mi.Active = false; } mi.Name = condition; mi.Activated += delegate(object sender, EventArgs e) { if (sender.GetType() == typeof(Gtk.RadioMenuItem)) { entryTxt.Text = (sender as Gtk.MenuItem).Name; } }; miParent.Add(mi); }
public DisplayWindow() : base(WindowType.Toplevel) { MenuBar mb = new MenuBar(); MenuItem mi_file = new MenuItem("File"); Menu m_file = new Menu(); MenuItem mi_file_opendll = new MenuItem("Connect with algorithm library..."); mi_file_opendll.Activated += openLibFile; MenuItem mi_file_openxml = new MenuItem("Open configuration file..."); mi_file_openxml.Activated += openConfigFile; MenuItem mi_file_quit = new MenuItem("Quit"); mi_file_quit.Activated += delegate { Application.Quit(); }; MenuItem mi_edit = new MenuItem("Edit"); Menu m_edit = new Menu(); RadioMenuItem mi_edit_move = new RadioMenuItem("Move nodes"); RadioMenuItem mi_edit_insp = new RadioMenuItem(mi_edit_move, "Inspect node"); MenuItem mi_edit_play = new ImageMenuItem(Stock.MediaPlay, null); MenuItem mi_edit_pause = new ImageMenuItem(Stock.MediaPause, null); mb.Add(mi_file); mi_file.Submenu = m_file; m_file.Add(mi_file_opendll); m_file.Add(mi_file_openxml); m_file.Add(new SeparatorMenuItem()); m_file.Add(mi_file_quit); mi_edit.Submenu = m_edit; m_edit.Add(mi_edit_move); m_edit.Add(mi_edit_insp); m_edit.Add(new SeparatorMenuItem()); m_edit.Add(mi_edit_play); m_edit.Add(mi_edit_pause); mb.Add(mi_edit); Toolbar tb = new Toolbar(); StockItem si; StockManager.Lookup(Stock.MediaPlay, ref si); ToolButton tb_opendll = new ToolButton(Stock.Connect); tb_opendll.Clicked += openLibFile; ToolButton tb_openxml = new ToolButton(Stock.Open); tb_openxml.Clicked += openConfigFile; ToolButton tb_move = new ToggleToolButton(Stock.Preferences); ToolButton tb_insp = new ToggleToolButton(Stock.ZoomIn); ToolButton tb_play = new ToolButton(Stock.MediaPlay); ToolButton tb_pause = new ToolButton(Stock.MediaPause); tb.Add(tb_opendll); tb.Add(tb_openxml); tb.Add(new SeparatorToolItem()); tb.Add(tb_move); tb.Add(tb_insp); tb.Add(new SeparatorToolItem()); tb.Add(tb_play); tb.Add(tb_pause); this.bpsp = new BlueprintParallelStatePainter(); this.bm = new BlueprintMediabar(); this.bm.CurrentChanged += HandleBmhandleCurrentChanged; this.bm.CurrentChanged += this.bpsp.RepaintEdges; this.bs = new BlueprintTabControl(1, 1, 1); this.bs.CurrentChanged += HandleBshandleCurrentChanged; ; vb.PackStart(mb, false, false, 0x00); vb.PackStart(tb, false, false, 0x00); vb.PackStart(this.bpsp, true, true, 0x00); vb.PackStart(this.bm, false, false, 0x00); vb.PackStart(this.bs, false, false, 0x00); this.Title = "Parallel Visualizer"; this.Resize(640, 480); this.Add(vb); this.ShowAll(); }
private void AddMenuItem(Menu miParent, string condition) { Gtk.RadioMenuItem mi =new Gtk.RadioMenuItem(g.Group,condition); //mi.Group = rbGroup; if(condition == labelText){ mi.Active = true; }else mi.Active = false; mi.Name = condition; mi.Activated += delegate(object sender, EventArgs e) { if (sender.GetType() == typeof(Gtk.RadioMenuItem)){ entryTxt.Text = (sender as Gtk.MenuItem).Name; } }; miParent.Add(mi); }
/// <summary> /// Update Gtk objects properties /// </summary> private void UpdateGraphicObjects() { // Set dialog icon MainWindow.Icon = Gdk.Pixbuf.LoadFromResource("monosim.png"); // Set tool tip text for toolbutton TbNew.TooltipText = GlobalObjUI.LMan.GetString("newfileact"); TbOpen.TooltipText = GlobalObjUI.LMan.GetString("openfileact"); TbSaveFile.TooltipText = GlobalObjUI.LMan.GetString("savefileact"); TbClose.TooltipText = GlobalObjUI.LMan.GetString("closefileact"); TbSaveSim.TooltipText = GlobalObjUI.LMan.GetString("savefilesimact"); TbSaveSim.IconWidget = new Gtk.Image(Pixbuf.LoadFromResource("chip_24.png")); TbSaveSim.ShowAll(); TbSettings.TooltipText = GlobalObjUI.LMan.GetString("settingsact"); TbOpenSim.TooltipText = GlobalObjUI.LMan.GetString("opensimact"); TbChangePin.TooltipText = GlobalObjUI.LMan.GetString("pinsimact"); TbSaveSimFile.TooltipText = GlobalObjUI.LMan.GetString("savesimfileact"); TbCloseSim.TooltipText = GlobalObjUI.LMan.GetString("closesimact"); TbSaveSimSim.TooltipText = GlobalObjUI.LMan.GetString("savesimact"); TbSaveSimSim.IconWidget = new Gtk.Image(Pixbuf.LoadFromResource("chip_24.png")); TbSaveSimSim.ShowAll(); TbAbout.TooltipText = GlobalObjUI.LMan.GetString("infoact"); TbExit.TooltipText = GlobalObjUI.LMan.GetString("exitact"); // change icons for chip MenuFileSaveSim.Image = new Gtk.Image(Pixbuf.LoadFromResource("chip_16.png")); MenuSimSaveSim.Image = new Gtk.Image(Pixbuf.LoadFromResource("chip_16.png")); // Set labels ((Label)MenuFileItem.Child).TextWithMnemonic = GlobalObjUI.LMan.GetString("filemenulbl"); ((Label)MenuFileNew.Child).TextWithMnemonic = GlobalObjUI.LMan.GetString("newfileact"); ((Label)MenuFileOpen.Child).TextWithMnemonic = GlobalObjUI.LMan.GetString("openfileact"); ((Label)MenuFileSaveFile.Child).TextWithMnemonic = GlobalObjUI.LMan.GetString("savefileact"); ((Label)MenuFileSaveSim.Child).TextWithMnemonic = GlobalObjUI.LMan.GetString("savefilesimact"); ((Label)MenuFileClose.Child).TextWithMnemonic = GlobalObjUI.LMan.GetString("closefileact"); ((Label)MenuFileSettings.Child).TextWithMnemonic = GlobalObjUI.LMan.GetString("settingsact"); ((Label)MenuFileExit.Child).TextWithMnemonic = GlobalObjUI.LMan.GetString("exitact"); ((Label)MenuReaderItem.Child).TextWithMnemonic = GlobalObjUI.LMan.GetString("readermenulbl"); ((Label)MenuSimItem.Child).TextWithMnemonic = GlobalObjUI.LMan.GetString("simmenulbl"); ((Label)MenuSimConnect.Child).TextWithMnemonic = GlobalObjUI.LMan.GetString("opensimact"); ((Label)MenuSimPin.Child).TextWithMnemonic = GlobalObjUI.LMan.GetString("pinsimact"); ((Label)MenuSimSaveFile.Child).TextWithMnemonic = GlobalObjUI.LMan.GetString("savesimfileact"); ((Label)MenuSimSaveSim.Child).TextWithMnemonic = GlobalObjUI.LMan.GetString("savesimact"); ((Label)MenuSimDeleteAll.Child).TextWithMnemonic = GlobalObjUI.LMan.GetString("deletesimact"); ((Label)MenuSimDisconnect.Child).TextWithMnemonic = GlobalObjUI.LMan.GetString("closesimact"); ((Label)MenuAboutItem.Child).TextWithMnemonic = GlobalObjUI.LMan.GetString("helpmenulbl"); ((Label)MenuAboutInfo.Child).TextWithMnemonic = GlobalObjUI.LMan.GetString("infoact"); LblFile.Markup = "<b>" + GlobalObjUI.LMan.GetString("framefile") + "</b>"; LblSim.Markup = "<b>" + GlobalObjUI.LMan.GetString("framesim") + "</b>"; // Set Popup menu ((Label)PopMenuFileAdd.Child).TextWithMnemonic = GlobalObjUI.LMan.GetString("addcontacts"); ((Label)PopMenuFileDel.Child).TextWithMnemonic = GlobalObjUI.LMan.GetString("delcontacts"); ((Label)PopMenuFileVSim.Child).TextWithMnemonic = GlobalObjUI.LMan.GetString("copycontactstosim"); ((Label)PopMenuSimAdd.Child).TextWithMnemonic = GlobalObjUI.LMan.GetString("addcontacts"); ((Label)PopMenuSimDel.Child).TextWithMnemonic = GlobalObjUI.LMan.GetString("delcontacts"); ((Label)PopMenuSimVFile.Child).TextWithMnemonic = GlobalObjUI.LMan.GetString("copycontactstofile"); // Set ListView string[] columnHeaders = new string[] { GlobalObjUI.LMan.GetString("descnumber"), GlobalObjUI.LMan.GetString("phonenumber") }; InitListView(ref lstFileContacts, ref LstFileContacts, columnHeaders); InitListView(ref lstSimContacts, ref LstSimContacts, columnHeaders); // update gui menu Gtk.RadioMenuItem rmi; // loop for all readers List <string> allReaders = new List <string>(); // loop for each managed readers type foreach (IReader rdr in GlobalObj.ReaderManager.Values) { allReaders.AddRange(rdr.Readers); } for (int n = 0; n < allReaders.Count; n++) { // set first as selected if (n == 0) { rmi = new Gtk.RadioMenuItem(allReaders[n]); GlobalObj.SelectedReader = allReaders[n]; StatusBar.Push(1, GlobalObj.LMan.GetString("selreader") + ": " + allReaders[n]); } else { // added others rmi = new Gtk.RadioMenuItem((RadioMenuItem)MenuReader.Children[0], allReaders[n]); } rmi.ButtonReleaseEvent += ActionChangeReader; MenuReader.Add(rmi); } MenuReader.ShowAll(); }
private static void CreateEntriesFromFactory (MenuItem menu, TreeStore store, EventHandler handler, TypeFactory factory, IList menuEntries) { GLib.SList group = new GLib.SList (IntPtr.Zero); Menu submenu = new Menu (); foreach (DictionaryEntry de in factory) { TypeFactoryEntry entry = (TypeFactoryEntry) de.Value; if (store != null) store.AppendValues (false, entry.Description, entry.Key); RadioMenuItem item = new RadioMenuItem (group, entry.Description); item.Activated += handler; group = item.Group; submenu.Append (item); menuEntries.Add (new RadioMenuItemInfo (item, entry.Key)); } menu.Submenu = submenu; menu.ShowAll (); }
public RadioMenuItemInfo (RadioMenuItem item, string key) { menuItem = item; this.key = key; }
// options menu for filterSearchEntry public Menu CreateOptionsMenu() { Menu menu = new Menu (); MenuItem searchInMenu = new MenuItem (GettextCatalog.GetString ("_Search in")); Menu sub = new Menu (); searchInMenu.Submenu = sub; Gtk.RadioMenuItem name = null, baseValue = null, value =null, comment = null, all = null; GLib.SList group = new GLib.SList (IntPtr.Zero); name = new Gtk.RadioMenuItem (group, GettextCatalog.GetString ("_Name")); group = name.Group; name.ButtonPressEvent += delegate { name.Activate (); }; sub.Append (name); baseValue = new Gtk.RadioMenuItem (group, GettextCatalog.GetString ("_Base Value")); baseValue.ButtonPressEvent += delegate { baseValue.Activate (); }; group = baseValue.Group; sub.Append (baseValue); value = new Gtk.RadioMenuItem (group, GettextCatalog.GetString ("_Value")); value.ButtonPressEvent += delegate { value.Activate (); }; group = value.Group; sub.Append (value); comment = new Gtk.RadioMenuItem (group, GettextCatalog.GetString ("_Comment")); comment.ButtonPressEvent += delegate { comment.Activate (); }; group = comment.Group; sub.Append (comment); all = new Gtk.RadioMenuItem (group, GettextCatalog.GetString ("_All")); all.ButtonPressEvent += delegate { all.Activate (); }; sub.Append (all); switch (DoSearchIn) { case SearchIn.All: all.Activate (); break; case SearchIn.BaseValue: baseValue.Activate (); break; case SearchIn.Value: value.Activate (); break; case SearchIn.Name: name.Activate (); break; case SearchIn.Comment: comment.Activate (); break; } menu.Append (searchInMenu); all.Activated += delegate { if (DoSearchIn != SearchIn.All) { DoSearchIn = SearchIn.All; Refresh (); menu.Destroy (); } }; baseValue.Activated += delegate { if (DoSearchIn != SearchIn.BaseValue) { DoSearchIn = SearchIn.BaseValue; Refresh (); menu.Destroy (); } }; value.Activated += delegate { if (DoSearchIn != SearchIn.Value) { DoSearchIn = SearchIn.Value; Refresh (); menu.Destroy (); } }; name.Activated += delegate { if (DoSearchIn != SearchIn.Name) { DoSearchIn = SearchIn.Name; Refresh (); menu.Destroy (); } }; comment.Activated += delegate { if (DoSearchIn != SearchIn.Comment) { DoSearchIn = SearchIn.Comment; Refresh (); menu.Destroy (); } }; Gtk.CheckMenuItem regexSearch = new Gtk.CheckMenuItem (MonoDevelop.Core.GettextCatalog.GetString ("_Regex search")); regexSearch.Active = RegexSearch; regexSearch.ButtonPressEvent += delegate { RegexSearch = !RegexSearch; Refresh (); }; menu.Append (regexSearch); Gtk.CheckMenuItem caseSensitive = new Gtk.CheckMenuItem (MonoDevelop.Core.GettextCatalog.GetString ("_Case sensitive")); caseSensitive.Active = IsCaseSensitive; caseSensitive.ButtonPressEvent += delegate { IsCaseSensitive = !IsCaseSensitive; Refresh (); }; menu.Append (caseSensitive); Gtk.CheckMenuItem wholeWordsOnly = new Gtk.CheckMenuItem (MonoDevelop.Core.GettextCatalog.GetString ("_Whole words only")); wholeWordsOnly.Active = IsWholeWordOnly; wholeWordsOnly.Sensitive = !RegexSearch; wholeWordsOnly.ButtonPressEvent += delegate { IsWholeWordOnly = !IsWholeWordOnly; Refresh (); }; menu.Append (wholeWordsOnly); menu.ShowAll (); return menu; }
private Menu CreateMenu (int depth, bool tearoff) { if (depth < 1) return null; Menu menu = new Menu (); RadioMenuItem[] group = null; if (tearoff) { TearoffMenuItem menuitem = new TearoffMenuItem (); menu.Append (menuitem); } for (int i = 0, j = 1; i < 5; i++, j++) { RadioMenuItem menuitem = new RadioMenuItem (group, String.Format ("item {0} - {1}", depth, j)); group = menuitem.Group; menu.Append (menuitem); if (i == 3) menuitem.Sensitive = false; menuitem.Submenu = CreateMenu ((depth - 1), true); } return menu; }
void OnPopulatePopup(object o, PopulatePopupArgs args) { Gtk.MenuItem spacer = new Gtk.SeparatorMenuItem (); spacer.Show (); Gtk.CheckMenuItem edit = new Gtk.CheckMenuItem ( Catalog.GetString ("Edit Code Snippet")); MarkupLabel (edit); edit.Activated += OnEditActivate; edit.Show (); Gtk.ImageMenuItem lang_select = new Gtk.ImageMenuItem ( Catalog.GetString ("Select Language")); lang_select.Image = new Gtk.Image (Gtk.Stock.Find, Gtk.IconSize.Menu); lang_select .Show (); Gtk.Menu langs_menu = new Gtk.Menu (); //default language should be setted Gtk.RadioMenuItem pre_item = new Gtk.RadioMenuItem (Language); MarkupLabel (pre_item); pre_item.Active = true; langs_menu.Append (pre_item); pre_item.Activated += OnLanguageSelected; pre_item.Show (); string [] langs = manager.LanguageIds; ArrayList lang_array = new ArrayList (langs); lang_array.Sort (); foreach (String lang in lang_array) { if (lang.Equals (Language)) continue; Gtk.RadioMenuItem tmp = new Gtk.RadioMenuItem ( pre_item.Group, Catalog.GetString (lang)); MarkupLabel (tmp); langs_menu.Append (tmp); tmp.Activated += OnLanguageSelected; tmp.Show (); pre_item = tmp; } lang_select.Submenu = langs_menu; args.Menu.Prepend (spacer); args.Menu.Prepend (edit); args.Menu.Prepend (lang_select); }
public void OnUserTreeViewButtonPressed(object obj, ButtonPressEventArgs args) { switch(args.Event.Button) { case 1: break; case 2: break; case 3: { TreePath tPath = null; TreeViewColumn tColumn = null; if(UserTreeView.GetPathAtPos( (int)args.Event.X, (int)args.Event.Y, out tPath, out tColumn) == true) { TreeSelection tSelect = UserTreeView.Selection; if( (ifolder.CurrentUserRights == "Admin") && (tSelect.CountSelectedRows() > 0) ) { Menu rightsMenu = new Menu(); RadioMenuItem adminItem = new RadioMenuItem (Util.GS("Full Control")); rightsMenu.Append(adminItem); RadioMenuItem rwItem = new RadioMenuItem (adminItem.Group, Util.GS("Read/Write")); rightsMenu.Append(rwItem); RadioMenuItem roItem = new RadioMenuItem (adminItem.Group, Util.GS("Read Only")); rightsMenu.Append(roItem); if(SelectionHasOwnerOrCurrent()) { adminItem.Sensitive = false; rwItem.Sensitive = false; roItem.Sensitive = false; } TreeIter iter; if(UserTreeStore.GetIter(out iter, tPath)) { iFolderUser user = (iFolderUser) UserTreeStore.GetValue(iter, 0); if(user.Rights == "ReadWrite") rwItem.Active = true; else if(user.Rights == "Admin") adminItem.Active = true; else roItem.Active = true; } adminItem.Activated += new EventHandler( OnAdminRightsMenu); rwItem.Activated += new EventHandler( OnRWRightsMenu); roItem.Activated += new EventHandler( OnRORightsMenu); rightsMenu.ShowAll(); rightsMenu.Popup(null, null, null, IntPtr.Zero, 3, Gtk.Global.CurrentEventTime); } } break; } } }
void FillEncodings () { selectOption = -1; RadioMenuItem defaultActivated = null; Gtk.Menu menu = new Menu (); // Don't show the auto-detection option when saving if (Action != Gtk.FileChooserAction.Save) { RadioMenuItem autodetect = new RadioMenuItem (GettextCatalog.GetString ("Auto Detected")); autodetect.Group = new GLib.SList (typeof(object)); menu.Append (autodetect); menu.Append (new Gtk.SeparatorMenuItem ()); autodetect.Active = true; defaultActivated = autodetect; firstEncIndex = 2; } else firstEncIndex = 0; foreach (var codePage in SeletedEncodings.ConversionEncodings) { var enc = Encoding.GetEncoding (codePage); RadioMenuItem mitem = new RadioMenuItem (enc.EncodingName + " (" + enc.WebName + ")"); menu.Append (mitem); if (defaultActivated == null) { defaultActivated = mitem; defaultActivated.Group = new GLib.SList (typeof(object)); } else { mitem.Group = defaultActivated.Group; } mitem.Active = false; } if (defaultActivated != null) defaultActivated.Active = true; menu.Append (new Gtk.SeparatorMenuItem ()); MenuItem select = new MenuItem (GettextCatalog.GetString ("Add or _Remove...")); menu.Append (select); menu.ShowAll (); encodingMenu.Menu = menu; encodingMenu.SetHistory (0); selectOption = firstEncIndex + SeletedEncodings.ConversionEncodings.Length + 1; }
void FillMenu() { editItem = new MenuItem (Catalog.GetString ("Edit properties")); sortItem = new MenuItem (); sortMenu = new Menu (); sortByName = new RadioMenuItem (Catalog.GetString ("Sort by name")); sortByStart = new RadioMenuItem (Catalog.GetString ("Sort by start time")); sortByStop = new RadioMenuItem (Catalog.GetString ("Sort by stop time")); sortByDuration = new RadioMenuItem (Catalog.GetString ("Sort by duration")); sortByName.Group = new GLib.SList (IntPtr.Zero); sortByStart.Group = sortByName.Group; sortByStop.Group = sortByName.Group; sortByDuration.Group = sortByName.Group; addToPlaylistMenuItem = new MenuItem (); exportToVideoFileItem = new MenuItem (); Add (editItem); Add (sortMenu); sortItem.Submenu = sortMenu; sortMenu.Add (sortByName); sortMenu.Add (sortByStart); sortMenu.Add (sortByStop); sortMenu.Add (sortByDuration); Add (addToPlaylistMenuItem); Add (exportToVideoFileItem); sortByName.Activated += OnSortActivated; sortByStart.Activated += OnSortActivated; sortByStop.Activated += OnSortActivated; sortByDuration.Activated += OnSortActivated; editItem.Activated += (s, e) => EditProperties (eventType); exportToVideoFileItem.Activated += HandleExportEvents; ShowAll (); }
// FIXME: Tags applied to a word should hold over the space // between the next word, as thats where you'll start typeing. // Tags are only active -after- a character with that tag. This // is different from the way gtk-textbuffer applies tags. // // Text menu // // Menu for font style and size, and set the active radio // menuitem depending on the cursor poition. // public NoteTextMenu (Gtk.AccelGroup accel_group, NoteBuffer buffer, UndoManager undo_manager) : base () { this.buffer = buffer; this.undo_manager = undo_manager; if (undo_manager != null) { undo = new Gtk.ImageMenuItem (Gtk.Stock.Undo, accel_group); undo.Activated += UndoClicked; undo.AddAccelerator ("activate", accel_group, (uint) Gdk.Key.z, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); undo.Show (); Append (undo); redo = new Gtk.ImageMenuItem (Gtk.Stock.Redo, accel_group); redo.Activated += RedoClicked; redo.AddAccelerator ("activate", accel_group, (uint) Gdk.Key.z, (Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask), Gtk.AccelFlags.Visible); redo.Show (); Append (redo); Gtk.SeparatorMenuItem undo_spacer = new Gtk.SeparatorMenuItem (); Append (undo_spacer); // Listen to events so we can sensitize and // enable keybinding undo_manager.UndoChanged += UndoChanged; } bold = new Gtk.CheckMenuItem ("<b>" + Catalog.GetString ("_Bold") + "</b>"); MarkupLabel (bold); bold.Data ["Tag"] = "bold"; bold.Activated += FontStyleClicked; bold.AddAccelerator ("activate", accel_group, (uint) Gdk.Key.b, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); italic = new Gtk.CheckMenuItem ("<i>" + Catalog.GetString ("_Italic") + "</i>"); MarkupLabel (italic); italic.Data ["Tag"] = "italic"; italic.Activated += FontStyleClicked; italic.AddAccelerator ("activate", accel_group, (uint) Gdk.Key.i, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); strikeout = new Gtk.CheckMenuItem ("<s>" + Catalog.GetString ("_Strikeout") + "</s>"); MarkupLabel (strikeout); strikeout.Data ["Tag"] = "strikethrough"; strikeout.Activated += FontStyleClicked; strikeout.AddAccelerator ("activate", accel_group, (uint) Gdk.Key.s, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); highlight = new Gtk.CheckMenuItem ("<span background='yellow'>" + Catalog.GetString ("_Highlight") + "</span>"); MarkupLabel (highlight); highlight.Data ["Tag"] = "highlight"; highlight.Activated += FontStyleClicked; highlight.AddAccelerator ("activate", accel_group, (uint) Gdk.Key.h, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); Gtk.SeparatorMenuItem spacer1 = new Gtk.SeparatorMenuItem (); Gtk.MenuItem font_size = new Gtk.MenuItem (Catalog.GetString ("Font Size")); font_size.Sensitive = false; normal = new Gtk.RadioMenuItem (Catalog.GetString ("_Normal")); MarkupLabel (normal); normal.Active = true; normal.AddAccelerator ("activate", accel_group, (uint) Gdk.Key.Key_0, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); normal.AddAccelerator ("activate", accel_group, (uint) Gdk.Key.KP_0, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); normal.Activated += FontSizeActivated; huge = new Gtk.RadioMenuItem (normal.Group, "<span size=\"x-large\">" + Catalog.GetString ("Hu_ge") + "</span>"); MarkupLabel (huge); huge.Data ["Tag"] = "size:huge"; huge.Activated += FontSizeActivated; large = new Gtk.RadioMenuItem (huge.Group, "<span size=\"large\">" + Catalog.GetString ("_Large") + "</span>"); MarkupLabel (large); large.Data ["Tag"] = "size:large"; large.Activated += FontSizeActivated; small = new Gtk.RadioMenuItem (large.Group, "<span size=\"small\">" + Catalog.GetString ("S_mall") + "</span>"); MarkupLabel (small); small.Data ["Tag"] = "size:small"; small.Activated += FontSizeActivated; hidden_no_size = new Gtk.RadioMenuItem (small.Group, string.Empty); hidden_no_size.Hide (); increase_font = new Gtk.MenuItem (Catalog.GetString ("Increase Font Size")); increase_font.AddAccelerator ("activate", accel_group, (uint) Gdk.Key.plus, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); increase_font.AddAccelerator ("activate", accel_group, (uint) Gdk.Key.KP_Add, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); increase_font.AddAccelerator ("activate", accel_group, (uint) Gdk.Key.equal, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); increase_font.Activated += IncreaseFontClicked; decrease_font = new Gtk.MenuItem (Catalog.GetString ("Decrease Font Size")); decrease_font.AddAccelerator ("activate", accel_group, (uint) Gdk.Key.minus, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); decrease_font.AddAccelerator ("activate", accel_group, (uint) Gdk.Key.KP_Subtract, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); decrease_font.AddAccelerator ("activate", accel_group, (uint) Gdk.Key.underscore, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); decrease_font.Activated += DecreaseFontClicked; Gtk.SeparatorMenuItem spacer2 = new Gtk.SeparatorMenuItem (); bullets = new Gtk.CheckMenuItem (Catalog.GetString ("Bullets")); bullets.Activated += ToggleBulletsClicked; increase_indent = new Gtk.ImageMenuItem (Gtk.Stock.Indent, accel_group); increase_indent.AddAccelerator ("activate", accel_group, (uint) Gdk.Key.Right, Gdk.ModifierType.Mod1Mask, Gtk.AccelFlags.Visible); increase_indent.Activated += IncreaseIndentClicked; increase_indent.Show (); decrease_indent = new Gtk.ImageMenuItem (Gtk.Stock.Unindent, accel_group); decrease_indent.AddAccelerator ("activate", accel_group, (uint) Gdk.Key.Left, Gdk.ModifierType.Mod1Mask, Gtk.AccelFlags.Visible); decrease_indent.Activated += DecreaseIndentClicked; decrease_indent.Show (); RefreshState (); Append (bold); Append (italic); Append (strikeout); Append (highlight); Append (spacer1); Append (font_size); Append (small); Append (normal); Append (large); Append (huge); Append (increase_font); Append (decrease_font); Append (spacer2); Append (bullets); Append (increase_indent); Append (decrease_indent); ShowAll (); theme_hack_menu = new Menu (); theme_hack_menu.Realize (); theme_hack_menu.StyleSet += delegate { ModifyBg (StateType.Normal, theme_hack_menu.Style.Background (StateType.Normal)); }; }
private void ViewRadioMenuItemChanged(RadioMenuItem radio) { GLib.SList list = radio.Group; foreach (RadioMenuItem item in list) { if (item.Active) { if (activeView != (View)item.Data["view"]) { SetView ((View)item.Data["view"]); } break; } } }
private void showVisualisations() { MenuItem visuals = new MenuItem ("Visualisations"); Menu vis_menu = new Menu (); visuals.Submenu = vis_menu; RadioMenuItem no_vis = new RadioMenuItem ("No Visualisation"); if (Global.Core.Theatre.Visualisation == null) no_vis.Active = true; else no_vis.Active = false; no_vis.ButtonReleaseEvent += delegate (object o, ButtonReleaseEventArgs args) { Global.Core.Theatre.Visualisation = ""; }; vis_menu.Add (no_vis); vis_menu.Add (new SeparatorMenuItem ()); string[] list = Global.Core.Fuse.MediaControls.MediaEngine.VisualisationList; foreach (string vis in list) { RadioMenuItem vis_item = new RadioMenuItem (no_vis, vis); vis_menu.Add (vis_item); string vis_clone = vis; vis_item.ButtonReleaseEvent += delegate (object o, ButtonReleaseEventArgs args) { Global.Core.Theatre.Visualisation = vis_clone; }; if (vis == Global.Core.Theatre.Visualisation) vis_item.Active = true; else vis_item.Active = false; } this.Add (visuals); }
/// <summary> /// Update Gtk objects properties /// </summary> private void UpdateGraphicObjects() { // Set dialog icon MainWindow.Icon = Gdk.Pixbuf.LoadFromResource("comex_256.png"); // Set tool tip text for toolbutton TbOpen.TooltipText = GlobalObj.LMan.GetString("openact"); TbOpen.Label = GlobalObj.LMan.GetString("openlbl"); TbClose.Label = GlobalObj.LMan.GetString("closelbl"); TbSettings.Label = GlobalObj.LMan.GetString("settingslbl"); TbSettings.TooltipText = GlobalObj.LMan.GetString("settingsmenulbl"); TbAbout.TooltipText = GlobalObj.LMan.GetString("infoact"); TbAbout.Label = GlobalObj.LMan.GetString("infolbl"); TbExit.TooltipText = GlobalObj.LMan.GetString("exitact"); TbExit.Label = GlobalObj.LMan.GetString("exitlbl"); TbATR.TooltipText = GlobalObj.LMan.GetString("atract"); TbATR.Label = GlobalObj.LMan.GetString("atrlbl"); // Set labels ((Label)MenuFileItem.Child).TextWithMnemonic = GlobalObj.LMan.GetString("filemenulbl"); ((Label)MenuFileOpen.Child).TextWithMnemonic = GlobalObj.LMan.GetString("openmenulbl"); ((Label)MenuFileClose.Child).TextWithMnemonic = GlobalObj.LMan.GetString("closemenulbl"); ((Label)MenuFileSettings.Child).TextWithMnemonic = GlobalObj.LMan.GetString("settingsmenulbl"); ((Label)MenuFileExit.Child).TextWithMnemonic = GlobalObj.LMan.GetString("exitmenulbl"); ((Label)MenuReaderItem.Child).TextWithMnemonic = GlobalObj.LMan.GetString("readermenulbl"); ((Label)MenuAboutItem.Child).TextWithMnemonic = GlobalObj.LMan.GetString("helpmenulbl"); ((Label)MenuAboutInfo.Child).TextWithMnemonic = GlobalObj.LMan.GetString("infomenulbl"); LblATR.Markup = "<b>" + GlobalObj.LMan.GetString("atrframelbl") + "</b>"; LblCommand.Text = GlobalObj.LMan.GetString("cmdlbl"); LblResponse.Text = GlobalObj.LMan.GetString("resplbl"); LblSend.Text = GlobalObj.LMan.GetString("sendlbl"); LblExchange.Markup = "<b>" + GlobalObj.LMan.GetString("cardframelbl") + "</b>"; LblFile.Markup = "<b>" + GlobalObj.LMan.GetString("commandfilelbl") + "</b>"; Gdk.Color color = new Gdk.Color(); Gdk.Color.Parse("#0000FF", ref color); TxtATR.ModifyText(StateType.Normal, color); Gdk.Color.Parse("#0000FF", ref color); TxtResp.ModifyText(StateType.Normal, color); Gdk.Color.Parse("#1F6D20", ref color); TxtCmd.ModifyText(StateType.Normal, color); // TreeView (List) LstCommands.Selection.Mode = SelectionMode.Single; CellRendererText rendererText = new CellRendererText(); TreeViewColumn column = new TreeViewColumn(); column.Title = "Commands"; column.Resizable = true; column.PackStart(rendererText, true); column.AddAttribute(rendererText, "text", 0); LstCommands.RulesHint = true; LstCommands.AppendColumn(column); if (GlobalObj.IsWindows()) { LstCommands.ModifyFont(FontDescription.FromString("Courier New Normal 10")); } else { LstCommands.ModifyFont(FontDescription.FromString("Fixed Normal 10")); } // update gui menu Gtk.RadioMenuItem rmi; // loop for all readers List<string> allReaders = new List<string>(); // loop for each managed readers type foreach(IReader rdr in GlobalObj.ReaderManager.Values) { allReaders.AddRange(rdr.Readers); } for (int n=0; n<allReaders.Count; n++) { // set first as selected if (n==0) { rmi = new Gtk.RadioMenuItem(allReaders[n]); GlobalObj.SelectedReader = allReaders[n]; StatusBar.Push(1, GlobalObj.LMan.GetString("selreader") + ": " + allReaders[n]); } else { // added others rmi = new Gtk.RadioMenuItem((RadioMenuItem)MenuReader.Children[0], allReaders[n]); } rmi.ButtonReleaseEvent += ActionChangeReader; MenuReader.Add(rmi); } MenuReader.ShowAll(); }
public override void Initialize(NodeBuilder[] builders, TreePadOption[] options, string contextMenuPath) { base.Initialize(builders, options, contextMenuPath); var topToolbar = Window.GetToolbar(PositionType.Top); // Group button buttonGroup = new MenuButton(); buttonGroup.StockImage = MonoDevelop.Ide.Gui.Stock.GroupByCategory; buttonGroup.ArrowType = ArrowType.Down; buttonGroup.TooltipText = GettextCatalog.GetString("Group instruments"); buttonGroup.MenuCreator = delegate { var menu = new Menu(); var mi = new Gtk.RadioMenuItem("Alphabetically"); var g = mi.Group; mi.Active = groupMethod == InstrumentGroupMethod.Alphabetically; mi.Activated += (sender, e) => { groupMethod = InstrumentGroupMethod.Alphabetically; }; menu.Insert(mi, -1); mi = new Gtk.RadioMenuItem(g, "By Currency"); mi.Active = groupMethod == InstrumentGroupMethod.ByCurrency; mi.Activated += (sender, e) => { groupMethod = InstrumentGroupMethod.ByCurrency; }; menu.Insert(mi, -1); mi = new Gtk.RadioMenuItem(g, "By Exchange"); mi.Active = groupMethod == InstrumentGroupMethod.ByExchange; mi.Activated += (sender, e) => { groupMethod = InstrumentGroupMethod.ByExchange; }; menu.Insert(mi, -1); mi = new Gtk.RadioMenuItem(g, "By Instrument Type"); mi.Active = groupMethod == InstrumentGroupMethod.ByInstrumentType; mi.Activated += (sender, e) => { groupMethod = InstrumentGroupMethod.ByInstrumentType; }; menu.Insert(mi, -1); mi = new Gtk.RadioMenuItem(g, "By Maturity"); mi.Active = groupMethod == InstrumentGroupMethod.ByMaturity; mi.Activated += (sender, e) => { groupMethod = InstrumentGroupMethod.ByMaturity; }; menu.Insert(mi, -1); mi = new Gtk.RadioMenuItem(g, "No Group"); mi.Active = groupMethod == InstrumentGroupMethod.NoGroup; mi.Activated += (sender, e) => { groupMethod = InstrumentGroupMethod.NoGroup; }; menu.Insert(mi, -1); menu.ShowAll(); return(menu); }; topToolbar.Add(buttonGroup); // Refresh button buttonrefresh = new Button(); buttonrefresh.Image = new Gtk.Image(Gtk.Stock.Refresh, IconSize.SmallToolbar); buttonrefresh.TooltipText = GettextCatalog.GetString("Refresh instruments"); topToolbar.Add(buttonrefresh); menuTool = new MenuToolButton(Gtk.Stock.Cdrom); topToolbar.Add(menuTool); topToolbar.ShowAll(); // Tree TreeView.Tree.Selection.Mode = SelectionMode.Single; LoadTree(); Control.ShowAll(); var f = Framework.Current; f.EventManager.Dispatcher.InstrumentAdded += OnInstrumentAdded; f.EventManager.Dispatcher.InstrumentDeleted += OnInstrumentDeleted; foreach (var instrument in Framework.Current.InstrumentManager.Instruments) { instrumentNodes.Add(new InstrumentNode(instrument)); } var byExchange = from instrumentNode in instrumentNodes group instrumentNode by instrumentNode.Instrument.CurrencyId; foreach (var customerGroup in byExchange) { Console.WriteLine(customerGroup.Key); foreach (var customer in customerGroup) { Console.WriteLine(" {0}", customer.Instrument.Symbol); } } var byAlpha = from instrumentNode in instrumentNodes group instrumentNode by instrumentNode.Instrument.Symbol[0]; foreach (var customerGroup in byAlpha) { Console.WriteLine(customerGroup.Key); foreach (var customer in customerGroup) { Console.WriteLine(" {0}", customer.Instrument.Symbol); } } var byCurrency = from instrumentNode in instrumentNodes group instrumentNode by instrumentNode.Instrument.CurrencyId; foreach (var customerGroup in byCurrency) { Console.WriteLine(customerGroup.Key); foreach (var customer in customerGroup) { Console.WriteLine(" {0}", customer.Instrument.Symbol); } } var byType = from instrumentNode in instrumentNodes group instrumentNode by instrumentNode.Instrument.Type; foreach (var customerGroup in byType) { Console.WriteLine(customerGroup.Key); foreach (var customer in customerGroup) { Console.WriteLine(" {0}", customer.Instrument.Symbol); } } var byMaturity = from instrumentNode in instrumentNodes group instrumentNode by instrumentNode.Instrument.Maturity; foreach (var customerGroup in byMaturity) { Console.WriteLine(customerGroup.Key); foreach (var customer in customerGroup) { Console.WriteLine(" {0}", customer.Instrument.Symbol); } } }
private Menu BuildSortMenu (Source source) { Menu menu = new Menu (); GLib.SList group = null; foreach (SourceSortType sort_type in source.ChildSortTypes) { RadioMenuItem item = new RadioMenuItem (group, sort_type.Label); group = item.Group; item.Active = (sort_type == source.ActiveChildSort); item.Toggled += BuildSortChangedHandler (source, sort_type); menu.Append (item); } menu.Append (new SeparatorMenuItem ()); CheckMenuItem sort_types_item = new CheckMenuItem (Catalog.GetString ("Separate by Type")); sort_types_item.Active = source.SeparateChildrenByType; sort_types_item.Toggled += OnSeparateTypesChanged; menu.Append (sort_types_item); return menu; }
/// <summary> /// Update Gtk objects properties /// </summary> private void UpdateGraphicObjects() { // Set dialog icon MainWindow.Icon = Gdk.Pixbuf.LoadFromResource("comex_256.png"); // Set tool tip text for toolbutton TbOpen.TooltipText = GlobalObj.LMan.GetString("openact"); TbOpen.Label = GlobalObj.LMan.GetString("openlbl"); TbClose.Label = GlobalObj.LMan.GetString("closelbl"); TbSettings.Label = GlobalObj.LMan.GetString("settingslbl"); TbSettings.TooltipText = GlobalObj.LMan.GetString("settingsmenulbl"); TbAbout.TooltipText = GlobalObj.LMan.GetString("infoact"); TbAbout.Label = GlobalObj.LMan.GetString("infolbl"); TbExit.TooltipText = GlobalObj.LMan.GetString("exitact"); TbExit.Label = GlobalObj.LMan.GetString("exitlbl"); TbATR.TooltipText = GlobalObj.LMan.GetString("atract"); TbATR.Label = GlobalObj.LMan.GetString("atrlbl"); // Set labels ((Label)MenuFileItem.Child).TextWithMnemonic = GlobalObj.LMan.GetString("filemenulbl"); ((Label)MenuFileOpen.Child).TextWithMnemonic = GlobalObj.LMan.GetString("openmenulbl"); ((Label)MenuFileClose.Child).TextWithMnemonic = GlobalObj.LMan.GetString("closemenulbl"); ((Label)MenuFileSettings.Child).TextWithMnemonic = GlobalObj.LMan.GetString("settingsmenulbl"); ((Label)MenuFileExit.Child).TextWithMnemonic = GlobalObj.LMan.GetString("exitmenulbl"); ((Label)MenuReaderItem.Child).TextWithMnemonic = GlobalObj.LMan.GetString("readermenulbl"); ((Label)MenuAboutItem.Child).TextWithMnemonic = GlobalObj.LMan.GetString("helpmenulbl"); ((Label)MenuAboutInfo.Child).TextWithMnemonic = GlobalObj.LMan.GetString("infomenulbl"); LblATR.Markup = "<b>" + GlobalObj.LMan.GetString("atrframelbl") + "</b>"; LblCommand.Text = GlobalObj.LMan.GetString("cmdlbl"); LblResponse.Text = GlobalObj.LMan.GetString("resplbl"); LblSend.Text = GlobalObj.LMan.GetString("sendlbl"); LblExchange.Markup = "<b>" + GlobalObj.LMan.GetString("cardframelbl") + "</b>"; LblFile.Markup = "<b>" + GlobalObj.LMan.GetString("commandfilelbl") + "</b>"; Gdk.Color color = new Gdk.Color(); Gdk.Color.Parse("#0000FF", ref color); TxtATR.ModifyText(StateType.Normal, color); Gdk.Color.Parse("#0000FF", ref color); TxtResp.ModifyText(StateType.Normal, color); Gdk.Color.Parse("#1F6D20", ref color); TxtCmd.ModifyText(StateType.Normal, color); // TreeView (List) LstCommands.Selection.Mode = SelectionMode.Single; CellRendererText rendererText = new CellRendererText(); TreeViewColumn column = new TreeViewColumn(); column.Title = "Commands"; column.Resizable = true; column.PackStart(rendererText, true); column.AddAttribute(rendererText, "text", 0); LstCommands.RulesHint = true; LstCommands.AppendColumn(column); if (GlobalObj.IsWindows()) { LstCommands.ModifyFont(FontDescription.FromString("Courier New Normal 10")); } else { LstCommands.ModifyFont(FontDescription.FromString("Fixed Normal 10")); } // update gui menu Gtk.RadioMenuItem rmi; // loop for all readers List <string> allReaders = new List <string>(); // loop for each managed readers type foreach (IReader rdr in GlobalObj.ReaderManager.Values) { allReaders.AddRange(rdr.Readers); } for (int n = 0; n < allReaders.Count; n++) { // set first as selected if (n == 0) { rmi = new Gtk.RadioMenuItem(allReaders[n]); GlobalObj.SelectedReader = allReaders[n]; StatusBar.Push(1, GlobalObj.LMan.GetString("selreader") + ": " + allReaders[n]); } else { // added others rmi = new Gtk.RadioMenuItem((RadioMenuItem)MenuReader.Children[0], allReaders[n]); } rmi.ButtonReleaseEvent += ActionChangeReader; MenuReader.Add(rmi); } MenuReader.ShowAll(); }
public Menu CreateOptionsMenu () { Menu menu = new Menu (); MenuItem searchInMenu = new MenuItem (GettextCatalog.GetString ("_Search in")); Menu sub = new Menu (); searchInMenu.Submenu = sub; Gtk.RadioMenuItem original = null, translated = null, both = null; GLib.SList group = new GLib.SList (IntPtr.Zero); original = new Gtk.RadioMenuItem (group, GettextCatalog.GetString ("_Original")); group = original.Group; original.ButtonPressEvent += delegate { original.Activate (); }; sub.Append (original); translated = new Gtk.RadioMenuItem (group, GettextCatalog.GetString ("_Translated")); translated.ButtonPressEvent += delegate { translated.Activate (); }; group = translated.Group; sub.Append (translated); both = new Gtk.RadioMenuItem (group, GettextCatalog.GetString ("_Both")); both.ButtonPressEvent += delegate { both.Activate (); }; sub.Append (both); switch (DoSearchIn) { case SearchIn.Both: both.Activate (); break; case SearchIn.Original: original.Activate (); break; case SearchIn.Translated: translated.Activate (); break; } menu.Append (searchInMenu); both.Activated += delegate { if (DoSearchIn != SearchIn.Both) { DoSearchIn = SearchIn.Both; UpdateFromCatalog (); menu.Destroy (); } }; original.Activated += delegate { if (DoSearchIn != SearchIn.Original) { DoSearchIn = SearchIn.Original; UpdateFromCatalog (); menu.Destroy (); } }; translated.Activated += delegate { if (DoSearchIn != SearchIn.Translated) { DoSearchIn = SearchIn.Translated; UpdateFromCatalog (); menu.Destroy (); } }; Gtk.CheckMenuItem regexSearch = new Gtk.CheckMenuItem (MonoDevelop.Core.GettextCatalog.GetString ("_Regex search")); regexSearch.Active = RegexSearch; regexSearch.ButtonPressEvent += delegate { RegexSearch = !RegexSearch; UpdateFromCatalog (); }; menu.Append (regexSearch); Gtk.CheckMenuItem caseSensitive = new Gtk.CheckMenuItem (MonoDevelop.Core.GettextCatalog.GetString ("_Case sensitive")); caseSensitive.Active = IsCaseSensitive; caseSensitive.ButtonPressEvent += delegate { IsCaseSensitive = !IsCaseSensitive; UpdateFromCatalog (); }; menu.Append (caseSensitive); Gtk.CheckMenuItem wholeWordsOnly = new Gtk.CheckMenuItem (MonoDevelop.Core.GettextCatalog.GetString ("_Whole words only")); wholeWordsOnly.Active = IsWholeWordOnly; wholeWordsOnly.Sensitive = !RegexSearch; wholeWordsOnly.ButtonPressEvent += delegate { IsWholeWordOnly = !IsWholeWordOnly; UpdateFromCatalog (); }; menu.Append (wholeWordsOnly); menu.ShowAll (); return menu; }
/// <summary> /// Update Gtk objects properties /// </summary> private void UpdateGraphicObjects() { // Set dialog icon MainWindow.Icon = Gdk.Pixbuf.LoadFromResource("monosim.png"); // Set tool tip text for toolbutton TbNew.TooltipText = GlobalObjUI.LMan.GetString("newfileact"); TbOpen.TooltipText = GlobalObjUI.LMan.GetString("openfileact"); TbSaveFile.TooltipText = GlobalObjUI.LMan.GetString("savefileact"); TbClose.TooltipText = GlobalObjUI.LMan.GetString("closefileact"); TbSaveSim.TooltipText = GlobalObjUI.LMan.GetString("savefilesimact"); TbSaveSim.IconWidget = new Gtk.Image(Pixbuf.LoadFromResource("chip_24.png")); TbSaveSim.ShowAll(); TbSettings.TooltipText = GlobalObjUI.LMan.GetString("settingsact"); TbOpenSim.TooltipText = GlobalObjUI.LMan.GetString("opensimact"); TbChangePin.TooltipText = GlobalObjUI.LMan.GetString("pinsimact"); TbSaveSimFile.TooltipText = GlobalObjUI.LMan.GetString("savesimfileact"); TbCloseSim.TooltipText = GlobalObjUI.LMan.GetString("closesimact"); TbSaveSimSim.TooltipText = GlobalObjUI.LMan.GetString("savesimact"); TbSaveSimSim.IconWidget = new Gtk.Image(Pixbuf.LoadFromResource("chip_24.png")); TbSaveSimSim.ShowAll(); TbAbout.TooltipText = GlobalObjUI.LMan.GetString("infoact"); TbExit.TooltipText = GlobalObjUI.LMan.GetString("exitact"); // change icons for chip MenuFileSaveSim.Image = new Gtk.Image(Pixbuf.LoadFromResource("chip_16.png")); MenuSimSaveSim.Image = new Gtk.Image(Pixbuf.LoadFromResource("chip_16.png")); // Set labels ((Label)MenuFileItem.Child).TextWithMnemonic = GlobalObjUI.LMan.GetString("filemenulbl"); ((Label)MenuFileNew.Child).TextWithMnemonic = GlobalObjUI.LMan.GetString("newfileact"); ((Label)MenuFileOpen.Child).TextWithMnemonic = GlobalObjUI.LMan.GetString("openfileact"); ((Label)MenuFileSaveFile.Child).TextWithMnemonic = GlobalObjUI.LMan.GetString("savefileact"); ((Label)MenuFileSaveSim.Child).TextWithMnemonic = GlobalObjUI.LMan.GetString("savefilesimact"); ((Label)MenuFileClose.Child).TextWithMnemonic = GlobalObjUI.LMan.GetString("closefileact"); ((Label)MenuFileSettings.Child).TextWithMnemonic = GlobalObjUI.LMan.GetString("settingsact"); ((Label)MenuFileExit.Child).TextWithMnemonic = GlobalObjUI.LMan.GetString("exitact"); ((Label)MenuReaderItem.Child).TextWithMnemonic = GlobalObjUI.LMan.GetString("readermenulbl"); ((Label)MenuSimItem.Child).TextWithMnemonic = GlobalObjUI.LMan.GetString("simmenulbl"); ((Label)MenuSimConnect.Child).TextWithMnemonic = GlobalObjUI.LMan.GetString("opensimact"); ((Label)MenuSimPin.Child).TextWithMnemonic = GlobalObjUI.LMan.GetString("pinsimact"); ((Label)MenuSimSaveFile.Child).TextWithMnemonic = GlobalObjUI.LMan.GetString("savesimfileact"); ((Label)MenuSimSaveSim.Child).TextWithMnemonic = GlobalObjUI.LMan.GetString("savesimact"); ((Label)MenuSimDeleteAll.Child).TextWithMnemonic = GlobalObjUI.LMan.GetString("deletesimact"); ((Label)MenuSimDisconnect.Child).TextWithMnemonic = GlobalObjUI.LMan.GetString("closesimact"); ((Label)MenuAboutItem.Child).TextWithMnemonic = GlobalObjUI.LMan.GetString("helpmenulbl"); ((Label)MenuAboutInfo.Child).TextWithMnemonic = GlobalObjUI.LMan.GetString("infoact"); LblFile.Markup = "<b>" + GlobalObjUI.LMan.GetString("framefile") + "</b>"; LblSim.Markup = "<b>" + GlobalObjUI.LMan.GetString("framesim") + "</b>"; // Set Popup menu ((Label)PopMenuFileAdd.Child).TextWithMnemonic = GlobalObjUI.LMan.GetString("addcontacts"); ((Label)PopMenuFileDel.Child).TextWithMnemonic = GlobalObjUI.LMan.GetString("delcontacts"); ((Label)PopMenuFileVSim.Child).TextWithMnemonic = GlobalObjUI.LMan.GetString("copycontactstosim"); ((Label)PopMenuSimAdd.Child).TextWithMnemonic = GlobalObjUI.LMan.GetString("addcontacts"); ((Label)PopMenuSimDel.Child).TextWithMnemonic = GlobalObjUI.LMan.GetString("delcontacts"); ((Label)PopMenuSimVFile.Child).TextWithMnemonic = GlobalObjUI.LMan.GetString("copycontactstofile"); // Set ListView string[] columnHeaders = new string[]{ GlobalObjUI.LMan.GetString("descnumber"), GlobalObjUI.LMan.GetString("phonenumber") }; InitListView(ref lstFileContacts, ref LstFileContacts, columnHeaders); InitListView(ref lstSimContacts, ref LstSimContacts, columnHeaders); // update gui menu Gtk.RadioMenuItem rmi; // loop for all readers List<string> allReaders = new List<string>(); // loop for each managed readers type foreach(IReader rdr in GlobalObj.ReaderManager.Values) { allReaders.AddRange(rdr.Readers); } for (int n=0; n<allReaders.Count; n++) { // set first as selected if (n==0) { rmi = new Gtk.RadioMenuItem(allReaders[n]); GlobalObj.SelectedReader = allReaders[n]; StatusBar.Push(1, GlobalObj.LMan.GetString("selreader") + ": " + allReaders[n]); } else { // added others rmi = new Gtk.RadioMenuItem((RadioMenuItem)MenuReader.Children[0], allReaders[n]); } rmi.ButtonReleaseEvent += ActionChangeReader; MenuReader.Add(rmi); } MenuReader.ShowAll(); }
static Menu Create_Menu(int depth, bool tearoff) { if (depth < 1) return null; Menu menu = new Menu (); MenuItem menuitem = null; string label = null; GLib.SList group = new GLib.SList (IntPtr.Zero); if (tearoff) { menuitem = new TearoffMenuItem (); menu.Append (menuitem); menuitem.Show (); } for (int i = 0, j = 1; i < 5; i++, j++) { label = String.Format ("item {0} - {1}", depth, j); menuitem = new RadioMenuItem (group, label); group = ((RadioMenuItem) menuitem).Group; menuitem = new MenuItem (label); menu.Append (menuitem); if (i == 3) menuitem.Sensitive = false; Menu child = Create_Menu ((depth - 1), true); if (child != null) menuitem.Submenu = child; } return menu; }
private SharpMusique( string [] args ) { int i; string strPath; TreeViewColumn tvc; CellRenderer rendr; string [] strColumns = new string[] { "Title", "Artist", "Album", "Time", "Price" }; string [] strCWidths = new string[] { "260", "190", "180", "70", "70" }; if( Environment.OSVersion.ToString().IndexOf( "Unix" ) != -1 ) { strHomeDir = Environment.GetEnvironmentVariable( "HOME" ); strSongDir = Path.Combine( strHomeDir, "Music" ); strDataDir = Path.Combine( strHomeDir, ".SharpMusique" ); } else { strHomeDir = Environment.GetFolderPath( Environment.SpecialFolder.ApplicationData ); strSongDir = Environment.GetFolderPath( Environment.SpecialFolder.MyMusic ); strDataDir = Path.Combine( strHomeDir, "SharpMusique" ); } Utility.CreateDirectory( strDataDir ); strPath = Path.Combine( strDataDir, "songdir" ); if( File.Exists( strPath ) ) { StreamReader sr = new StreamReader( strPath ); strSongDir = sr.ReadToEnd().Trim(); sr.Close(); } Utility.CreateDirectory( strSongDir ); strPath = Path.Combine( strDataDir, "cwidths" ); if( File.Exists( strPath ) ) { StreamReader sr = new StreamReader( strPath ); string [] strTmp = sr.ReadToEnd().Split( ',' ); sr.Close(); if( strTmp.Length == strCWidths.Length ) strCWidths = strTmp; } Application.Init(); Glade.XML gxml = new Glade.XML( null, "SharpMusique.glade", "MainWindow", null ); gxml.Autoconnect( this ); MainWindow.Icon = new Gdk.Pixbuf( null, "sharpmusique.png" ); songls = new ListStore( GType.String, GType.String, GType.String, GType.String, GType.String, GType.Int ); songtv.Model = songls; songtv.HeadersClickable = true; songtv.Selection.Changed += new EventHandler( OnTreeViewSelection ); for( i = 0; i < strColumns.Length; i++ ) { tvc = new TreeViewColumn(); rendr = new CellRendererText(); tvc.Title = strColumns[ i ]; tvc.PackStart( rendr, true ); tvc.AddAttribute( rendr, "text", i ); tvc.Sizing = TreeViewColumnSizing.Fixed; tvc.FixedWidth = Convert.ToInt32( strCWidths[ i ] ); tvc.Resizable = true; tvc.SortColumnId = i; songtv.AppendColumn( tvc ); } strPath = Path.Combine( strDataDir, "country" ); if( File.Exists( strPath ) ) { StreamReader sr = new StreamReader( strPath ); strCountry = sr.ReadToEnd().Trim(); sr.Close(); } SList group = new SList( IntPtr.Zero ); Menu cmenu = new Menu(); micountry.Submenu = cmenu; string [] countries = FairStore.Countries.AllKeys; for( i = 0; i < countries.Length; i++ ) { RadioMenuItem rmi = new RadioMenuItem( group, countries[ i ] ); rmi.Toggled += new EventHandler( OnCountrySelect ); rmi.Name = countries[ i ]; if( (((i + 1) == countries.Length) && (strCountry == null)) || countries[ i ].Equals( strCountry ) ) { rmi.Active = true; } group = rmi.Group; cmenu.Append( rmi ); rmi.Show(); } mipending.Sensitive = false; mipepsicap.Sensitive = false; migiftcert.Sensitive = false; mipreview.Sensitive = false; mipurchase.Sensitive = false; mipurchasealbum.Sensitive = false; miviewalbum.Sensitive = false; cidStatus = sbar.GetContextId( "Status" ); cidProgress = sbar.GetContextId( "Progress" ); sbar.Push( cidStatus, "Not Logged In" ); mutex = new Mutex(); Application.Run(); }