public DataExportMenu(IActivateItems activator) : base(activator, "Data Export Options") { Enabled = _activator.RepositoryLocator.DataExportRepository != null; DropDownItems.Add(new ToolStripMenuItem("Configure Disclaimer", null, ConfigureDisclaimer)); DropDownItems.Add(new ToolStripMenuItem("Configure Hashing Algorithm", null, ConfigureHashingAlgorithm)); }
private void PopulateChildItems() { if (_items.Count == 0) { return; } for (var i = 0; i < _items.Count; i++) { if (i == MaxDisplayItems) { break; } PopulateChildItem(_items[i]); } if (DisplayOpenAllOption || DisplayClearOption) { DropDownItems.Add(new MenuItemSeperator()); } if (DisplayOpenAllOption) { DropDownItems.Add(_openAllMenuItem); } if (DisplayClearOption) { DropDownItems.Add(_clearMenuItem); } }
private void PopulateMenu() { DropDownItems.Clear(); if (EnableRepeatEffectMenuItem && LastEffect != null) { string repeatFormat = PdnResources.GetString("Effects.RepeatMenuItem.Format"); string menuName = string.Format(repeatFormat, LastEffect.Name); PdnMenuItem pmi = new PdnMenuItem(menuName, LastEffect.Image, RepeatEffectMenuItem_Click) { Name = "RepeatEffect(" + LastEffect.GetType().FullName + ")", ShortcutKeys = Keys.Control | Keys.F }; DropDownItems.Add(pmi); ToolStripSeparator tss = new ToolStripSeparator(); DropDownItems.Add(tss); } AddEffectsToMenu(); Triple <Assembly, Type, Exception>[] errors = Effects.GetLoaderExceptions(); for (int i = 0; i < errors.Length; ++i) { AppWorkspace.ReportEffectLoadError(errors[i]); } MenuPopulated = true; }
private void InitializeComponent() { // // sentinel // Sentinel = new PdnMenuItem { Name = null }; // // components // Components = new System.ComponentModel.Container(); // // invalidateTimer // InvalidateTimer = new System.Windows.Forms.Timer(Components) { Enabled = false, Interval = effectRefreshInterval }; InvalidateTimer.Tick += InvalidateTimer_Tick; // // EffectMenuBase // DropDownItems.Add(Sentinel); }
/// <summary> /// Copy class constructor /// </summary> /// <param name="copyThis"></param> public BookmarkedLocationsViewModel(BookmarkedLocationsViewModel copyThis) : this() { if (copyThis == null) { return; } ////this.IsOpen = copyThis.IsOpen; this could magically open other drop downs :-) foreach (var item in copyThis.DropDownItems) { DropDownItems.Add(new FSItemViewModel(item as FSItemViewModel)); } // Select quivalent item in target collection if (copyThis.SelectedItem != null) { string fullPath = copyThis.SelectedItem.FullPath; var result = DropDownItems.SingleOrDefault(item => fullPath == item.FullPath); if (result != null) { SelectedItem = result; } } }
private void InitDropDownItems() { toolStripMenuItems = new ToolStripMenuItem[5]; ToolStripMenuItem toolStripMenuItem = new ToolStripMenuItem(); toolStripMenuItem.Tag = 0; toolStripMenuItem.Text = "整数"; toolStripMenuItems[0] = toolStripMenuItem; toolStripMenuItem = new ToolStripMenuItem(); toolStripMenuItem.Tag = 1; toolStripMenuItem.Text = "保留一位"; toolStripMenuItems[1] = toolStripMenuItem; toolStripMenuItem = new ToolStripMenuItem(); toolStripMenuItem.Tag = 2; toolStripMenuItem.Text = "保留二位"; toolStripMenuItems[2] = toolStripMenuItem; toolStripMenuItem = new ToolStripMenuItem(); toolStripMenuItem.Tag = 3; toolStripMenuItem.Text = "保留三位"; toolStripMenuItems[3] = toolStripMenuItem; toolStripMenuItem = new ToolStripMenuItem(); toolStripMenuItem.Tag = 4; toolStripMenuItem.Text = "保留四位"; toolStripMenuItems[4] = toolStripMenuItem; for (int i = 0; i < toolStripMenuItems.Length; i++) { DropDownItems.Add(toolStripMenuItems[i]); } }
public EditMenuStripItem() : base("&Edit".Localize()) { Name = "MenuEdit"; ToolStripMenuItem undo = new ToolStripMenuItem("Undo".Localize()); ToolStripMenuItem redo = new ToolStripMenuItem("Redo".Localize()); ToolStripMenuItem cut = new ToolStripMenuItem("Cut".Localize()); ToolStripMenuItem copy = new ToolStripMenuItem("&Copy".Localize()); ToolStripMenuItem paste = new ToolStripMenuItem("&Paste".Localize()); ToolStripMenuItem settings = new ToolStripMenuItem("Settings".Localize()); settings.Click += settings_Click; ToolStripMenuItem keybindings = new ToolStripMenuItem("Keybindings".Localize()); keybindings.Click += keybindings_Click; DropDownItems.Add(undo); DropDownItems.Add(redo); DropDownItems.Add("-"); DropDownItems.Add(cut); DropDownItems.Add(copy); DropDownItems.Add(paste); DropDownItems.Add("-"); DropDownItems.Add(settings); DropDownItems.Add(keybindings); }
public void SetRevisionFunc(Func <IReadOnlyList <GitRevision> > revisionFunc) { _revisionFunc = revisionFunc; // Add dummy item for the menu entry to appear expandable (triangle on the right) DropDownItems.Add(new ToolStripMenuItem()); }
public VoiceToolstripButton(VoiceService voices) { Voices = voices; ToolTipText = "Voice Chat"; Paint += new PaintEventHandler(VoiceToolstripButton_Paint); ButtonClick += new EventHandler(VoiceToolstripButton_ButtonClick); MouseDown += new MouseEventHandler(VoiceToolstripButton_MouseDown); MouseUp += new MouseEventHandler(VoiceToolstripButton_MouseUp); OffButton = new ToolStripMenuItem("Off", Res.VoiceRes.VoiceOff, OffButton_Clicked); VoiceActivatedButton = new ToolStripMenuItem("Voice Activated", Res.VoiceRes.VoiceVAD, VoiceActivatedButton_Clicked); PushtoTalkButton = new ToolStripMenuItem("Push to Talk", Res.VoiceRes.VoicePTT, PushtoTalkButton_Clicked); MuteButton = new ToolStripMenuItem("Mute", Res.VoiceRes.VoiceMute, MuteButton_Clicked); SettingsButton = new ToolStripMenuItem("Settings", Res.VoiceRes.VoiceSettings, SettingsButton_Clicked); DropDownItems.Add(OffButton); DropDownItems.Add(VoiceActivatedButton); DropDownItems.Add(PushtoTalkButton); DropDownItems.Add(MuteButton); DropDownItems.Add(SettingsButton); WindowID = Voices.Core.RndGen.Next(); Voices.RegisterWindow(WindowID, new VolumeUpdateHandler(VoiceService_VolumeUpdate)); OffButton.PerformClick(); }
public SystemMenuItem(Form ownerForm) { form = ownerForm; base.AutoSize = false; base.Size = new Size(20, 20); base.Image = ownerForm.Icon.ToBitmap(); base.MergeIndex = int.MinValue; base.DisplayStyle = ToolStripItemDisplayStyle.Image; DropDownItems.Add("&Restore", null, RestoreItemHandler); ToolStripMenuItem tsiMove = (ToolStripMenuItem)DropDownItems.Add("&Move"); tsiMove.Enabled = false; ToolStripMenuItem tsiSize = (ToolStripMenuItem)DropDownItems.Add("&Size"); tsiSize.Enabled = false; DropDownItems.Add("Mi&nimize", null, MinimizeItemHandler); ToolStripMenuItem tsiMaximize = (ToolStripMenuItem)DropDownItems.Add("Ma&ximize"); tsiMaximize.Enabled = false; DropDownItems.Add("-"); ToolStripMenuItem tsiClose = (ToolStripMenuItem)DropDownItems.Add("&Close", null, CloseItemHandler); tsiClose.ShortcutKeys = Keys.Control | Keys.F4; DropDownItems.Add("-"); ToolStripMenuItem tsiNext = (ToolStripMenuItem)DropDownItems.Add("Nex&t", null, NextItemHandler); tsiNext.ShortcutKeys = Keys.Control | Keys.F6; }
public virtual void UpdateStatus() { if (codon != null) { ConditionFailedAction failedAction = codon.GetFailedAction(caller); this.Visible = failedAction != ConditionFailedAction.Exclude; if (!isInitialized && failedAction != ConditionFailedAction.Exclude) { isInitialized = true; CreateDropDownItems(); // must be created to support shortcuts if (DropDownItems.Count == 0 && subItems.Count > 0) { DropDownItems.Add(new ToolStripMenuItem()); } } if (Image == null && codon.Properties.Contains("icon")) { try { Image = ResourceService.GetBitmap(codon.Properties["icon"]); } catch (ResourceNotFoundException) { } } } }
/// <summary> /// adds an item to the select list /// </summary> /// <param name="label">the label to be displayed</param> /// <param name="image">the icon to be displayed</param> /// <param name="data">the data to be returned when an item is queried</param> /// <param name="isChecked">whether the item is initially checked</param> public void AddItem(string label, Image image, object data, bool isChecked) { var toolStripMenuSelectListItem = new ToolStripMenuSelectListItem { Text = label }; if (image == null) { image = _defaultImage; } toolStripMenuSelectListItem.DisplayStyle = ToolStripItemDisplayStyle.Text; toolStripMenuSelectListItem.Image = image; toolStripMenuSelectListItem.CheckOnClick = true; toolStripMenuSelectListItem.CheckStateChanged += ItemCheckStateChanged; toolStripMenuSelectListItem.Data = data; if (isChecked) { if (!_multiCheckAllowed) { _updateInProgress = true; UncheckAll(); _updateInProgress = false; } toolStripMenuSelectListItem.Checked = true; } DropDownItems.Add(toolStripMenuSelectListItem); }
private void RebuildList() { int count = PluginMain.Settings.RecentProjects.Count; int max = PluginMain.Settings.MaxRecentProjects; if (count > max) { PluginMain.Settings.RecentProjects.RemoveRange(max, count - max); } if (count == 0) { ClearAllItems(); return; } DropDownItems.Clear(); ToolbarSelector.DropDownItems.Clear(); foreach (string projectPath in PluginMain.Settings.RecentProjects) { DropDownItems.Add(BuildItem(projectPath, true)); ToolbarSelector.DropDownItems.Add(BuildItem(projectPath, false)); } DropDownItems.Add(new ToolStripSeparator()); DropDownItems.Add(cleanItemMenu); DropDownItems.Add(clearItemMenu); ToolbarSelector.DropDownItems.Add(new ToolStripSeparator()); ToolbarSelector.DropDownItems.Add(cleanItemToolbar); ToolbarSelector.DropDownItems.Add(clearItemToolbar); ToolbarSelector.Enabled = Enabled = true; }
public IMenuItem AddItem(string text, object tag, IImage image, ItemAction action) { var item = new MenuItemEx(text, tag, image, action); DropDownItems.Add(item); return(item); }
/// <summary> /// adds an item to the select list /// </summary> /// <param name="label">the label to be displayed</param> /// <param name="image">the icon to be displayed</param> /// <param name="data">the data to be returned when an item is queried</param> /// <param name="isChecked">whether the item is initially checked</param> public void AddItem(string label, Image image, Object data, bool isChecked) { ToolStripMenuSelectListItem newItem = new ToolStripMenuSelectListItem(); newItem.Text = label; if (image == null) { image = defaultImage; } newItem.DisplayStyle = ToolStripItemDisplayStyle.Text; newItem.Image = image; newItem.CheckOnClick = true; newItem.CheckStateChanged += ItemCheckStateChanged; newItem.Data = data; if (isChecked) { if (!multiCheckAllowed) { updateInProgress = true; UncheckAll(); updateInProgress = false; } newItem.Checked = isChecked; } DropDownItems.Add(newItem); }
private void ScanAsync() { if (_isScanning) { Logger.Debug("Already scanning for discs; ignoring"); return; } Logger.Debug("Scanning for discs..."); _isScanning = true; DropDownItems.Add(_dividerItem); DropDownItems.Add(_scanningItem); var menuItems = new ToolStripItem[0]; new TaskBuilder() .OnCurrentThread() .DoWork((invoker, token) => menuItems = CreateToolStripItems(Drives)) .Succeed(() => UpdateMenu(menuItems)) .Fail(args => Logger.Error("Error occurred while scanning for discs", args.Exception)) .Finally(() => _isScanning = false) .Build() .Start(); }
void CreateDropDownItems() { ToolStripItem[] itemsToAdd = null; DropDownItems.Clear(); foreach (object item in subItems) { if (item is ToolStripItem) { DropDownItems.Add((ToolStripItem)item); if (item is IStatusUpdate) { ((IStatusUpdate)item).UpdateStatus(); ((IStatusUpdate)item).UpdateText(); } } else { ISubmenuBuilder submenuBuilder = (ISubmenuBuilder)item; itemsToAdd = submenuBuilder.BuildSubmenu(codon, caller); if (itemsToAdd != null) { DropDownItems.AddRange(itemsToAdd); } } } }
private void BookMenuItem_DropDownOpening(object sender, EventArgs e) { DropDownItems.Clear(); foreach (Manager.BookManager.Page ee in _TheBook.Pages) { DropDownItems.Add(new PageMenuItem(ee, _TheBook)); } this.DropDownItems.Add(new ToolStripSeparator()); ToolStripMenuItem ts = new ToolStripMenuItem("Add Page"); ts.Click += Ts_Click; ts.DropDownItems.Add(pageName); ToolStripMenuItem doAdd = new ToolStripMenuItem("Add!"); doAdd.Click += DoAdd_Click; ts.DropDownItems.Add(doAdd); DropDownItems.Add(ts); ToolStripMenuItem dts = new ToolStripMenuItem("Delete Book"); dts.Click += Dts_Click; DropDownItems.Add(dts); }
/// <summary> /// 创建 <see cref="UserTravelSessionMenuItem" /> 的新实例(UserTravelSessionMenuItem) /// </summary> public UserTravelSessionMenuItem(Session session) { Session = session; DisplayStyle = ToolStripItemDisplayStyle.ImageAndText; Text = "出行模式"; Image = Properties.Resources.briefcase_16; var list = session.UserProfile.QueryParams; //加载 list.QueryParamAdded += (s, e) => AddQueryParam(e.QueryParam); list.QueryParamRemoved += (s, e) => RemoveQueryParam(e.QueryParam); var man = new ToolStripMenuItem("管理出行模式..."); man.Click += (s, e) => new Dialogs.Query.QueryManager() { Session = Session }.ShowDialog(); DropDownItems.Add(man); DropDownItems.Add(new ToolStripSeparator()); DropDownItems.Add(_emptyItem = new ToolStripMenuItem("没有保存的出行模式...") { Tag = null, Enabled = false }); list.ForEach(AddQueryParam); }
private void AddItem([NotNull] string displayText, [NotNull] string textToCopy, Image image, char?hotkey) { if (hotkey.HasValue) { int position = displayText.IndexOf(hotkey.Value.ToString(), StringComparison.InvariantCultureIgnoreCase); if (position >= 0) { displayText = displayText.Insert(position, "&"); } } else { displayText = PrependItemNumber(displayText); } var item = new ToolStripMenuItem { Text = displayText.TrimEnd('\r', '\n'), ShowShortcutKeys = true, Image = image }; item.Click += delegate { ClipboardUtil.TrySetText(textToCopy); }; DropDownItems.Add(item); }
public SearchTextTypeToolStripDrownDownButton() { Text = searchTextTypeNames[(int)searchTextType]; Image = searchTextTypeImages[(int)searchTextType]; DropDownItems.Add(searchTextTypeNames[0], searchTextTypeImages[0], TextualOnClick); DropDownItems.Add(searchTextTypeNames[1], searchTextTypeImages[1], RegularExpressionOnClick); }
public FieldCacheMenuItem() { DropDownItems.Add(mnuTableFields); DropDownItems.Add(mnuColumnFields); DropDownItems.Add(mnuReferFields); DropDownItems.Add(mnuProfileFields); InitInsertMenus(); }
protected override void AddAdditionalMenuItems(SelectedItemCollection selection) { if (selection.ToList().All(item => !Helpers.CrossPoolMigrationRestrictedWithWlb(item.Connection))) { VMOperationCommand cmd = new CrossPoolMigrateCommand(Command.MainWindowCommandInterface, selection); DropDownItems.Add(new ToolStripSeparator()); VMOperationToolStripMenuSubItem lastItem = new VMOperationToolStripMenuSubItem(cmd); DropDownItems.Add(lastItem); } }
public ICustomSubMenu AddSubMenu(string itemText) { ICustomSubMenu menuItem = ControlFactory.Instance.GetCustomSubMenu(); menuItem.Text = itemText; DropDownItems.Add((ToolStripItem)menuItem); return(menuItem); }
private void Update() { for (int k = DropDownItems.Count - 1; k >= _favouritesStartIndex; k--) { DropDownItems.RemoveAt(k); } foreach (MostRecentItem item in _favourites) { DropDownItems.Add(CreateFavouriteItem(item)); } }
public void ShowRename() { DropDownItems.Add(toolText); DropDownClosed += This_DropDownClosed; toolText.KeyDown += new KeyEventHandler(This_KeyDown); toolText.Text = Text; ShowDropDown(); toolText.Focus(); }
private void SetLayout() { DropDownItems.Add(New); DropDownItems.Add(Open); DropDownItems.Add(OpenFromPack); DropDownItems.Add(new ToolStripSeparator()); DropDownItems.Add(Save); DropDownItems.Add(new ToolStripSeparator()); DropDownItems.Add(LoadGame); DropDownItems.Add(new ToolStripSeparator()); DropDownItems.Add(Exit); }
public Menu(MovieTab tab) { Text = "PSXjin"; _tab = tab; _movie = tab.Movie as Movie; var exportToPxm = new ToolStripMenuItem("Export to PXM"); exportToPxm.Click += (s, e) => ExportToPxm(); exportToPxm.ToolTipText = "Save the movie as a PXM file, for PCSX-rr."; DropDownItems.Add(exportToPxm); }
/// <summary> /// Adds the given command to the drop down item list of this tool strip menu item /// </summary> /// <param name="cmd"></param> /// <param name="shortcutKey"></param> /// <returns></returns> protected ToolStripMenuItem Add(IAtomicCommand cmd, Keys shortcutKey = Keys.None) { var mi = AtomicCommandUIFactory.CreateMenuItem(cmd); if (shortcutKey != Keys.None) { mi.ShortcutKeys = shortcutKey; } DropDownItems.Add(mi); return(mi); }
public Menu(MovieTab tab) { Text = "Dolphin"; _tab = tab; _movie = tab.Movie as Movie; var ensurePlayback = new ToolStripMenuItem("Ensure Movie Playback"); ensurePlayback.Click += (s, e) => EnsurePlayback(); ensurePlayback.ToolTipText = "Ensures the full playback of a movie file by setting wildly incorrect frame and tick counts."; DropDownItems.Add(ensurePlayback); }