diff options
author | Vsevolod Kukol <sevoku@microsoft.com> | 2019-11-11 19:22:11 +0300 |
---|---|---|
committer | Vsevolod Kukol <sevoku@microsoft.com> | 2019-11-11 19:22:11 +0300 |
commit | d665c12a71f243fe92fde2dc672b7b08e77092a5 (patch) | |
tree | 22a96e18e504e7b8410cbc33c676dcce92a810c0 /main/src/addins/MonoDevelop.PackageManagement | |
parent | 13fdf7ffd699d2337c4b4cc8969403587015268a (diff) |
[NuGet] Make header labels accessible
Diffstat (limited to 'main/src/addins/MonoDevelop.PackageManagement')
2 files changed, 55 insertions, 4 deletions
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/ManagePackagesDialog.UI.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/ManagePackagesDialog.UI.cs index c47a39aaf4..56a610a238 100644 --- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/ManagePackagesDialog.UI.cs +++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/ManagePackagesDialog.UI.cs @@ -105,24 +105,33 @@ namespace MonoDevelop.PackageManagement browseLabel.Tag = browseLabel.Text; browseLabel.MinWidth = tabLabelMinWidth; browseLabel.MarginLeft = 10; + browseLabel.CanGetFocus = true; + browseLabel.Accessible.Role = Xwt.Accessibility.Role.Button; + topHBox.PackStart (browseLabel); installedLabel = new Label (); installedLabel.Text = GettextCatalog.GetString ("Installed"); installedLabel.Tag = installedLabel.Text; installedLabel.MinWidth = tabLabelMinWidth; + installedLabel.CanGetFocus = true; + installedLabel.Accessible.Role = Xwt.Accessibility.Role.Button; topHBox.PackStart (installedLabel); updatesLabel = new Label (); updatesLabel.Text = GettextCatalog.GetString ("Updates"); updatesLabel.Tag = updatesLabel.Text; updatesLabel.MinWidth = tabLabelMinWidth; + updatesLabel.CanGetFocus = true; + updatesLabel.Accessible.Role = Xwt.Accessibility.Role.Button; topHBox.PackStart (updatesLabel); consolidateLabel = new Label (); consolidateLabel.Text = GettextCatalog.GetString ("Consolidate"); consolidateLabel.Tag = consolidateLabel.Text; consolidateLabel.MinWidth = tabLabelMinWidth; + consolidateLabel.CanGetFocus = true; + consolidateLabel.Accessible.Role = Xwt.Accessibility.Role.Button; topHBox.PackStart (consolidateLabel); packageSearchEntry = new SearchTextEntry (); diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/ManagePackagesDialog.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/ManagePackagesDialog.cs index 603de55a95..a78b0b49d7 100644 --- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/ManagePackagesDialog.cs +++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/ManagePackagesDialog.cs @@ -106,9 +106,13 @@ namespace MonoDevelop.PackageManagement imageLoader.Loaded += ImageLoaded; browseLabel.ButtonPressed += BrowseLabelButtonPressed; + browseLabel.KeyPressed += BrowseLabelKeyPressed; installedLabel.ButtonPressed += InstalledLabelButtonPressed; + installedLabel.KeyPressed += InstalledLabelKeyPressed; updatesLabel.ButtonPressed += UpdatesLabelButtonPressed; + updatesLabel.KeyPressed += UpdatesLabelKeyPressed; consolidateLabel.ButtonPressed += ConsolidateLabelButtonPressed; + consolidateLabel.KeyPressed += ConsolidateLabelKeyPressed; } public bool ShowPreferencesForPackageSources { get; private set; } @@ -1097,30 +1101,68 @@ namespace MonoDevelop.PackageManagement } } - void BrowseLabelButtonPressed (object sender, ButtonEventArgs e) + void UpdatePackageResultsLabel (ManagePackagesPage page, Button label) + { + string text = (string)label.Tag; + if (page == viewModel.PageSelected) { + label.Markup = string.Format ("<b><u>{0}</u></b>", text); + } else { + label.Markup = text; + } + } + + void BrowseLabelButtonPressed (object sender, EventArgs e) { viewModel.PageSelected = ManagePackagesPage.Browse; OnPackageResultsPageSelected (); } - void InstalledLabelButtonPressed (object sender, ButtonEventArgs e) + void BrowseLabelKeyPressed (object sender, KeyEventArgs e) + { + if (e.Modifiers == ModifierKeys.None && (e.Key == Key.Return || e.Key == Key.Space || e.Key == Key.NumPadEnter)) { + BrowseLabelButtonPressed (sender, e); + } + } + + void InstalledLabelButtonPressed (object sender, EventArgs e) { viewModel.PageSelected = ManagePackagesPage.Installed; OnPackageResultsPageSelected (); } - void UpdatesLabelButtonPressed (object sender, ButtonEventArgs e) + void InstalledLabelKeyPressed (object sender, KeyEventArgs e) + { + if (e.Modifiers == ModifierKeys.None && (e.Key == Key.Return || e.Key == Key.Space || e.Key == Key.NumPadEnter)) { + InstalledLabelButtonPressed (sender, e); + } + } + + void UpdatesLabelButtonPressed (object sender, EventArgs e) { viewModel.PageSelected = ManagePackagesPage.Updates; OnPackageResultsPageSelected (); } - void ConsolidateLabelButtonPressed (object sender, ButtonEventArgs e) + void UpdatesLabelKeyPressed (object sender, KeyEventArgs e) + { + if (e.Modifiers == ModifierKeys.None && (e.Key == Key.Return || e.Key == Key.Space || e.Key == Key.NumPadEnter)) { + UpdatesLabelButtonPressed (sender, e); + } + } + + void ConsolidateLabelButtonPressed (object sender, EventArgs e) { viewModel.PageSelected = ManagePackagesPage.Consolidate; OnPackageResultsPageSelected (); } + void ConsolidateLabelKeyPressed (object sender, KeyEventArgs e) + { + if (e.Modifiers == ModifierKeys.None && (e.Key == Key.Return || e.Key == Key.Space || e.Key == Key.NumPadEnter)) { + ConsolidateLabelButtonPressed (sender, e); + } + } + void OnPackageResultsPageSelected () { UpdatePackageResultsPageLabels (); |