public override bool ProcessMnemonicEx(char charCode) { // If different ribbon tab item is selected we should not exit the Alt mode... BaseItem item = null; if (m_CaptionVisible) { item = GetItemForMnemonic(m_StripContainer.CaptionContainer, charCode, false, true); if (item != null) { if (ProcessItemMnemonicKey(item)) { ReleaseAltFocus(); return true; } } } RibbonControl rc = this.GetRibbonControl(); if (rc != null && rc.QatPositionedBelowRibbon) { if (rc.QatToolbar.ProcessMnemonicEx(charCode)) { ReleaseAltFocus(); return true; } } if (item == null) { item = GetItemForMnemonic(this.GetBaseItemContainer(), charCode, true, true); } if (item is RibbonTabItem && item.Visible) { if (!m_AltFocus) { GiveKeyTipsAltFocus(); } this.ShowKeyTips = false; if (item != this.SelectedRibbonTabItem) { // Switch the tab item.RaiseClick(); //this.ShowKeyTips = true; } else if (this.SelectedRibbonTabItem != null && rc != null && !rc.Expanded && !rc.IsPopupMode) rc.RibbonTabItemClick(this.SelectedRibbonTabItem); if (this.SelectedRibbonTabItem != null && m_KeyTipsEnabled) { if (m_AltFocusedControl != null) m_AltFocusedControl.ShowKeyTips = false; m_AltFocusedControl = this.SelectedRibbonTabItem.Panel; if (m_AltFocusedControl != null) m_AltFocusedControl.ShowKeyTips = true; } // Keep the Alt focus return true; } else if (item != null && ProcessItemMnemonicKey(item)) { this.ShowKeyTips = false; if (item is ApplicationButton) { ApplicationButton appButton = (ApplicationButton)item; if (appButton.BackstageTab != null) { if (m_AltFocusedControl != null) m_AltFocusedControl.ShowKeyTips = false; m_AltFocusedControl = appButton.BackstageTab.TabStrip; if (!m_AltFocusedControl.ShowKeyTips) m_AltFocusedControl.ShowKeyTips = true; } } return true; } //if (base.ProcessMnemonicEx(charCode)) //{ // ReleaseAltFocus(); // return true; //} if (m_AltFocus && this.SelectedRibbonTabItem != null && this.SelectedRibbonTabItem.Panel != null) { Control panel = this.SelectedRibbonTabItem.Panel; foreach (Control c in panel.Controls) { if (c is RibbonBar && c.Visible) { if (IsMnemonic(charCode, c.Text)) { // Select RibbonBar for Alt+ Key access this.ShowKeyTips = false; ((RibbonBar)c).ShowKeyTips = true; if (m_AltFocusedControl != null) m_AltFocusedControl.ShowKeyTips = false; m_AltFocusedControl = (IKeyTipsControl)c; return true; } } } } return false; }
private void ReleaseAltFocus() { if (m_AltFocus) { ReleaseActiveWindowTimer(); if (!this.ShowKeyTips && m_AltFocusedControl != null) { m_AltFocusedControl.ShowKeyTips = false; m_AltFocusedControl = null; } this.ShowKeyTips = false; } m_AltFocus = false; }
private void ActivateKeyTips() { ApplicationButton appButton = GetApplicationButton() as ApplicationButton; if (appButton != null && appButton.BackstageTab != null && appButton.Expanded) { if (m_AltFocusedControl != null) m_AltFocusedControl.ShowKeyTips = false; m_AltFocusedControl = appButton.BackstageTab.TabStrip; if (!m_AltFocusedControl.ShowKeyTips) m_AltFocusedControl.ShowKeyTips = true; } else GiveKeyTipsAltFocus(); }
internal void BackstageTabClosed(SuperTabControl tabControl) { if (m_AltFocusedControl == tabControl || m_AltFocusedControl == tabControl.TabStrip) m_AltFocusedControl = null; }
/// <summary> /// Called when ShowKeyTips on RibbonBar contained by this Ribbon is set to true /// </summary> internal void OnRibbonBarShowKeyTips(RibbonBar bar) { if (!m_AltFocus) { m_AltFocus = true; } if (m_AltFocusedControl != bar.Parent && bar.Parent is RibbonPanel) { if (m_AltFocusedControl != null) m_AltFocusedControl.ShowKeyTips = false; m_AltFocusedControl = bar.Parent as IKeyTipsControl; if (m_AltFocusedControl != null) m_AltFocusedControl.ShowKeyTips = true; } }
public override bool ProcessMnemonicEx(char charCode) { // If different ribbon tab item is selected we should not exit the Alt mode... BaseItem item = null; if (_CaptionVisible) { item = GetItemForMnemonic(_StripContainer.CaptionContainer, charCode, false, true); if (item != null) { if (ProcessItemMnemonicKey(item)) { ReleaseAltFocus(); return true; } } } MetroShell rc = this.GetMetroTab(); if (item == null) { item = GetItemForMnemonic(this.GetBaseItemContainer(), charCode, true, true); } if (item is MetroTabItem && item.Visible) { if (!_AltFocus) { GiveKeyTipsAltFocus(); } this.ShowKeyTips = false; if (item != this.SelectedTab) { // Switch the tab item.RaiseClick(); //this.ShowKeyTips = true; } if (this.SelectedTab != null && _KeyTipsEnabled) { if (_AltFocusedControl != null) _AltFocusedControl.ShowKeyTips = false; _AltFocusedControl = this.SelectedTab.Panel; if (_AltFocusedControl != null) _AltFocusedControl.ShowKeyTips = true; } // Keep the Alt focus return true; } else if (item != null && ProcessItemMnemonicKey(item)) { this.ShowKeyTips = false; if (item is MetroAppButton) { MetroAppButton appButton = (MetroAppButton)item; if (appButton.BackstageTab != null) { if (_AltFocusedControl != null) _AltFocusedControl.ShowKeyTips = false; _AltFocusedControl = appButton.BackstageTab.TabStrip; if (!_AltFocusedControl.ShowKeyTips) _AltFocusedControl.ShowKeyTips = true; } } return true; } //if (base.ProcessMnemonicEx(charCode)) //{ // ReleaseAltFocus(); // return true; //} if (_AltFocus && this.SelectedTab != null && this.SelectedTab.Panel != null) { Control panel = this.SelectedTab.Panel; foreach (Control c in panel.Controls) { if (c is RibbonBar && c.Visible) { if (IsMnemonic(charCode, c.Text)) { // Select RibbonBar for Alt+ Key access this.ShowKeyTips = false; ((RibbonBar)c).ShowKeyTips = true; if (_AltFocusedControl != null) _AltFocusedControl.ShowKeyTips = false; _AltFocusedControl = (IKeyTipsControl)c; return true; } } } } return false; }