public RibbonTab(Ribbon ribbon, uint commandId) : base(ribbon, commandId) { AddPropertiesProvider(_keytipPropertiesProvider = new KeytipPropertiesProvider(ribbon, commandId)); AddPropertiesProvider(_labelPropertiesProvider = new LabelPropertiesProvider(ribbon, commandId)); AddPropertiesProvider(_tooltipPropertiesProvider = new TooltipPropertiesProvider(ribbon, commandId)); }
public override void Render(HtmlTextWriter output, Ribbon ribbon, Item button, CommandContext context) { string typeName = context.Parameters["type"]; if (!string.IsNullOrEmpty(typeName)) { Item scriptLibrary = Factory.GetDatabase("master") .GetItem("/sitecore/system/Modules/PowerShell/Script Library/Internal/List View/Ribbon/"+typeName); if (scriptLibrary != null) { foreach (Item scriptItem in scriptLibrary.Children) { if (!EvaluateRules(scriptItem["ShowRule"], context.CustomData as Item)) { continue; } RenderSmallButton(output, ribbon, Control.GetUniqueID("export"), Translate.Text(scriptItem.DisplayName), scriptItem["__Icon"], string.Empty, string.Format("listview:action(scriptDb={0},scriptID={1})", scriptItem.Database.Name, scriptItem.ID), EvaluateRules(scriptItem["EnableRule"], context.CustomData as Item), false); } } } }
public RibbonSplitButton(Ribbon ribbon, uint commandId) : base(ribbon, commandId) { AddPropertiesProvider(_enabledPropertiesProvider = new EnabledPropertiesProvider(ribbon, commandId)); AddPropertiesProvider(_keytipPropertiesProvider = new KeytipPropertiesProvider(ribbon, commandId)); AddPropertiesProvider(_tooltipPropertiesProvider = new TooltipPropertiesProvider(ribbon, commandId)); }
public override void Render(HtmlTextWriter output, Ribbon ribbon, Item button, CommandContext context) { var psButtons = button.GetChildren(); foreach (Item psButton in psButtons) { var msg = Message.Parse(this, psButton["Click"]); var scriptDb = msg.Arguments["scriptDB"]; var scriptId = msg.Arguments["script"]; if (string.IsNullOrWhiteSpace(scriptDb) || string.IsNullOrWhiteSpace(scriptId)) { continue; } var scriptItem = Factory.GetDatabase(scriptDb).GetItem(scriptId); if (scriptItem == null || !RulesUtils.EvaluateRules(scriptItem["ShowRule"], context.Items[0])) { continue; } RenderLargeButton(output, ribbon, Control.GetUniqueID("script"), Translate.Text(scriptItem.DisplayName), scriptItem["__Icon"], string.Empty, psButton["Click"], RulesUtils.EvaluateRules(scriptItem["EnableRule"], context.Items[0]), false, context); return; } }
public void Id_Should_Be_Composed_If_Parent_Is_Present() { var tab = new Tab("Tab2").With(() => _sut); var ribbon = new Ribbon("Ribbon3") .With(()=>tab); Assert.AreEqual("Ribbon3.Tab2.MyGroup", _sut.Id); }
public void Ribbon_Should_Be_Able_To_Store_Multiple_Contextual_Groups() { var ribbon = new Ribbon("MyRibbon"); ribbon.With(() => _sut); ribbon.With(() => ContextualGroup.Create("2nd")); Assert.AreEqual(2,ribbon._contextualGroups.Count); }
public void Render2(HtmlTextWriter output, Ribbon ribbon, Item button, CommandContext context) { Assert.ArgumentNotNull(output, "output"); Assert.ArgumentNotNull(ribbon, "ribbon"); Assert.ArgumentNotNull(button, "button"); Assert.ArgumentNotNull(context, "context"); var contextDb = context.Parameters["contextDB"]; var contextItemId = context.Parameters["contextItem"]; var currentSessionName = context.Parameters["currentSessionName"]; var contextItem = !string.IsNullOrEmpty(contextDb) && !string.IsNullOrEmpty(contextItemId) ? Factory.GetDatabase(contextDb).GetItem(contextItemId) : null; output.Write("<div class=\"iseRibbonContextPanel {0}\">", context.Parameters["ScriptRunning"] == "1" ? "disabled" : string.Empty); // timestamp added because Sitecore won't re-send it to browser it if content didn't change - so changing session to the same wouldn't close the dropdowns output.Write("<div class=\"scRibbonToolbarSmallButtons scRibbonContextLabels\" timestamp=\"{0}\">", DateTime.Now.ToString("O")); output.Write("<div class=\"iseRibbonContextPanelLabel\">"); output.Write(Translate.Text("Context")); output.Write("</div>"); output.Write("<div class=\"iseRibbonContextPanelLabel\">"); output.Write(Translate.Text("Session")); output.Write("</div>"); output.Write("</div>"); var contextButton = Factory.GetDatabase("core").GetItem("{C733DE04-FFA2-4DCB-8D18-18EB1CB898A3}"); var path = contextItem != null ? contextItem.GetProviderPath().EllipsisString(50) : "none"; var icon = contextItem != null ? contextItem.Appearance.Icon : contextButton.Appearance.Icon; RenderSmallGalleryButton(output, contextButton, context, ribbon, path, icon); var sessionButton = Factory.GetDatabase("core").GetItem("{0C784F54-2B46-4EE2-B0BA-72384125E123}"); RenderSmallGalleryButton(output, sessionButton, context, ribbon, currentSessionName, string.Empty); output.Write("</div>"); }
public RibbonOrbAdornerGlyph(BehaviorService behaviorService, RibbonDesigner designer, Ribbon ribbon) : base(new RibbonOrbAdornerGlyphBehavior()) { _behaviorService = behaviorService; _componentDesigner = designer; _ribbon = ribbon; }
/// <summary> /// TooltipPropertiesProvider ctor /// </summary> /// <param name="ribbon">parent ribbon</param> /// <param name="commandId">ribbon control command id</param> public TooltipPropertiesProvider(Ribbon ribbon, uint commandId) : base(ribbon, commandId) { // add supported properties _supportedProperties.Add(RibbonProperties.TooltipTitle); _supportedProperties.Add(RibbonProperties.TooltipDescription); }
public RibbonQuickAccessToolbarGlyph(BehaviorService behaviorService, RibbonDesigner designer, Ribbon ribbon) : base(new RibbonQuickAccessGlyphBehavior(designer, ribbon)) { _behaviorService = behaviorService; _componentDesigner = designer; _ribbon = ribbon; }
public override void Render(HtmlTextWriter output, Ribbon ribbon, Item button, CommandContext context) { var contextChunks = context.CustomData as List<Item>; if (contextChunks != null) { var chunk = contextChunks[0]; contextChunks.RemoveAt(0); var psButtons = chunk.Children; var contextItem = context.Items.Length > 0 ? context.Items[0] : null; var ruleContext = new RuleContext { Item = contextItem }; foreach (var parameter in context.Parameters.AllKeys) { ruleContext.Parameters[parameter] = context.Parameters[parameter]; } foreach (Item psButton in psButtons) { if (!RulesUtils.EvaluateRules(psButton["ShowRule"], ruleContext)) { continue; } RenderLargeButton(output, ribbon, Control.GetUniqueID("script"), Translate.Text(psButton.DisplayName), psButton["__Icon"], string.Empty, $"ise:runplugin(scriptDb={psButton.Database.Name},scriptId={psButton.ID})", context.Parameters["ScriptRunning"] == "0" && RulesUtils.EvaluateRules(psButton["EnableRule"], ruleContext), false, context); } } }
/// <summary> /// BaseRibbonControl ctor /// </summary> /// <param name="ribbon">parent ribbon</param> /// <param name="commandID">command id attached to this control</param> protected BaseRibbonControl(Ribbon ribbon, uint commandID) { _ribbon = ribbon; _commandID = commandID; ribbon.AddRibbonControl(this); }
/// <summary> /// The render. /// </summary> /// <param name="output"> /// The output. /// </param> /// <param name="ribbon"> /// The ribbon. /// </param> /// <param name="button"> /// The button. /// </param> /// <param name="context"> /// The context. /// </param> public override void Render(System.Web.UI.HtmlTextWriter output, Ribbon ribbon, Item button, CommandContext context) { Assert.ArgumentNotNull(output, "output"); Assert.ArgumentNotNull(ribbon, "ribbon"); Assert.ArgumentNotNull(button, "button"); Assert.ArgumentNotNull(context, "context"); if (!Settings.Analytics.Enabled) { return; } Item[] items = context.Items; if (items.Length != 1) { return; } ID clientDeviceId = WebEditUtil.GetClientDeviceId(); System.Collections.Generic.IEnumerable<RenderingDefinition> testingRenderings; if (Context.ClientPage.IsEvent) { string text = WebEditUtil.ConvertJSONLayoutToXML(WebUtil.GetFormValue("scLayout")); if (text == null) { return; } testingRenderings = GetTestingRenderings(LayoutDefinition.Parse(text), clientDeviceId, Client.ContentDatabase); } else { Item item = items[0]; testingRenderings = GetTestingRenderings(item, clientDeviceId); } output.Write("<div id=\"ComponentsPanelListHolder\" class=\"scRibbonGallery\">"); output.Write("<div id=\"ComponentsPanelList\" class=\"scRibbonGalleryList\" style=\"width: 310px;\">"); int num = 0; foreach (RenderingDefinition current in testingRenderings) { output.Write("<div style=\"display:\"block\">"); this.RenderComponent(output, current, num,context); num++; output.Write("</div>"); } output.Write("</div>"); int val = 500; int val2 = 350; int num2 = 100; int num3 = num * num2 + 80; num3 = System.Math.Max(System.Math.Min(val, num3), val2); int num4 = 116; int num5 = 24; int num6 = 30; int num7 = num6 + num4 * System.Math.Min(num, 3) + num5; string click = (num == 0) ? "javascript:void(0);" : "javascript:return scShowComponentsGallery(this, event, 'Gallery.Components', {{height: {0}, width: {1} }}, {{}});".FormatWith(new object[] { num7, num3 }); base.RenderPanelButtons(output, "ComponentsPanelList", click); output.Write("</div>"); }
public override void Render(HtmlTextWriter output, Ribbon ribbon, Item button, CommandContext context) { var typeName = context.Parameters["type"]; var viewName = context.Parameters["viewName"]; var ruleContext = new RuleContext { Item = context.CustomData as Item }; ruleContext.Parameters["ViewName"] = viewName; if (context.Parameters["features"].Contains(HideListViewFeatures.AllExport.ToString())) { return; } bool hideNonSpecific = context.Parameters["features"].Contains(HideListViewFeatures.NonSpecificExport.ToString()); foreach ( Item scriptItem in ModuleManager.GetFeatureRoots(IntegrationPoints.ListViewExportFeature) .SelectMany(parent => parent.Children) .Where(scriptItem => RulesUtils.EvaluateRules(scriptItem["ShowRule"], ruleContext, hideNonSpecific))) { RenderSmallButton(output, ribbon, Control.GetUniqueID("export"), Translate.Text(scriptItem.DisplayName), scriptItem["__Icon"], string.Empty, string.Format("export:results(scriptDb={0},scriptID={1})", scriptItem.Database.Name, scriptItem.ID), RulesUtils.EvaluateRules(scriptItem["EnableRule"], context.CustomData as Item) && context.Parameters["ScriptRunning"] == "0", false); } }
public override void Render(HtmlTextWriter output, Ribbon ribbon, Item button, CommandContext context) { var typeName = context.Parameters["type"]; var viewName = context.Parameters["viewName"]; var ruleContext = new RuleContext { Item = context.CustomData as Item }; ruleContext.Parameters["ViewName"] = viewName; if (!string.IsNullOrEmpty(typeName)) { foreach ( Item scriptItem in ModuleManager.GetFeatureRoots(IntegrationPoints.ListViewRibbonFeature) .Select(parent => parent.Paths.GetSubItem(typeName)) .Where(scriptLibrary => scriptLibrary != null) .SelectMany(scriptLibrary => scriptLibrary.Children, (scriptLibrary, scriptItem) => new {scriptLibrary, scriptItem}) .Where( @t => RulesUtils.EvaluateRules(@t.scriptItem["ShowRule"], ruleContext) ) .Select(@t => @t.scriptItem)) { RenderSmallButton(output, ribbon, Control.GetUniqueID("export"), Translate.Text(scriptItem.DisplayName), scriptItem["__Icon"], string.Empty, string.Format("listview:action(scriptDb={0},scriptID={1})", scriptItem.Database.Name, scriptItem.ID), RulesUtils.EvaluateRules(scriptItem["EnableRule"], ruleContext) && context.Parameters["ScriptRunning"] == "0", false); } } }
//************************************************************************* // Constructor: AutomateTasksDialog() // /// <summary> /// Initializes a new instance of the <see cref="AutomateTasksDialog" /> /// class. /// </summary> /// /// <param name="thisWorkbook"> /// Workbook containing the graph contents. /// </param> /// /// <param name="ribbon"> /// The application's Ribbon. /// </param> //************************************************************************* public AutomateTasksDialog( ThisWorkbook thisWorkbook, Ribbon ribbon ) { Debug.Assert(thisWorkbook != null); Debug.Assert(ribbon != null); m_oAutomateTasksUserSettings = new AutomateTasksUserSettings(); m_oThisWorkbook = thisWorkbook; m_oRibbon = ribbon; InitializeComponent(); // Instantiate an object that saves and retrieves the user settings for // this dialog. Note that the object automatically saves the settings // when the form closes. m_oAutomateTasksDialogUserSettings = new AutomateTasksDialogUserSettings(this); DoDataExchange(false); AssertValid(); }
/// <summary> /// Creates a new Sensor for specified objects /// </summary> /// <param name="control">Control to listen mouse events</param> /// <param name="ribbon">Ribbon that will be affected</param> /// <param name="tabs">Tabs that will be sensed</param> /// <param name="panels">Panels that will be sensed</param> /// <param name="items">Items that will be sensed</param> public RibbonMouseSensor(Control control, Ribbon ribbon, IEnumerable<RibbonTab> tabs, IEnumerable<RibbonPanel> panels, IEnumerable<RibbonItem> items) : this(control, ribbon) { if (tabs != null) Tabs.AddRange(tabs); if (panels != null) Panels.AddRange(panels); if (items != null) Items.AddRange(items); }
public RibbonTabGroup(Ribbon ribbon, uint commandId) : base(ribbon, commandId) { AddPropertiesProvider(_contextAvailablePropertiesProvider = new ContextAvailablePropertiesProvider(ribbon, commandId)); AddPropertiesProvider(_keytipPropertiesProvider = new KeytipPropertiesProvider(ribbon, commandId)); AddPropertiesProvider(_labelPropertiesProvider = new LabelPropertiesProvider(ribbon, commandId)); AddPropertiesProvider(_tooltipPropertiesProvider = new TooltipPropertiesProvider(ribbon, commandId)); }
public RibbonTabGlyph(BehaviorService behaviorService, RibbonDesigner designer, Ribbon ribbon) : base(new RibbonTabGlyphBehavior(designer, ribbon)) { _behaviorService = behaviorService; _componentDesigner = designer; _ribbon = ribbon; size = new Size(60, 16); }
public RibbonRecentItems(Ribbon ribbon, uint commandId) : base(ribbon, commandId) { AddPropertiesProvider(_recentItemsPropertiesProvider= new RecentItemsPropertiesProvider(ribbon, commandId)); AddPropertiesProvider(_keytipPropertiesProvider = new KeytipPropertiesProvider(ribbon, commandId)); AddEventsProvider(_executeEventsProvider = new ExecuteEventsProvider(this)); }
public LoginForm(string url, Ribbon _parent, bool login) { InitializeComponent(); parent = _parent; _login = login; webBrowser1.Navigated += webBrowser1_Navigated; webBrowser1.Url = new Uri(url, UriKind.Absolute); }
public RibbonMenuGroup(Ribbon ribbon, uint commandId) : base(ribbon, commandId) { AddPropertiesProvider(_enabledPropertiesProvider = new EnabledPropertiesProvider(ribbon, commandId)); AddPropertiesProvider(_keytipPropertiesProvider = new KeytipPropertiesProvider(ribbon, commandId)); AddPropertiesProvider(_labelPropertiesProvider = new LabelPropertiesProvider(ribbon, commandId)); AddPropertiesProvider(_tooltipPropertiesProvider = new TooltipPropertiesProvider(ribbon, commandId)); }
/// <summary> /// ImagePropertiesProvider ctor /// </summary> /// <param name="ribbon">parent ribbon</param> /// <param name="commandId">ribbon control command id</param> public ImagePropertiesProvider(Ribbon ribbon, uint commandId) : base(ribbon, commandId) { // add supported properties _supportedProperties.Add(RibbonProperties.LargeImage); _supportedProperties.Add(RibbonProperties.SmallImage); _supportedProperties.Add(RibbonProperties.LargeHighContrastImage); _supportedProperties.Add(RibbonProperties.SmallHighContrastImage); }
public RibbonHelpButton(Ribbon ribbon, uint commandId) : base(ribbon, commandId) { AddPropertiesProvider(_keytipPropertiesProvider = new KeytipPropertiesProvider(ribbon, commandId)); AddPropertiesProvider(_labelPropertiesProvider = new LabelPropertiesProvider(ribbon, commandId)); AddPropertiesProvider(_tooltipPropertiesProvider = new TooltipPropertiesProvider(ribbon, commandId)); AddEventsProvider(_executeEventsProvider = new ExecuteEventsProvider(this)); }
public override void Render(HtmlTextWriter output, Ribbon ribbon, Item button, CommandContext context) { if (Current.Context.ReportItem == null) return; foreach (var command in Current.Context.ReportItem.Commands) { var click = string.Concat("ASRMainFormCommand:", command.Name); var id = Sitecore.Web.UI.HtmlControls.Control.GetUniqueID("action"); RenderSmallButton(output,ribbon,id,Translate.Text(command.Title),command.Icon,string.Empty,click,true,false); } }
public void Id_Should_Be_Compsited_If_Parent_Is_Present() { var group = new Group("ActionGroup1"); var tab = new Tab("CommonTab"); var ribbon = new Ribbon("MyRibbon"); ribbon.With(() => tab .With(() => group .With(() => _sut))); Assert.AreEqual("MyRibbon.CommonTab.ActionGroup1.MyLabel", _sut.Id); }
public RibbonDropDownButton(Ribbon ribbon, uint commandId) : base(ribbon, commandId) { AddPropertiesProvider(_enabledPropertiesProvider = new EnabledPropertiesProvider(ribbon, commandId)); AddPropertiesProvider(_keytipPropertiesProvider = new KeytipPropertiesProvider(ribbon, commandId)); AddPropertiesProvider(_labelPropertiesProvider = new LabelPropertiesProvider(ribbon, commandId)); AddPropertiesProvider(_labelDescriptionPropertiesProvider = new LabelDescriptionPropertiesProvider(ribbon, commandId)); AddPropertiesProvider(_imagePropertiesProvider = new ImagePropertiesProvider(ribbon, commandId)); AddPropertiesProvider(_tooltipPropertiesProvider = new TooltipPropertiesProvider(ribbon, commandId)); }
public RibbonCanvasEventArgs( Ribbon owner, Graphics g, Rectangle bounds, Control canvas, object relatedObject ) { Owner = owner; Graphics = g; Bounds = bounds; Canvas = canvas; RelatedObject = relatedObject; }
public RibbonFontControl(Ribbon ribbon, uint commandId) : base(ribbon, commandId) { AddPropertiesProvider(_fontControlPropertiesProvider = new FontControlPropertiesProvider(ribbon, commandId)); AddPropertiesProvider(_enabledPropertiesProvider = new EnabledPropertiesProvider(ribbon, commandId)); AddPropertiesProvider(_keytipPropertiesProvider = new KeytipPropertiesProvider(ribbon, commandId)); AddEventsProvider(_executeEventsProvider = new ExecuteEventsProvider(this)); AddEventsProvider(_previewEventsProvider = new PreviewEventsProvider(this)); }
/// <summary> /// GalleryPropertiesProvider ctor /// </summary> /// <param name="ribbon">parent ribbon</param> /// <param name="commandId">ribbon control command id</param> public GalleryPropertiesProvider(Ribbon ribbon, uint commandId, object sender) : base(ribbon, commandId) { _sender = sender; // add supported properties _supportedProperties.Add(RibbonProperties.Categories); _supportedProperties.Add(RibbonProperties.ItemsSource); _supportedProperties.Add(RibbonProperties.SelectedItem); }
public void Undo() { Ribbon.Undo(); }
public void FindPrev() { Ribbon.FindPrevNow(); }
/// <summary> /// Initializes a new instance of the Ribbon QuickAccessToolbar (QAT) /// </summary> /// <param name="ribbon">Parent Ribbon control</param> /// <param name="commandId">Command id attached to this control</param> public RibbonQuickAccessToolbar(Ribbon ribbon, uint commandId) : base(ribbon, commandId) { _ribbon = ribbon; _commandID = commandId; }
/// <summary> /// Initializes a new instance of the Ribbon QuickAccessToolbar (QAT) /// </summary> /// <param name="ribbon">Parent Ribbon control</param> /// <param name="commandId">Command id attached to this control</param> /// <param name="customizeCommandId">Customize Command id attached to this control</param> public RibbonQuickAccessToolbar(Ribbon ribbon, uint commandId, uint customizeCommandId) : this(ribbon, commandId) { _customizeButton = new RibbonButton(_ribbon, customizeCommandId); }
public void SaveCurrentDocument() { Ribbon.Save(); }
// gets an item by ID internal RibbonItem GetItemByID(string id) { return((RibbonItem)Ribbon.GetItemByID(id)); }
public RibbonButtonRenderEventArgs(Ribbon owner, Graphics g, Rectangle clip, RibbonButton button) : base(owner, g, clip) { Button = button; }
/// <summary> /// Initializes a new instance of the <see cref="RibbonService" /> class. /// </summary> /// <param name="layoutDocumentPane">The layout document pane.</param> /// <param name="dispatcherService">The dispatcher service.</param> /// <param name="ribbon">The ribbon.</param> /// <exception cref="ArgumentNullException">The <paramref name="layoutDocumentPane"/> is <c>null</c>.</exception> /// <exception cref="ArgumentNullException">The <paramref name="dispatcherService"/> is <c>null</c>.</exception> /// <exception cref="ArgumentNullException">The <paramref name="ribbon"/> is <c>null</c>.</exception> public RibbonService(LayoutDocumentPane layoutDocumentPane, IDispatcherService dispatcherService, Ribbon ribbon) { Argument.IsNotNull("layoutDocumentPane", layoutDocumentPane); Argument.IsNotNull("dispatcherService", dispatcherService); Argument.IsNotNull("ribbon", ribbon); _layoutDocumentPane = layoutDocumentPane; _dispatcherService = dispatcherService; _ribbon = ribbon; _layoutDocumentPane.PropertyChanged += OnLayoutDocumentPanePropertyChange; _ribbon.Loaded += OnRibbonLoaded; }
public void SwapDelimiters() { Ribbon.SwapDelimiters(); }
/// <summary> /// Shows the <see cref="Backstage"/> /// </summary> protected virtual bool Show() { // don't open the backstage while in design mode if (DesignerProperties.GetIsInDesignMode(this)) { return(false); } if (this.IsLoaded == false) { this.Loaded += this.OnDelayedShow; return(false); } if (this.Content == null) { return(false); } this.CreateAndAttachBackstageAdorner(); this.ShowAdorner(); this.parentRibbon = GetParentRibbon(this); if (this.parentRibbon != null) { if (this.parentRibbon.TabControl != null) { this.parentRibbon.TabControl.IsDropDownOpen = false; this.parentRibbon.TabControl.HighlightSelectedItem = false; this.parentRibbon.TabControl.RequestBackstageClose += this.HandleTabControlRequestBackstageClose; } if (this.parentRibbon.QuickAccessToolBar != null) { this.parentRibbon.QuickAccessToolBar.IsEnabled = false; } if (this.parentRibbon.TitleBar != null) { this.parentRibbon.TitleBar.HideContextTabs = this.HideContextTabsOnOpen; } } this.ownerWindow = Window.GetWindow(this); if (this.ownerWindow == null && this.Parent != null) { this.ownerWindow = Window.GetWindow(this.Parent); } this.SaveWindowSize(this.ownerWindow); this.SaveWindowMinSize(this.ownerWindow); if (this.ownerWindow != null) { this.ownerWindow.KeyDown += this.HandleOwnerWindowKeyDown; if (this.savedWindowMinWidth < 500) { this.ownerWindow.MinWidth = 500; } if (this.savedWindowMinHeight < 400) { this.ownerWindow.MinHeight = 400; } this.ownerWindow.SizeChanged += this.HandleOwnerWindowSizeChanged; // We have to collapse WindowsFormsHost while Backstage is open this.CollapseWindowsFormsHosts(this.ownerWindow); } var content = this.Content as IInputElement; content?.Focus(); return(true); }
public void FormatQueryAlternate() { Ribbon.FormatQueryAlternate(); }
/// <summary> /// Sets the ribbon property /// </summary> /// <param name="obj">>Specifies the dependency object.</param> /// <param name="value">Specifies the ribbon value.</param> public static void SetRibbon(DependencyObject obj, Ribbon value) { obj.SetValue(RibbonProperty, value); }
/// <summary> /// StringValuePropertiesProvider ctor /// </summary> /// <param name="ribbon">parent ribbon</param> /// <param name="commandId">ribbon control command id</param> public StringValuePropertiesProvider(Ribbon ribbon, uint commandId) : base(ribbon, commandId) { // add supported properties _supportedProperties.Add(RibbonProperties.StringValue); }
AutomateThisWorkbook ( ThisWorkbook thisWorkbook, AutomationTasks tasksToRun, Ribbon ribbon ) { Debug.Assert(thisWorkbook != null); Debug.Assert(ribbon != null); Microsoft.Office.Interop.Excel.Workbook oWorkbook = thisWorkbook.InnerObject; if ((tasksToRun & AutomationTasks.MergeDuplicateEdges) != 0) { // In general, automation is best performed by simulating a click // of a Ribbon button, thus avoiding any duplicate code. if (!ribbon.OnMergeDuplicateEdgesClick(false)) { return; } } if ((tasksToRun & AutomationTasks.CalculateGraphMetrics) != 0) { // In this case, clicking the corresponding Ribbon button opens a // GraphMetricsDialog, which allows the user to edit the graph // metric settings before calculating the graph metrics. The // actual calculations are done by CalculateGraphMetricsDialog, so // just use that dialog directly. CalculateGraphMetricsDialog oCalculateGraphMetricsDialog = new CalculateGraphMetricsDialog(oWorkbook, new GraphMetricUserSettings()); if (oCalculateGraphMetricsDialog.ShowDialog() != DialogResult.OK) { return; } } if ((tasksToRun & AutomationTasks.AutoFillWorkbook) != 0) { // In this case, clicking the corresponding Ribbon button opens an // AutoFillWorkbookDialog, which allows the user to edit the // autofill settings before autofilling the workbook. The actual // autofilling is done by WorkbookAutoFiller, so just use that // class directly. try { WorkbookAutoFiller.AutoFillWorkbook( oWorkbook, new AutoFillUserSettings(oWorkbook)); ribbon.OnWorkbookAutoFilled(false); } catch (Exception oException) { ErrorUtil.OnException(oException); return; } } if ((tasksToRun & AutomationTasks.CreateSubgraphImages) != 0) { ribbon.OnCreateSubgraphImagesClick( CreateSubgraphImagesDialog.DialogMode.Automate); } if ((tasksToRun & AutomationTasks.CalculateClusters) != 0) { if (!ribbon.OnCalculateClustersClick()) { return; } } if ((tasksToRun & AutomationTasks.ReadWorkbook) != 0) { // If the vertex X and Y columns were autofilled, the layout type // was set to LayoutType.Null. This will cause // TaskPane.ReadWorkbook() to display a warning. Temporarily turn // the warning off. NotificationUserSettings oNotificationUserSettings = new NotificationUserSettings(); Boolean bOldLayoutTypeIsNull = oNotificationUserSettings.LayoutTypeIsNull; oNotificationUserSettings.LayoutTypeIsNull = false; oNotificationUserSettings.Save(); if ((tasksToRun & AutomationTasks.SaveGraphImageFile) != 0) { if (String.IsNullOrEmpty(thisWorkbook.Path)) { throw new InvalidOperationException( WorkbookNotSavedMessage); } // After the workbook is read and the graph is laid out, save // an image of the graph to a file. GraphLaidOutEventHandler oGraphLaidOutEventHandler = null; oGraphLaidOutEventHandler = delegate(Object sender, GraphLaidOutEventArgs e) { // This delegate remains forever, even when the dialog // class is destroyed. Prevent it from being called again. thisWorkbook.GraphLaidOut -= oGraphLaidOutEventHandler; SaveGraphImageFile(e.NodeXLControl, thisWorkbook.FullName); }; thisWorkbook.GraphLaidOut += oGraphLaidOutEventHandler; } ribbon.OnReadWorkbookClick(); oNotificationUserSettings.LayoutTypeIsNull = bOldLayoutTypeIsNull; oNotificationUserSettings.Save(); } }
/// <summary> /// ContextAvailablePropertiesProvider ctor /// </summary> /// <param name="ribbon">parent ribbon</param> /// <param name="commandId">ribbon control command id</param> public ContextAvailablePropertiesProvider(Ribbon ribbon, uint commandId) : base(ribbon, commandId) { // add supported properties _supportedProperties.Add(RibbonProperties.ContextAvailable); }
private void OnRibbonPaletteChanged(object sender, EventArgs e) { _textBox.Palette = Ribbon.GetResolvedPalette(); }
public void Record(Ribbon ribbon, ProtoCrewMember kerbal) { Achievement achievement = ribbon.GetAchievement(); hallOfFame.Record(kerbal, ribbon); }
/// <summary> /// KeytipPropertiesProvider ctor /// </summary> /// <param name="ribbon">parent ribbon</param> /// <param name="commandId">ribbon control command id</param> public KeytipPropertiesProvider(Ribbon ribbon, uint commandId) : base(ribbon, commandId) { // add supported properties _supportedProperties.Add(RibbonProperties.Keytip); }
/// <summary> /// RibbonToolTip custom placement logic /// </summary> /// <param name="popupSize">The size of the popup.</param> /// <param name="targetSize">The size of the placement target.</param> /// <param name="offset">The Point computed from the HorizontalOffset and VerticalOffset property values.</param> /// <returns>An array of possible tooltip placements.</returns> private CustomPopupPlacement[] PlaceRibbonToolTip(Size popupSize, Size targetSize, Point offset) { UIElement placementTarget = this.PlacementTarget; double belowOffsetY = 0.0; double aboveOffsetY = 0.0; double offsetX = FlowDirection == FlowDirection.LeftToRight ? 0.0 : -popupSize.Width; if (IsPlacementTargetInRibbonGroup) { // If the PlacementTarget is within a RibbonGroup we proceed // with the custom placement policy. // Walk up the visual tree from PlacementTarget to find the Ribbon // if exists or the root element which is likely a PopupRoot. Ribbon ribbon = null; DependencyObject rootElement = null; DependencyObject element = placementTarget; while (element != null) { ribbon = element as Ribbon; if (ribbon != null) { break; } rootElement = element; element = VisualTreeHelper.GetParent(element); } double additionalOffset = 1.0; FrameworkElement referenceFE = null; if (ribbon != null) { additionalOffset = 0.0; referenceFE = ribbon; } else { if (rootElement != null) { referenceFE = rootElement as FrameworkElement; } } if (referenceFE != null) { // When RibbonControl (PlacementTarget) is within a collapsed group RibbonToolTip is // placed just below the Popup or just above the Popup (in case there is not enough // screen space left below the Popup). MatrixTransform transform = referenceFE.TransformToDescendant(placementTarget) as MatrixTransform; if (transform != null) { MatrixTransform deviceTransform = new MatrixTransform(RibbonHelper.GetTransformToDevice(referenceFE)); GeneralTransformGroup transformGroup = new GeneralTransformGroup(); transformGroup.Children.Add(transform); transformGroup.Children.Add(deviceTransform); Point leftTop, rightBottom; transformGroup.TryTransform(new Point(0, 0), out leftTop); transformGroup.TryTransform(new Point(referenceFE.ActualWidth, referenceFE.ActualHeight), out rightBottom); belowOffsetY = rightBottom.Y + additionalOffset; aboveOffsetY = leftTop.Y - popupSize.Height - additionalOffset; } } } else { // If PlacementTarget isn't within a RibbonGroup we shouldn't have // gotten here in the first place. But now that we are we will make // the best attempt at emulating PlacementMode.Bottom. FrameworkElement placementTargetAsFE = placementTarget as FrameworkElement; if (placementTargetAsFE != null) { belowOffsetY = targetSize.Height; aboveOffsetY = -popupSize.Height; } } // This is the prefered placement, below the ribbon for controls within Ribbon or below the Popup for controls within Popup. CustomPopupPlacement placementPreffered = new CustomPopupPlacement(new Point(offsetX, belowOffsetY), PopupPrimaryAxis.Horizontal); // This is a fallback placement, if the tooltip will not fit below the ribbon or Popup, place it above the ribbon or Popup. CustomPopupPlacement placementFallback = new CustomPopupPlacement(new Point(offsetX, aboveOffsetY), PopupPrimaryAxis.Horizontal); return(new CustomPopupPlacement[] { placementPreffered, placementFallback }); }
/// <summary> /// Raises the DropDown event. /// </summary> /// <param name="finishDelegate">Delegate fired during event processing.</param> protected virtual void OnDropDown(EventHandler finishDelegate) { bool fireDelegate = true; if (!Ribbon.InDesignMode) { // Events only occur when enabled if (Enabled) { if ((ButtonType == GroupButtonType.DropDown) || (ButtonType == GroupButtonType.Split)) { if (KryptonContextMenu != null) { ContextMenuArgs contextArgs = new ContextMenuArgs(KryptonContextMenu); // Generate an event giving a chance for the krypton context menu strip to // be shown to be provided/modified or the action even to be cancelled if (DropDown != null) { DropDown(this, contextArgs); } // If user did not cancel and there is still a krypton context menu strip to show if (!contextArgs.Cancel && (contextArgs.KryptonContextMenu != null)) { Rectangle screenRect = Rectangle.Empty; // Convert the view for the button into screen coordinates if ((Ribbon != null) && (ClusterButtonView != null)) { screenRect = Ribbon.ViewRectangleToScreen(ClusterButtonView); } if (CommonHelper.ValidKryptonContextMenu(contextArgs.KryptonContextMenu)) { // Cache the finish delegate to call when the menu is closed _kcmFinishDelegate = finishDelegate; // Show at location we were provided, but need to convert to screen coordinates contextArgs.KryptonContextMenu.Closed += new ToolStripDropDownClosedEventHandler(OnKryptonContextMenuClosed); if (contextArgs.KryptonContextMenu.Show(this, new Point(screenRect.X, screenRect.Bottom + 1))) { fireDelegate = false; } } } } else if (ContextMenuStrip != null) { ContextMenuArgs contextArgs = new ContextMenuArgs(ContextMenuStrip); // Generate an event giving a chance for the context menu strip to be // shown to be provided/modified or the action even to be cancelled if (DropDown != null) { DropDown(this, contextArgs); } // If user did not cancel and there is still a context menu strip to show if (!contextArgs.Cancel && (contextArgs.ContextMenuStrip != null)) { Rectangle screenRect = Rectangle.Empty; // Convert the view for the button into screen coordinates if ((Ribbon != null) && (ClusterButtonView != null)) { screenRect = Ribbon.ViewRectangleToScreen(ClusterButtonView); } if (CommonHelper.ValidContextMenuStrip(contextArgs.ContextMenuStrip)) { // Do not fire the delegate in this routine, wait for the popup manager to show it fireDelegate = false; //...show the context menu below and at th left of the button VisualPopupManager.Singleton.ShowContextMenuStrip(contextArgs.ContextMenuStrip, new Point(screenRect.X, screenRect.Bottom + 1), finishDelegate); } } } } } } // Do we need to fire a delegate stating the click processing has finished? if (fireDelegate && (finishDelegate != null)) { finishDelegate(this, EventArgs.Empty); } }
public void RunQuery() { Ribbon.RunQuery(); }
public void GotoLine() { Ribbon.GotoLine(); }
private void OnRibbonPaletteChanged(object sender, EventArgs e) { _domainUpDown.Palette = Ribbon.GetResolvedPalette(); }
public void Find() { Ribbon.FindNow(); }
/// <summary> /// Method used to dispose the ribbon and richtext box control. /// </summary> public static void Dispose() { ribbon.Dispose(); ribbon = null; richTextBox = null; }
public void Redo() { Ribbon.Redo(); }
public RibbonPanelRenderEventArgs(Ribbon owner, Graphics g, Rectangle clip, RibbonPanel panel, Control canvas) : base(owner, g, clip) { Panel = panel; Canvas = canvas; }
/// <summary> /// Method used to access the ribbon control. /// </summary> /// <param name="obj">Specifies the dependency object.</param> /// <param name="args">Specifies the dependency property changes event args.</param> public static void OnRibbonChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args) { ribbon = obj as Ribbon; }
public void FormatQueryStandard() { Ribbon.FormatQueryStandard(); }
/// <summary> /// EnabledPropertiesProvider ctor /// </summary> /// <param name="ribbon">parent ribbon</param> /// <param name="commandId">ribbon control command id</param> public EnabledPropertiesProvider(Ribbon ribbon, uint commandId) : base(ribbon, commandId) { // add supported properties _supportedProperties.Add(RibbonProperties.Enabled); }