Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/xwt.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/Xwt
diff options
context:
space:
mode:
authorVsevolod Kukol <sevoku@microsoft.com>2020-02-10 11:49:49 +0300
committerVsevolod Kukol <sevoku@microsoft.com>2020-02-10 13:32:38 +0300
commit45635959b655587fa58ac77a61648879f8fa8ff7 (patch)
treef3a3e3040f12ff1d58f16e5bddd1772c80d06893 /Xwt
parent3e9f6584839fa70b0f82f8efb919ebcb1084cd98 (diff)
Fix default FileSelector.Accessible
Track FileSelector.Accessible.Label changes and set internal labels accordingly.
Diffstat (limited to 'Xwt')
-rw-r--r--Xwt/Xwt/FileSelector.cs34
-rw-r--r--Xwt/Xwt/FolderSelector.cs37
2 files changed, 61 insertions, 10 deletions
diff --git a/Xwt/Xwt/FileSelector.cs b/Xwt/Xwt/FileSelector.cs
index 2fa41322..ff028f5d 100644
--- a/Xwt/Xwt/FileSelector.cs
+++ b/Xwt/Xwt/FileSelector.cs
@@ -155,6 +155,7 @@ namespace Xwt
class DefaultFileSelectorBackend : XwtWidgetBackend, IFileSelectorBackend
{
TextEntry entry;
+ Button button;
FileDialog dialog;
FileDialogFilterCollection filters;
FileDialogFilter activeFilter;
@@ -172,16 +173,31 @@ namespace Xwt
box.Accessible.Title = Application.TranslationCatalog.GetString("File Selector");
entry = new TextEntry ();
- entry.Accessible.Label = Application.TranslationCatalog.GetString ("Path");
+ entry.Accessible.Title = Application.TranslationCatalog.GetString ("Path");
entry.Visible = true;
entry.Changed += (sender, e) => NotifyFileChange ();
box.PackStart (entry, true);
- var btn = new Button ("...");
- btn.Accessible.Label = Application.TranslationCatalog.GetString ("Browse");
- box.PackStart (btn);
- btn.Clicked += BtnClicked;
+ button = new Button ("...");
+ button.Accessible.Title = Application.TranslationCatalog.GetString ("Browse");
+ box.PackStart (button);
+ button.Clicked += BtnClicked;
Content = box;
+
+ Accessible.PropertyChanged += HandleAccessiblePropertyChanged;
+ }
+
+ private void HandleAccessiblePropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
+ {
+ if (e.PropertyName == nameof (Accessible.LabelWidget)) {
+ Content.Accessible.LabelWidget = Accessible.LabelWidget;
+ button.Accessible.LabelWidget = Accessible.LabelWidget;
+ entry.Accessible.LabelWidget = Accessible.LabelWidget;
+ } else if (e.PropertyName == nameof (Accessible.Label)) {
+ Content.Accessible.Label = Accessible.Label;
+ button.Accessible.Label = Accessible.Label;
+ entry.Accessible.Label = Accessible.Label;
+ }
}
public FileDialogFilter ActiveFilter {
@@ -294,6 +310,14 @@ namespace Xwt
dialog = null;
}
}
+
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && !IsDisposed) {
+ Accessible.PropertyChanged -= HandleAccessiblePropertyChanged;
+ }
+ base.Dispose(disposing);
+ }
}
}
diff --git a/Xwt/Xwt/FolderSelector.cs b/Xwt/Xwt/FolderSelector.cs
index aaac9258..6703128b 100644
--- a/Xwt/Xwt/FolderSelector.cs
+++ b/Xwt/Xwt/FolderSelector.cs
@@ -129,6 +129,7 @@ namespace Xwt
class DefaultFolderSelectorBackend : XwtWidgetBackend, IFolderSelectorBackend
{
TextEntry entry;
+ Button button;
SelectFolderDialog dialog;
string currentFolder;
bool enableFolderChangedEvent;
@@ -143,15 +144,33 @@ namespace Xwt
box.Accessible.Title = Application.TranslationCatalog.GetString ("Folder Selector");
entry = new TextEntry ();
- entry.Accessible.Label = Application.TranslationCatalog.GetString ("Path");
+ entry.Accessible.Title = Application.TranslationCatalog.GetString ("Path");
entry.Changed += (sender, e) => NotifyFolderChange();
box.PackStart (entry, true);
- var btn = new Button ("...");
- btn.Accessible.Label = Application.TranslationCatalog.GetString ("Browse");
- box.PackStart (btn);
- btn.Clicked += BtnClicked;
+ button = new Button ("...");
+ button.Accessible.Title = Application.TranslationCatalog.GetString ("Browse");
+ box.PackStart (button);
+ button.Clicked += BtnClicked;
Content = box;
+
+ Accessible.PropertyChanged += HandleAccessiblePropertyChanged;
+ }
+
+ private void HandleAccessiblePropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
+ {
+ if (e.PropertyName == nameof(Accessible.LabelWidget))
+ {
+ Content.Accessible.LabelWidget = Accessible.LabelWidget;
+ button.Accessible.LabelWidget = Accessible.LabelWidget;
+ entry.Accessible.LabelWidget = Accessible.LabelWidget;
+ }
+ else if (e.PropertyName == nameof(Accessible.Label))
+ {
+ Content.Accessible.Label = Accessible.Label;
+ button.Accessible.Label = Accessible.Label;
+ entry.Accessible.Label = Accessible.Label;
+ }
}
public string CurrentFolder {
@@ -242,6 +261,14 @@ namespace Xwt
dialog = null;
}
}
+
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && !IsDisposed) {
+ Accessible.PropertyChanged -= HandleAccessiblePropertyChanged;
+ }
+ base.Dispose(disposing);
+ }
}
}