public ToolButton(IExTool tool) { this.Tool = tool; base.Header = LocalizedResources.GetResString(tool.Name, tool.Name); base.Icon = base.LargeIcon = ImageFactory.FromBitmap(tool.Image as global::System.Drawing.Image); }
public PdfLinkButton(System.IO.FileInfo pdf) { this.PdfFile = pdf; base.Header = pdf.Name.Substring(0, pdf.Name.Length - pdf.Extension.Length); base.Icon = base.LargeIcon = ImageFactory.FromBitmap(global::gView.Desktop.Wpf.Carto.Properties.Resources.pdf); base.Click += new RoutedEventHandler(PdfLinkButton_Click); }
public OptionsButton(IExplorerOptionPage page) { this.ExplorerOptionPage = page; base.Header = page.Title; base.Icon = base.LargeIcon = ImageFactory.FromBitmap( page.Image == null ? global::gView.Win.DataExplorer.Properties.Resources.options : page.Image as global::System.Drawing.Image ); }
public DropDownToolButtonItem(DropDownToolButton parent, ITool tool) { _parent = parent; _tool = tool; base.Icon = base.LargeIcon = ImageFactory.FromBitmap(tool.Image as System.Drawing.Image); base.Header = tool.Name; base.SizeDefinition = "Middle"; }
public OptionsButton(IMapOptionPage page) { this.MapOptionPage = page; base.Header = page.Title; base.Icon = base.LargeIcon = ImageFactory.FromBitmap( page.Image == null ? global::gView.Desktop.Wpf.Carto.Properties.Resources.options : page.Image as System.Drawing.Image ); }
public CreateNewToolStripItem(IExplorerObject exObject) : base() { _exObject = exObject; string name = String.IsNullOrEmpty(_exObject.Name) ? _exObject.Type : _exObject.Name; base.Header = name; if (exObject.Icon != null) base.Icon = base.LargeIcon = ImageFactory.FromBitmap(exObject.Icon.Image); }
public WpfViewToolStripItem(string text, System.Drawing.Image image, IDockableWindow window) : base() { base.Header = text; if (image != null) { base.Icon = ImageFactory.FromBitmap(image); } _window = window; }
public ContextMenuButton(IContextMenuTool tool, IContextType contextType, IMapDocument mapDocument) { this.Tool = tool; _contextType = contextType; _doc = mapDocument; base.Header = LocalizedResources.GetResString(tool.Name, tool.Name); base.Icon = base.LargeIcon = ImageFactory.FromBitmap(tool.Image as global::System.Drawing.Image); base.Click += new RoutedEventHandler(ContextMenuButton_Click); }
public WpfFavoriteMenuItem(MyFavorites.Favorite fav) { _fav = fav; if (_fav != null) { base.Header = _fav.Name; if (fav.Image == null) base.Icon = ImageFactory.FromBitmap(global::gView.Desktop.Wpf.DataExplorer.Properties.Resources.folder_go); else base.Icon = ImageFactory.FromBitmap(fav.Image); } }
private void button_Click(object sender, EventArgs e) { if (!(sender is DropDownToolButtonItem)) { return; } _tool.SelectedTool = ((DropDownToolButtonItem)sender).Tool; base.Icon = base.LargeIcon = ImageFactory.FromBitmap(_tool.SelectedTool.Image as System.Drawing.Image); base.Header = _tool.SelectedTool.Name; this.OnClick(); }
public WpfToolMenuItem(IExTool tool) : base() { _tool = tool; base.Header = tool.Name; base.Icon = ImageFactory.FromBitmap((System.Drawing.Image)tool.Image); //if (_tool is IShortCut) //{ // base.ShortcutKeys = ((IShortCut)_tool).ShortcutKeys; // base.ShortcutKeyDisplayString = ((IShortCut)_tool).ShortcutKeyDisplayString; // base.ShowShortcutKeys = true; //} }
public ToolMenuItem(ITool tool) { _tool = tool; base.Icon = ImageFactory.FromBitmap(tool.Image as System.Drawing.Image); base.Header = tool.Name; /* * if (_tool is IShortCut) * { * base.ShortcutKeys = ((IShortCut)_tool).ShortcutKeys; * base.ShortcutKeyDisplayString = ((IShortCut)_tool).ShortcutKeyDisplayString; * base.ShowShortcutKeys = true; * } * */ }
public ToolButton(ITool tool) { this.Tool = tool; String toolName = !String.IsNullOrEmpty(tool.ToolTip) ? tool.ToolTip : LocalizedResources.GetResString(tool.Name, tool.Name); base.Header = toolName; base.Icon = base.LargeIcon = ImageFactory.FromBitmap(tool.Image as System.Drawing.Image); if (tool is IScreenTip) { base.ToolTip = new Fluent.ScreenTip() { Text = ((IScreenTip)tool).ScreenTip }; } }
public ContextMenuButton(IContextMenuTool tool, IContextType contextType, IMapDocument mapDocument) { this.Tool = tool; _contextType = contextType; _doc = mapDocument; base.Header = LocalizedResources.GetResString(tool.Name, tool.Name); base.Icon = base.LargeIcon = ImageFactory.FromBitmap(tool.Image as System.Drawing.Image); base.Click += new RoutedEventHandler(ContextMenuButton_Click); bool visible = false, enable = false; if (_contextType.ContextObject is IMap) { enable = tool.Enable(contextType.ContextObject); visible = tool.Visible(contextType.ContextObject); } else if (_contextType.ContextObject is ITOCElement && ((ITOCElement)_contextType.ContextObject).Layers != null) { ITOCElement tocElement = (ITOCElement)_contextType.ContextObject; foreach (var layer in tocElement.Layers) { if (visible == true && enable == true) { break; } if (!enable) { enable = tool.Enable(layer); } if (!visible) { visible = tool.Visible(layer); } } } base.IsEnabled = enable; base.Visibility = visible == false ? Visibility.Collapsed : Visibility.Visible; }
public ContextToolButton(ITool tool, object contextObject) { this.Tool = tool; String toolName = !String.IsNullOrEmpty(tool.ToolTip) ? tool.ToolTip : LocalizedResources.GetResString(tool.Name, tool.Name); base.Header = toolName; base.Icon = base.LargeIcon = ImageFactory.FromBitmap(tool.Image as System.Drawing.Image); if (tool is IScreenTip) { base.ToolTip = new Fluent.ScreenTip() { Text = ((IScreenTip)tool).ScreenTip }; } _contextObject = contextObject; this.Click += new RoutedEventHandler(ContextToolButton_Click); }
public DropDownToolButton(IExToolMenu tool) { _tool = tool; if (_tool == null || _tool.DropDownTools == null) { return; } if (_tool != null && _tool.SelectedTool != null) { base.Icon = base.LargeIcon = ImageFactory.FromBitmap(_tool.SelectedTool.Image as System.Drawing.Image); base.Header = _tool.SelectedTool.Name; } foreach (IExTool t in _tool.DropDownTools) { DropDownToolButtonItem item = new DropDownToolButtonItem(this, t); item.Click += new RoutedEventHandler(button_Click); base.Items.Add(item); } }
public void MakeRibbon() { PlugInManager pm = new PlugInManager(); foreach (IExplorerRibbonTab exRibbonTab in OrderedPluginList<IExplorerRibbonTab>.Sort(pm.GetPluginNodes(Plugins.Type.IExplorerRibbonTab))) { Fluent.RibbonTabItem tabItem = new Fluent.RibbonTabItem(); tabItem.Header = exRibbonTab.Header; ribbon.Tabs.Add(tabItem); tabItem.DataContext = exRibbonTab; foreach (RibbonGroupBox exGroupBox in exRibbonTab.Groups) { Fluent.RibbonGroupBox groupBox = new Fluent.RibbonGroupBox(); groupBox.Header = exGroupBox.Header; tabItem.Groups.Add(groupBox); foreach (RibbonItem cartoRibbonItem in exGroupBox.Items) { Guid toolGUID = cartoRibbonItem.Guid; if (toolGUID == new Guid("00000000-0000-0000-0000-000000000000")) { groupBox.Items.Add(new Separator()); continue; } object tool = pm.CreateInstance(toolGUID); if (tool == null) continue; #region IToolItem if (tool is IToolItem) { if (((IToolItem)tool).ToolItem != null) { if (((IToolItem)tool).ToolItem is System.Windows.Forms.ToolStripItem) { StackPanel panel = new StackPanel(); panel.Margin = new Thickness(0, 32, 0, 0); System.Windows.Forms.ToolStripItem stripItem = (System.Windows.Forms.ToolStripItem)((IToolItem)tool).ToolItem; System.Windows.Forms.MenuStrip bar = new System.Windows.Forms.MenuStrip(); bar.BackColor = System.Drawing.Color.Transparent; //.FromArgb(223, 234, 246); bar.Items.Add(stripItem); WindowsFormsHost host = new WindowsFormsHost(); host.Background = new SolidColorBrush(Color.FromRgb(223, 234, 246)); host.Child = bar; if (tool is IToolItemLabel) { IToolItemLabel label = (IToolItemLabel)tool; panel.Orientation = label.LabelPosition == ToolItemLabelPosition.top || label.LabelPosition == ToolItemLabelPosition.bottom ? Orientation.Vertical : Orientation.Horizontal; if (panel.Orientation == Orientation.Vertical) panel.Margin = new Thickness(0, 13, 0, 0); TextBlock text = new TextBlock(); text.Text = label.Label; text.Padding = new Thickness(3); if (label.LabelPosition == ToolItemLabelPosition.top || label.LabelPosition == ToolItemLabelPosition.left) panel.Children.Insert(0, text); else panel.Children.Add(text); } panel.Children.Add(host); groupBox.Items.Add(panel); } } } #endregion #region IToolMenu else if (tool is IExToolMenu) { DropDownToolButton button = new DropDownToolButton(tool as IExToolMenu); button.Click += new RoutedEventHandler(ToolButton_Click); groupBox.Items.Add(button); } #endregion #region ITool else if (tool is IExTool) { ((IExTool)tool).OnCreate(_application); ToolButton button = new ToolButton(tool as IExTool); button.SizeDefinition = cartoRibbonItem.SizeDefinition; groupBox.Items.Add(button); button.Click += new RoutedEventHandler(ToolButton_Click); } #endregion } } if (ribbon.Tabs.Count == 1) { #region Favorites Fluent.RibbonGroupBox favBox = new Fluent.RibbonGroupBox(); favBox.Header = String.Empty; _favDropDownButton = new Fluent.DropDownButton(); _favDropDownButton.Header = "Favorites"; _favDropDownButton.Icon = _favDropDownButton.LargeIcon = ImageFactory.FromBitmap(global::gView.Desktop.Wpf.DataExplorer.Properties.Resources.folder_heart); Fluent.MenuItem add2fav = new Fluent.MenuItem(); add2fav.Header = "Add to favorites..."; add2fav.Icon = ImageFactory.FromBitmap(global::gView.Desktop.Wpf.DataExplorer.Properties.Resources.folder_heart); add2fav.Click += new RoutedEventHandler(Add2Favorites_Click); _favDropDownButton.Items.Add(add2fav); bool first = true; foreach (MyFavorites.Favorite fav in (new MyFavorites().Favorites)) { if (fav == null) continue; WpfFavoriteMenuItem fItem = new WpfFavoriteMenuItem(fav); fItem.Click += new RoutedEventHandler(MenuItem_Favorite_Click); if (first) { first = false; _favDropDownButton.Items.Add(new Separator()); } _favDropDownButton.Items.Add(fItem); } favBox.Items.Add(_favDropDownButton); ribbon.Tabs[0].Groups.Add(favBox); #endregion _createNewRibbonGroupBox = new Fluent.RibbonGroupBox(); _createNewRibbonGroupBox.Header = "Create New"; _createNewRibbonGroupBox.Visibility = Visibility.Visible; _createNewRibbonGroupBox.Background = new SolidColorBrush(Colors.GreenYellow); ribbon.Tabs[0].Groups.Add(_createNewRibbonGroupBox); } } #region Options Fluent.RibbonTabItem optionsTab = new Fluent.RibbonTabItem() { Header = "Options" }; Fluent.RibbonGroupBox optionsBox = new Fluent.RibbonGroupBox() { Header = String.Empty }; optionsTab.Groups.Add(optionsBox); foreach (XmlNode pageNode in pm.GetPluginNodes(Plugins.Type.IExplorerOptionPage)) { IExplorerOptionPage page = pm.CreateInstance(pageNode) as IExplorerOptionPage; if (page == null) continue; OptionsButton button = new OptionsButton(page); button.Click += new RoutedEventHandler(OptoinButton_Click); optionsBox.Items.Add(button); } ribbon.Tabs.Add(optionsTab); #endregion }