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

github.com/xamarin/Xamarin.PropertyEditing.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Maupin <me@ermau.com>2018-10-09 18:03:18 +0300
committerGitHub <noreply@github.com>2018-10-09 18:03:18 +0300
commit73bbf32dbc2021262fb8c56de325886010fe2d0e (patch)
treed577548127265d4cf008736b92fed965ef3b788a /Xamarin.PropertyEditing.Mac
parent20ef532e71217711e83af4ec89c8fc69cddf9ce9 (diff)
parent1a6022cf5578289a537c2f7a5186257e3ff1855c (diff)
Merge pull request #389 from xamarin/dominique-ThicknessControl
[Mac] Initial implemention of Thickness Editor.
Diffstat (limited to 'Xamarin.PropertyEditing.Mac')
-rw-r--r--Xamarin.PropertyEditing.Mac/Controls/ThicknessEditorControl.cs72
-rw-r--r--Xamarin.PropertyEditing.Mac/PropertyTableDelegate.cs1
-rw-r--r--Xamarin.PropertyEditing.Mac/Resources/LocalizationResources.Designer.cs24
-rw-r--r--Xamarin.PropertyEditing.Mac/Resources/LocalizationResources.resx16
-rw-r--r--Xamarin.PropertyEditing.Mac/Xamarin.PropertyEditing.Mac.csproj1
5 files changed, 114 insertions, 0 deletions
diff --git a/Xamarin.PropertyEditing.Mac/Controls/ThicknessEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/ThicknessEditorControl.cs
new file mode 100644
index 0000000..a903689
--- /dev/null
+++ b/Xamarin.PropertyEditing.Mac/Controls/ThicknessEditorControl.cs
@@ -0,0 +1,72 @@
+using System;
+using AppKit;
+using CoreGraphics;
+using Xamarin.PropertyEditing.Drawing;
+using Xamarin.PropertyEditing.Mac.Resources;
+using Xamarin.PropertyEditing.ViewModels;
+
+namespace Xamarin.PropertyEditing.Mac
+{
+ internal class CommonThicknessEditorControl : BaseRectangleEditorControl<CommonThickness>
+ {
+ public CommonThicknessEditorControl ()
+ {
+ XLabel.Frame = new CGRect (28, 27, 50, 22);
+ XLabel.Font = NSFont.FromFontName (DefaultFontName, DefaultDescriptionLabelFontSize);
+ XLabel.StringValue = "LEFT";
+
+ XEditor.Frame = new CGRect (4, 46, 90, 20);
+
+ YLabel.Frame = new CGRect (160, 27, 45, 22);
+ YLabel.Font = NSFont.FromFontName (DefaultFontName, DefaultDescriptionLabelFontSize);
+ YLabel.StringValue = "TOP";
+
+ YEditor.Frame = new CGRect (132, 46, 90, 20);
+
+ WidthLabel.Frame = new CGRect (24, -6, 50, 22);
+ WidthLabel.Font = NSFont.FromFontName (DefaultFontName, DefaultDescriptionLabelFontSize);
+ WidthLabel.StringValue = "RIGHT";
+
+ WidthEditor.Frame = new CGRect (4, 13, 90, 20);
+
+ HeightLabel.Frame = new CGRect (150, -6, 50, 22);
+ HeightLabel.Font = NSFont.FromFontName (DefaultFontName, DefaultDescriptionLabelFontSize);
+ HeightLabel.StringValue = "BOTTOM";
+
+ HeightEditor.Frame = new CGRect (132, 13, 90, 20);
+ }
+
+ public override nint GetHeight (PropertyViewModel vm)
+ {
+ return 66;
+ }
+
+ protected override void OnInputUpdated (object sender, EventArgs e)
+ {
+ ViewModel.Value = (CommonThickness)Activator.CreateInstance (typeof (CommonThickness), HeightEditor.Value, XEditor.Value, WidthEditor.Value, YEditor.Value);
+ }
+
+ protected override void UpdateAccessibilityValues ()
+ {
+ XEditor.AccessibilityEnabled = XEditor.Enabled;
+ XEditor.AccessibilityTitle = string.Format (LocalizationResources.AccessibilityLeftEditor, ViewModel.Property.Name);
+
+ YEditor.AccessibilityEnabled = YEditor.Enabled;
+ YEditor.AccessibilityTitle = string.Format (LocalizationResources.AccessibilityTopEditor, ViewModel.Property.Name);
+
+ WidthEditor.AccessibilityEnabled = WidthEditor.Enabled;
+ WidthEditor.AccessibilityTitle = string.Format (LocalizationResources.AccessibilityRightEditor, ViewModel.Property.Name);
+
+ HeightEditor.AccessibilityEnabled = HeightEditor.Enabled;
+ HeightEditor.AccessibilityTitle = string.Format (LocalizationResources.AccessibilityBottomEditor, ViewModel.Property.Name);
+ }
+
+ protected override void UpdateValue ()
+ {
+ XEditor.Value = ViewModel.Value.Left;
+ YEditor.Value = ViewModel.Value.Top;
+ WidthEditor.Value = ViewModel.Value.Right;
+ HeightEditor.Value = ViewModel.Value.Bottom;
+ }
+ }
+}
diff --git a/Xamarin.PropertyEditing.Mac/PropertyTableDelegate.cs b/Xamarin.PropertyEditing.Mac/PropertyTableDelegate.cs
index 99c17f5..ef4a66a 100644
--- a/Xamarin.PropertyEditing.Mac/PropertyTableDelegate.cs
+++ b/Xamarin.PropertyEditing.Mac/PropertyTableDelegate.cs
@@ -271,6 +271,7 @@ namespace Xamarin.PropertyEditing.Mac
{typeof (PropertyViewModel<Rectangle>), typeof (SystemRectangleEditorControl)},
{typeof (BrushPropertyViewModel), typeof (BrushEditorControl)},
{typeof (RatioViewModel), typeof (RatioEditorControl<CommonRatio>)},
+ {typeof (ThicknessPropertyViewModel), typeof (CommonThicknessEditorControl) },
};
}
}
diff --git a/Xamarin.PropertyEditing.Mac/Resources/LocalizationResources.Designer.cs b/Xamarin.PropertyEditing.Mac/Resources/LocalizationResources.Designer.cs
index e22166a..1a4f713 100644
--- a/Xamarin.PropertyEditing.Mac/Resources/LocalizationResources.Designer.cs
+++ b/Xamarin.PropertyEditing.Mac/Resources/LocalizationResources.Designer.cs
@@ -202,5 +202,29 @@ namespace Xamarin.PropertyEditing.Mac.Resources {
return ResourceManager.GetString("ObjectNamePlaceholder", resourceCulture);
}
}
+
+ internal static string AccessibilityLeftEditor {
+ get {
+ return ResourceManager.GetString("AccessibilityLeftEditor", resourceCulture);
+ }
+ }
+
+ internal static string AccessibilityTopEditor {
+ get {
+ return ResourceManager.GetString("AccessibilityTopEditor", resourceCulture);
+ }
+ }
+
+ internal static string AccessibilityRightEditor {
+ get {
+ return ResourceManager.GetString("AccessibilityRightEditor", resourceCulture);
+ }
+ }
+
+ internal static string AccessibilityBottomEditor {
+ get {
+ return ResourceManager.GetString("AccessibilityBottomEditor", resourceCulture);
+ }
+ }
}
}
diff --git a/Xamarin.PropertyEditing.Mac/Resources/LocalizationResources.resx b/Xamarin.PropertyEditing.Mac/Resources/LocalizationResources.resx
index 16a5da3..9f97d73 100644
--- a/Xamarin.PropertyEditing.Mac/Resources/LocalizationResources.resx
+++ b/Xamarin.PropertyEditing.Mac/Resources/LocalizationResources.resx
@@ -102,4 +102,20 @@
<data name="ObjectNamePlaceholder" xml:space="preserve">
<value>No Name</value>>
</data>
+ <data name="AccessibilityLeftEditor" xml:space="preserve">
+ <value>{0} Left Editor</value>
+ <comment>Editor for LEft Value</comment>
+ </data>
+ <data name="AccessibilityTopEditor" xml:space="preserve">
+ <value>{0} Top Editor</value>
+ <comment>Editor for Top Value</comment>
+ </data>
+ <data name="AccessibilityRightEditor" xml:space="preserve">
+ <value>{0} Right Editor</value>
+ <comment>Editor for Right Value</comment>
+ </data>
+ <data name="AccessibilityBottomEditor" xml:space="preserve">
+ <value>{0} Bottom Editor</value>
+ <comment>Editor for Bottom Value</comment>
+ </data>
</root>
diff --git a/Xamarin.PropertyEditing.Mac/Xamarin.PropertyEditing.Mac.csproj b/Xamarin.PropertyEditing.Mac/Xamarin.PropertyEditing.Mac.csproj
index 8fdb333..7775f3e 100644
--- a/Xamarin.PropertyEditing.Mac/Xamarin.PropertyEditing.Mac.csproj
+++ b/Xamarin.PropertyEditing.Mac/Xamarin.PropertyEditing.Mac.csproj
@@ -135,6 +135,7 @@
<Compile Include="Controls\RequestResource\ResourceTableDelegate.cs" />
<Compile Include="Controls\RequestResource\RequestResourcePreviewPanel.cs" />
<Compile Include="Controls\PanelHeaderEditorControl.cs" />
+ <Compile Include="Controls\ThicknessEditorControl.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="Controls\" />