public void BuildToolBar(ToolBarDefinition toolBarDefinition, IToolBar result) { var groups = _toolBarItemGroups .Where(x => x.ToolBar == toolBarDefinition) .OrderByDescending(x => x.SortOrder) .ToList(); for (var i = 0; i < groups.Count; i++) { var group = groups[i]; var toolBarItems = _toolBarItems .Where(x => x.Group == group) .OrderByDescending(x => x.SortOrder); foreach (var toolBarItem in toolBarItems) { result.Add(new CommandToolBarItem(toolBarItem, _commandService.GetCommand(toolBarItem.CommandDefinition), toolBarItem.CommandDefinition.Command, result)); } if (i < groups.Count - 1 && toolBarItems.Any()) { result.Add(new ToolBarItemSeparator()); } } }
public CommandToolBarItem(ToolBarItemDefinition toolBarItem, Command command, IToolBar parent) { _toolBarItem = toolBarItem; _command = command; _parent = parent; command.PropertyChanged += OnCommandPropertyChanged; }
private void AddRowDefinitions(IToolBar model) { var total = model.Tools.Max(m => model.GetRow(m)); for (var i = 0; i <= total; i++) { toolContainer.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); } }
public CommandToolBarItem(ToolBarItemDefinition toolBarItem, Command command, IToolBar parent) { _toolBarItem = toolBarItem; _command = command; _keyGesture = IoC.Get<ICommandKeyGestureService>().GetPrimaryKeyGesture(_command.CommandDefinition); _parent = parent; command.PropertyChanged += OnCommandPropertyChanged; }
public CommandToolBarItem(ToolBarItemDefinition toolBarItem, Command command, IToolBar parent) { _toolBarItem = toolBarItem; _command = command; _keyGesture = IoC.Get <ICommandKeyGestureService>().GetPrimaryKeyGesture(_command.CommandDefinition); _parent = parent; command.PropertyChanged += OnCommandPropertyChanged; }
/// <summary> /// Get items for a given toolbar /// </summary> /// <param name="toolBar"></param> /// <returns></returns> public IEnumerable <IToolBarItem> GetToolBarItems(IToolBar toolBar) { if (toolBar == null || toolBar.Tag == null) { return(EmptyEnumerable <IToolBarItem> .Instance); } var items = m_toolBarItems.Where(x => x.IsVisible && CommandComparer.TagsEqual(x.ToolBarTag, toolBar.Tag)).ToList(); items.Sort(ToolBarItemComparer.Instance); return(items); }
public void Shutdown(IApplication application) { m_myToolBarButton1 = m_myToolBarButton2 = null; application.ToolBars.Remove(m_myToolBar); m_myToolBar = null; m_myMenuItem = null; application.MenuStrip.DropDownMenus.Remove(m_myDropDownMenu); m_myDropDownMenu = null; }
private void OnDataContextChanged() { // Setup initial conditions. if (toolLayoutController != null) toolLayoutController.Dispose(); // Unwire old view-model. if (viewModel != null) viewModel.UpdateLayoutRequest -= OnUpdateLayout; // Wire up events. viewModel = ViewModel; if (viewModel != null) viewModel.UpdateLayoutRequest += OnUpdateLayout; }
public void Shutdown(IApplication application) { // TODO m_npcToolBarButton = m_eventToolBarButton = null; application.ToolBars.Remove(m_myToolBar); m_myToolBar = null; m_myMenuItem = null; application.MenuStrip.DropDownMenus.Remove(m_myDropDownMenu); m_myDropDownMenu = null; }
/// <summary> /// Enumerate items for a given toolbar</summary> /// <param name="toolBar">Toolbar</param> /// <returns>Enumeration of IToolBarItem in toolbar</returns> public IEnumerable <IToolBarItem> GetToolBarItems(IToolBar toolBar) { if (toolBar == null || toolBar.Tag == null) { return(EmptyEnumerable <IToolBarItem> .Instance); } var items = m_toolBarItems.Where(x => x.IsVisible && CommandComparer.TagsEqual(x.ToolBarTag, toolBar.Tag)).ToList(); items.Sort(ToolBarItemComparer.Instance); // Maintain separator groups if (items.Any()) { var groupedItems = new List <IToolBarItem>(); var prevItem = items[0] as CommandItem; object prevTag = prevItem != null ? prevItem.GroupTag : null; groupedItems.Add(items[0]); for (int i = 1; i < items.Count; i++) { var thisItem = items[i] as CommandItem; if (thisItem == null) { groupedItems.Add(items[i]); continue; } object groupTag = thisItem.GroupTag; // add a separator if the new command is from a different group if (groupTag != null && prevTag != null && !CommandComparer.TagsEqual(groupTag, prevTag)) { groupedItems.Add(new ToolBarSeparator()); } groupedItems.Add(thisItem); prevTag = groupTag; } items = groupedItems; } return(items); }
public void LayupTools(IToolBar model) { // Setup initial conditions. Clear(); if (model == null || model.Tools.IsEmpty()) return; // Add row/column definitions. AddRowDefinitions(model); AddColumnDefinitions(model); // Insert tools. foreach (var tool in model.Tools) { InsertTool(tool); } }
public ToolBarMenuItem(IToolBar toolBar) { // store the toolbar and create a condition to // control its visibility m_toolBar = toolBar; // preserve the existing visible state, in case it // was set to true in the toolbar constructor m_toolBarVisibleCondition = new ConcreteCondition(m_toolBar.Visible); m_toolBar.VisibleCondition = m_toolBarVisibleCondition; ID = toolBar.ID; Header = toolBar.Name; InsertRelativeToID = toolBar.InsertRelativeToID; BeforeOrAfter = toolBar.BeforeOrAfter; IsCheckable = true; IsChecked = toolBar.Visible; }
public void Remove(IToolBar toolBar) { ToolBarBridge toolBarBridge = (ToolBarBridge)toolBar; if (!m_toolBars.Contains(toolBarBridge)) { throw new Exception("Cannot remove a toolbar that is not in the tool strip container"); } if (toolBar.ReadOnly) { throw new Exception("Cannot remove a built-in toolbar"); } ToolStrip toolStrip = toolBarBridge.ToolStrip; toolStrip.Parent.Controls.Remove(toolStrip); m_toolBars.Remove(toolBarBridge); }
public void BuildToolBar(ToolBarDefinition toolBarDefinition, IToolBar result) { var groups = _toolBarItemGroups .Where(x => x.ToolBar == toolBarDefinition) .OrderBy(x => x.SortOrder) .ToList(); for (int i = 0; i < groups.Count; i++) { var group = groups[i]; var toolBarItems = _toolBarItems .Where(x => x.Group == group) .OrderBy(x => x.SortOrder); foreach (var toolBarItem in toolBarItems) result.Add(new CommandToolBarItem(toolBarItem, _commandService.GetCommand(toolBarItem.CommandDefinition), result)); if (i < groups.Count - 1 && toolBarItems.Any()) result.Add(new ToolBarItemSeparator()); } }
public void Initialise(IApplication application) { m_myDropDownMenu = application.MenuStrip.DropDownMenus.Add("My Custom Menu"); m_myDropDownMenu.Image = Properties.Resources.Menu; m_myMenuItem = application.MenuStrip.DropDownMenus["My Custom Menu"].SubItems.Add("My Menu Item 1"); m_myMenuItem.Image = Properties.Resources.Action; m_myMenuItem.ShortcutKeys = (Keys)(Keys.Control | Keys.Z); m_myMenuItem.EventHandler = MyCustomAction; m_myToolBar = application.ToolBars.Add("MyToolBar"); m_myToolBarButton1 = m_myToolBar.Buttons.Add("Button1", Properties.Resources.Action); m_myToolBarButton1.ToolTipText = "My ToolStrip Button 1"; m_myToolBarButton1.Checked = true; m_myToolBarButton1.EventHandler = MyCustomAction; m_myToolBarButton2 = m_myToolBar.Buttons.Add("Button2", Properties.Resources.Action); m_myToolBarButton2.ToolTipText = "My second toolbar button"; m_myToolBarButton2.Enabled = false; application.Editor.MouseDown = OnEditorMouseDown; }
private void AddColumnDefinitions(IToolBar model) { var total = model.Tools.Max(m => model.GetColumn(m)); for (var i = 0; i <= total; i++) { toolContainer.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto }); } }
/// <inheritdoc /> /// <remarks>This method is intended to be overriden by clients</remarks> public virtual void ConfigureToolBar(IToolBar toolBar) { // Clients may override }
public TerminalToolBarInstance(TerminalToolBar parent, IToolBar toolbar) { _parent = parent; _toolBar = toolbar; }
internal void InitializePlugins(Screen screen) { AvailablePlugin plugin = Plugin.Plugins.AvailablePlugins.Find("HelpPlugin"); if ((plugin != null) && (plugin.Instance is IHelp)) { this.HelpPlugin = plugin.Instance as IHelp; this.HelpPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); this.HelpPlugin.SetScreen(screen); screen.PluginList.Add(this.HelpPlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("PersonDetailPlugin"); if ((plugin != null) && (plugin.Instance is IPersonDetail)) { this.PersonDetailPlugin = plugin.Instance as IPersonDetail; this.PersonDetailPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); this.PersonDetailPlugin.SetScreen(screen); screen.PluginList.Add(this.PersonDetailPlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("TroopDetailPlugin"); if ((plugin != null) && (plugin.Instance is ITroopDetail)) { this.TroopDetailPlugin = plugin.Instance as ITroopDetail; this.TroopDetailPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); this.TroopDetailPlugin.SetScreen(screen); screen.PluginList.Add(this.TroopDetailPlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("ArchitectureDetailPlugin"); if ((plugin != null) && (plugin.Instance is IArchitectureDetail)) { this.ArchitectureDetailPlugin = plugin.Instance as IArchitectureDetail; this.ArchitectureDetailPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); this.ArchitectureDetailPlugin.SetScreen(screen); screen.PluginList.Add(this.ArchitectureDetailPlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("FactionTechniquesPlugin"); if ((plugin != null) && (plugin.Instance is IFactionTechniques)) { this.FactionTechniquesPlugin = plugin.Instance as IFactionTechniques; this.FactionTechniquesPlugin.SetScreen(screen); this.FactionTechniquesPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); screen.PluginList.Add(this.FactionTechniquesPlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("TreasureDetailPlugin"); if ((plugin != null) && (plugin.Instance is ITreasureDetail)) { this.TreasureDetailPlugin = plugin.Instance as ITreasureDetail; this.TreasureDetailPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); this.TreasureDetailPlugin.SetScreen(screen); screen.PluginList.Add(this.TreasureDetailPlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("ConmentTextPlugin"); if ((plugin != null) && (plugin.Instance is IConmentText)) { this.ConmentTextPlugin = plugin.Instance as IConmentText; this.ConmentTextPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); screen.PluginList.Add(this.ConmentTextPlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("ArchitectureSurveyPlugin"); if ((plugin != null) && (plugin.Instance is IArchitectureSurvey)) { this.ArchitectureSurveyPlugin = plugin.Instance as IArchitectureSurvey; this.ArchitectureSurveyPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); screen.PluginList.Add(this.ArchitectureSurveyPlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("TroopSurveyPlugin"); if ((plugin != null) && (plugin.Instance is ITroopSurvey)) { this.TroopSurveyPlugin = plugin.Instance as ITroopSurvey; this.TroopSurveyPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); screen.PluginList.Add(this.TroopSurveyPlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("ContextMenuPlugin"); if ((plugin != null) && (plugin.Instance is IGameContextMenu)) { this.ContextMenuPlugin = plugin.Instance as IGameContextMenu; this.ContextMenuPlugin.SetScreen(screen); this.ContextMenuPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); this.ContextMenuPlugin.SetIHelp(this.HelpPlugin); screen.PluginList.Add(this.ContextMenuPlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("GameFramePlugin"); if ((plugin != null) && (plugin.Instance is IGameFrame)) { this.GameFramePlugin = plugin.Instance as IGameFrame; this.GameFramePlugin.SetScreen(screen); this.GameFramePlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); screen.PluginList.Add(this.GameFramePlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("ScreenBlindPlugin"); if ((plugin != null) && (plugin.Instance is IScreenBlind)) { this.ScreenBlindPlugin = plugin.Instance as IScreenBlind; this.ScreenBlindPlugin.SetScreen(screen); this.ScreenBlindPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); screen.PluginList.Add(this.ScreenBlindPlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("MapViewSelectorPlugin"); if ((plugin != null) && (plugin.Instance is IMapViewSelector)) { this.MapViewSelectorPlugin = plugin.Instance as IMapViewSelector; this.MapViewSelectorPlugin.SetScreen(screen); this.MapViewSelectorPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); this.MapViewSelectorPlugin.SetGameFrame(this.GameFramePlugin); screen.PluginList.Add(this.MapViewSelectorPlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("TabListPlugin"); if ((plugin != null) && (plugin.Instance is ITabList)) { this.TabListPlugin = plugin.Instance as ITabList; this.TabListPlugin.SetScreen(screen); this.TabListPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); this.TabListPlugin.SetPersonDetailDialog(this.PersonDetailPlugin); this.TabListPlugin.SetTroopDetailDialog(this.TroopDetailPlugin); this.TabListPlugin.SetArchitectureDetailDialog(this.ArchitectureDetailPlugin); this.TabListPlugin.SetFactionTechniquesDialog(this.FactionTechniquesPlugin); this.TabListPlugin.SetTreasureDetailDialog(this.TreasureDetailPlugin); this.TabListPlugin.SetGameFrame(this.GameFramePlugin); this.TabListPlugin.SetMapViewSelector(this.MapViewSelectorPlugin); screen.PluginList.Add(this.TabListPlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("OptionDialogPlugin"); if ((plugin != null) && (plugin.Instance is IOptionDialog)) { this.OptionDialogPlugin = plugin.Instance as IOptionDialog; this.OptionDialogPlugin.SetScreen(screen); this.OptionDialogPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); screen.PluginList.Add(this.OptionDialogPlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("SimpleTextDialogPlugin"); if ((plugin != null) && (plugin.Instance is ISimpleTextDialog)) { this.SimpleTextDialogPlugin = plugin.Instance as ISimpleTextDialog; this.SimpleTextDialogPlugin.SetScreen(screen); this.SimpleTextDialogPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); screen.PluginList.Add(this.SimpleTextDialogPlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("tupianwenziPlugin"); if ((plugin != null) && (plugin.Instance is Itupianwenzi)) { this.tupianwenziPlugin = plugin.Instance as Itupianwenzi; this.tupianwenziPlugin.SetScreen(screen); this.tupianwenziPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); this.tupianwenziPlugin.SetContextMenu(this.ContextMenuPlugin); screen.PluginList.Add(this.tupianwenziPlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("ConfirmationDialogPlugin"); if ((plugin != null) && (plugin.Instance is IConfirmationDialog)) { this.ConfirmationDialogPlugin = plugin.Instance as IConfirmationDialog; this.ConfirmationDialogPlugin.SetScreen(screen); this.ConfirmationDialogPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); screen.PluginList.Add(this.ConfirmationDialogPlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("ToolBarPlugin"); if ((plugin != null) && (plugin.Instance is IToolBar)) { this.ToolBarPlugin = plugin.Instance as IToolBar; this.ToolBarPlugin.SetScreen(screen); this.ToolBarPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); this.ToolBarPlugin.SetContextMenuPlugin(this.ContextMenuPlugin); screen.PluginList.Add(this.ToolBarPlugin.Instance as GameObject); } if (this.ToolBarPlugin != null) { plugin = Plugin.Plugins.AvailablePlugins.Find("DateRunnerPlugin"); if ((plugin != null) && (plugin.Instance is IDateRunner)) { this.DateRunnerPlugin = plugin.Instance as IDateRunner; this.DateRunnerPlugin.SetScreen(screen); this.DateRunnerPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); this.DateRunnerPlugin.SetGameDate(screen.Scenario.Date); this.ToolBarPlugin.AddTool(this.DateRunnerPlugin.ToolInstance); screen.PluginList.Add(this.DateRunnerPlugin.Instance as GameObject); } } if (this.ToolBarPlugin != null) { plugin = Plugin.Plugins.AvailablePlugins.Find("GameRecordPlugin"); if ((plugin != null) && (plugin.Instance is IGameRecord)) { this.GameRecordPlugin = plugin.Instance as IGameRecord; this.GameRecordPlugin.SetScreen(screen); this.GameRecordPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); this.ToolBarPlugin.AddTool(this.GameRecordPlugin.ToolInstance); screen.PluginList.Add(this.GameRecordPlugin.Instance as GameObject); } } if (this.ToolBarPlugin != null) { plugin = Plugin.Plugins.AvailablePlugins.Find("MapLayerPlugin"); if ((plugin != null) && (plugin.Instance is IMapLayer)) { this.MapLayerPlugin = plugin.Instance as IMapLayer; this.MapLayerPlugin.SetScreen(screen); this.MapLayerPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); this.ToolBarPlugin.AddTool(this.MapLayerPlugin.ToolInstance); screen.PluginList.Add(this.MapLayerPlugin.Instance as GameObject); } } if (this.ToolBarPlugin != null) { plugin = Plugin.Plugins.AvailablePlugins.Find("GameSystemPlugin"); if ((plugin != null) && (plugin.Instance is IGameSystem)) { this.GameSystemPlugin = plugin.Instance as IGameSystem; this.GameSystemPlugin.SetScreen(screen); this.GameSystemPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); this.GameSystemPlugin.SetOptionDialog(this.OptionDialogPlugin); this.ToolBarPlugin.AddTool(this.GameSystemPlugin.ToolInstance); screen.PluginList.Add(this.GameSystemPlugin.Instance as GameObject); } } if (this.ToolBarPlugin != null) { plugin = Plugin.Plugins.AvailablePlugins.Find("AirViewPlugin"); if ((plugin != null) && (plugin.Instance is IAirView)) { this.AirViewPlugin = plugin.Instance as IAirView; this.AirViewPlugin.SetScreen(screen); this.AirViewPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); this.ToolBarPlugin.AddTool(this.AirViewPlugin.ToolInstance); screen.PluginList.Add(this.AirViewPlugin.Instance as GameObject); } } plugin = Plugin.Plugins.AvailablePlugins.Find("PersonPortraitPlugin"); if ((plugin != null) && (plugin.Instance is IPersonPortrait)) { this.PersonPortraitPlugin = plugin.Instance as IPersonPortrait; this.PersonPortraitPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); screen.PluginList.Add(this.PersonPortraitPlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("PersonBubblePlugin"); if ((plugin != null) && (plugin.Instance is IPersonBubble)) { this.PersonBubblePlugin = plugin.Instance as IPersonBubble; this.PersonBubblePlugin.SetScreen(screen); this.PersonBubblePlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); screen.PluginList.Add(this.PersonBubblePlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("TroopTitlePlugin"); if ((plugin != null) && (plugin.Instance is ITroopTitle)) { this.TroopTitlePlugin = plugin.Instance as ITroopTitle; this.TroopTitlePlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); screen.PluginList.Add(this.TroopTitlePlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("RoutewayEditorPlugin"); if ((plugin != null) && (plugin.Instance is IRoutewayEditor)) { this.RoutewayEditorPlugin = plugin.Instance as IRoutewayEditor; this.RoutewayEditorPlugin.SetScreen(screen); this.RoutewayEditorPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); screen.PluginList.Add(this.RoutewayEditorPlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("NumberInputerPlugin"); if ((plugin != null) && (plugin.Instance is INumberInputer)) { this.NumberInputerPlugin = plugin.Instance as INumberInputer; this.NumberInputerPlugin.SetScreen(screen); this.NumberInputerPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); screen.PluginList.Add(this.NumberInputerPlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("TransportDialogPlugin"); if ((plugin != null) && (plugin.Instance is ITransportDialog)) { this.TransportDialogPlugin = plugin.Instance as ITransportDialog; this.TransportDialogPlugin.SetScreen(screen); this.TransportDialogPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); this.TransportDialogPlugin.SetGameFrame(this.GameFramePlugin); this.TransportDialogPlugin.SetTabList(this.TabListPlugin); this.TransportDialogPlugin.SetNumberInputer(this.NumberInputerPlugin); screen.PluginList.Add(this.TransportDialogPlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("CreateTroopPlugin"); if ((plugin != null) && (plugin.Instance is ICreateTroop)) { this.CreateTroopPlugin = plugin.Instance as ICreateTroop; this.CreateTroopPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); this.CreateTroopPlugin.SetScreen(screen); this.CreateTroopPlugin.SetGameFrame(this.GameFramePlugin); this.CreateTroopPlugin.SetTabList(this.TabListPlugin); this.CreateTroopPlugin.SetNumberInputer(this.NumberInputerPlugin); screen.PluginList.Add(this.CreateTroopPlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("MarshalSectionDialogPlugin"); if ((plugin != null) && (plugin.Instance is IMarshalSectionDialog)) { this.MarshalSectionDialogPlugin = plugin.Instance as IMarshalSectionDialog; this.MarshalSectionDialogPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); this.MarshalSectionDialogPlugin.SetScreen(screen); this.MarshalSectionDialogPlugin.SetGameFrame(this.GameFramePlugin); this.MarshalSectionDialogPlugin.SetTabList(this.TabListPlugin); screen.PluginList.Add(this.MarshalSectionDialogPlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("youcelanPlugin"); if ((plugin != null) && (plugin.Instance is Iyoucelan)) { this.youcelanPlugin = plugin.Instance as Iyoucelan; this.youcelanPlugin.SetScreen(screen); this.youcelanPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); this.youcelanPlugin.SetPersonDetailDialog(this.PersonDetailPlugin); this.youcelanPlugin.SetTroopDetailDialog(this.TroopDetailPlugin); this.youcelanPlugin.SetArchitectureDetailDialog(this.ArchitectureDetailPlugin); this.youcelanPlugin.SetFactionTechniquesDialog(this.FactionTechniquesPlugin); this.youcelanPlugin.SetTreasureDetailDialog(this.TreasureDetailPlugin); this.youcelanPlugin.SetGameFrame(this.GameFramePlugin); this.youcelanPlugin.SetMapViewSelector(this.MapViewSelectorPlugin); screen.PluginList.Add(this.youcelanPlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("BianduiLiebiaoChajian"); if ((plugin != null) && (plugin.Instance is IBianduiLiebiao)) { this.BianduiLiebiao = plugin.Instance as IBianduiLiebiao; this.BianduiLiebiao.SetScreen(screen); this.BianduiLiebiao.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); this.BianduiLiebiao.SetPersonDetailDialog(this.PersonDetailPlugin); this.BianduiLiebiao.SetTroopDetailDialog(this.TroopDetailPlugin); this.BianduiLiebiao.SetArchitectureDetailDialog(this.ArchitectureDetailPlugin); this.BianduiLiebiao.SetFactionTechniquesDialog(this.FactionTechniquesPlugin); this.BianduiLiebiao.SetTreasureDetailDialog(this.TreasureDetailPlugin); this.BianduiLiebiao.SetGameFrame(this.GameFramePlugin); this.BianduiLiebiao.SetMapViewSelector(this.MapViewSelectorPlugin); screen.PluginList.Add(this.BianduiLiebiao.Instance as GameObject); } }
private void AddButtonSet(IToolBar toolbar) { largeButton = AddLargeButton(1, 0, toolbar); toolbar.AddDivider(column: 1, rowSpan: 3); var smallButton = toolbar.AddButton(2, IconImage.SilkCut, "Cut", column: 2, row: 0, columnSpan: 3); toolbar.AddButton(3, IconImage.SilkPageCopy, "Copy", column: 2, row: 1, columnSpan: 3); toolbar.AddButton(4, IconImage.SilkClock, "Something", column: 2, row: 2, columnSpan: 3).IsEnabled = false; }
public ToolBar(Generator g) : base(g, typeof(IToolBar)) { inner = (IToolBar)Handler; items = new ToolbarItemCollection(this); }
public void TestSetup() { viewModel = new ToolBarViewModel(); ; toolbar = viewModel; }
public CommandToolBarItem(Command command, IToolBar parent) { _command = command; _parent = parent; }
public void Initialise(IApplication application) { application.ToolBars.Clear(); m_myDropDownMenu = application.MenuStrip.DropDownMenus.Add("RPG"); m_myDropDownMenu.Image = Properties.Resources.Sword_32; m_myMenuItem = application.MenuStrip.DropDownMenus["RPG"].SubItems.Add("Project Settings"); m_myMenuItem.Image = Properties.Resources.ProjectSettings_32; m_myMenuItem.EventHandler = ProjectSettings; m_myMenuItem = application.MenuStrip.DropDownMenus["RPG"].SubItems.Add("Place NPC"); m_myMenuItem.Image = Properties.Resources.NPC_32; m_myMenuItem.EventHandler = NPCAction; m_myMenuItem = application.MenuStrip.DropDownMenus["RPG"].SubItems.Add("Place Event"); m_myMenuItem.Image = Properties.Resources.Event_32; m_myMenuItem.EventHandler = EventAction; m_myMenuItem = application.MenuStrip.DropDownMenus["RPG"].SubItems.Add("Eraser"); m_myMenuItem.Image = Properties.Resources.Eraser_32; m_myMenuItem.EventHandler = EventAction; //m_myMenuItem = application.MenuStrip.DropDownMenus["RPG"].SubItems.Add("TileSheet Meta"); //m_myMenuItem.Image = Properties.Resources.TileSheetMeta_32; //m_myMenuItem.ToolBarButtonHandler = TileSheetsAction; m_myToolBar = application.ToolBars.Add("RPG ToolBar"); m_projectSettingsToolBarButton = m_myToolBar.Buttons.Add("projectSettingsButton", Properties.Resources.ProjectSettings_16); m_projectSettingsToolBarButton.ToolTipText = "Project Settings"; m_projectSettingsToolBarButton.EventHandler = ProjectSettings; m_npcToolBarButton = m_myToolBar.Buttons.Add("Button1", Properties.Resources.NPC_16); m_npcToolBarButton.ToolTipText = "Place NPC"; m_npcToolBarButton.EventHandler = NPCAction; m_eventToolBarButton = m_myToolBar.Buttons.Add("Button2", Properties.Resources.Event_16); m_eventToolBarButton.ToolTipText = "Place Event"; m_eventToolBarButton.EventHandler = EventAction; m_tilesheetToolBarButton = m_myToolBar.Buttons.Add("Button3", Properties.Resources.TileSheetMeta_16); m_tilesheetToolBarButton.ToolTipText = "TileSheets"; m_tilesheetToolBarButton.ToolBarButtonHandler = TileSheetsAction; m_eraserToolBarButton = m_myToolBar.Buttons.Add("eraserButton", Properties.Resources.Eraser_16); m_eraserToolBarButton.ToolTipText = "TileSheets"; m_eraserToolBarButton.ToolBarButtonHandler = EraserAction; // pass application map to plugin m_projectId = application.Editor.ProjectId; if (string.IsNullOrEmpty(m_projectId)) { m_projectId = Prompt.ShowDialog("Project Name", "New Project"); } // load map meta data //var map = application.Editor.Map; //m_dataStore = new BinaryDataStore($"{Settings.ProjectFilePath}{m_projectId}\\"); m_dataStore = new BinaryDataStore(); //m_mapMeta = m_dataStore.Load<MapMeta>($"{map.Id}.MapMeta"); //if (m_mapMeta == null) // m_mapMeta = new MapMeta(map); m_actorManager = new ActorManager($"../../../MonoGame/Content/charset/"); // add plugin events to application application.Editor.MouseDown = OnEditorMouseDown; application.Editor.DrawTile = OnDrawTile; application.Editor.LayerNew = OnLayerNew; application.Editor.LayerDelete = OnLayerDelete; application.Editor.LayerProperties = OnLayerProperties; application.Editor.Save = OnSave; application.Editor.Load = OnLoad; }
public void Remove(IToolBar toolBar) { ToolBarBridge toolBarBridge = (ToolBarBridge)toolBar; if (!m_toolBars.Contains(toolBarBridge)) throw new Exception( "Cannot remove a toolbar that is not in the tool strip container"); if (toolBar.ReadOnly) throw new Exception("Cannot remove a built-in toolbar"); ToolStrip toolStrip = toolBarBridge.ToolStrip; toolStrip.Parent.Controls.Remove(toolStrip); m_toolBars.Remove(toolBarBridge); }
private IButtonTool AddLargeButton(object id, int column, IToolBar toolbar = null) { if (toolbar == null) toolbar = ToolBar; return toolbar.AddButton( id, "/Images/Icon.Clipboard.png".ToImageSource().ToImage(), "Paste" + Environment.NewLine + "Something", Orientation.Vertical, column: column, rowSpan: 3); }