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:
authorBertrand Le Roy <beleroy@microsoft.com>2017-09-27 03:14:01 +0300
committerBertrand Le Roy <beleroy@microsoft.com>2017-09-27 03:14:01 +0300
commit63456902df43c32d0764d213be13f05a42429c8e (patch)
treefb1e48c0946e7078f08679fd0ff89fb64f3a5d95 /Xamarin.PropertyEditing.Mac.Standalone
parent6abbffe4162041414601f922acf9d5d5b217a2b6 (diff)
Add sample mocked control support to standalone mac app, fix Size and Point mac support.
Diffstat (limited to 'Xamarin.PropertyEditing.Mac.Standalone')
-rw-r--r--Xamarin.PropertyEditing.Mac.Standalone/IMockedControl.cs9
-rw-r--r--Xamarin.PropertyEditing.Mac.Standalone/Main.storyboard30
-rw-r--r--Xamarin.PropertyEditing.Mac.Standalone/MockedAppKitButton.cs21
-rw-r--r--Xamarin.PropertyEditing.Mac.Standalone/MockedAppKitControlButton.cs43
-rw-r--r--Xamarin.PropertyEditing.Mac.Standalone/MockedAppKitControlButton.designer.cs9
-rw-r--r--Xamarin.PropertyEditing.Mac.Standalone/MockedControlButton.cs32
-rw-r--r--Xamarin.PropertyEditing.Mac.Standalone/MockedSampleControlButton.cs21
-rw-r--r--Xamarin.PropertyEditing.Mac.Standalone/ViewController.cs2
-rw-r--r--Xamarin.PropertyEditing.Mac.Standalone/Xamarin.PropertyEditing.Mac.Standalone.csproj8
9 files changed, 114 insertions, 61 deletions
diff --git a/Xamarin.PropertyEditing.Mac.Standalone/IMockedControl.cs b/Xamarin.PropertyEditing.Mac.Standalone/IMockedControl.cs
new file mode 100644
index 0000000..5f0b62d
--- /dev/null
+++ b/Xamarin.PropertyEditing.Mac.Standalone/IMockedControl.cs
@@ -0,0 +1,9 @@
+using System;
+
+namespace Xamarin.PropertyEditing.Mac.Standalone
+{
+ interface IMockedControl
+ {
+ object MockedControl { get; }
+ }
+}
diff --git a/Xamarin.PropertyEditing.Mac.Standalone/Main.storyboard b/Xamarin.PropertyEditing.Mac.Standalone/Main.storyboard
index 052ee00..56adc52 100644
--- a/Xamarin.PropertyEditing.Mac.Standalone/Main.storyboard
+++ b/Xamarin.PropertyEditing.Mac.Standalone/Main.storyboard
@@ -674,10 +674,32 @@
<rect key="frame" x="0.0" y="0.0" width="480" height="270"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
+ <button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Lao-X4-Foo">
+ <rect key="frame" x="1" y="236" width="110" height="32"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+ <buttonCell key="cell" type="push" title="Mocked 1" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="0bJ-RB-Foo" customClass="MockedSampleControlButton">
+ <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+ <font key="font" metaFont="system"/>
+ </buttonCell>
+ <connections>
+ <action selector="OnClickEvent:" target="XfG-lQ-9wD" id="CqZ-JO-Foo"/>
+ </connections>
+ </button>
+ <button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Lao-X4-Bar">
+ <rect key="frame" x="111" y="236" width="110" height="32"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+ <buttonCell key="cell" type="push" title="Mocked 2" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="0bJ-RB-Bar" customClass="MockedSampleControlButton">
+ <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+ <font key="font" metaFont="system"/>
+ </buttonCell>
+ <connections>
+ <action selector="OnClickEvent:" target="XfG-lQ-9wD" id="CqZ-JO-Bar"/>
+ </connections>
+ </button>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Lao-X4-NZl">
- <rect key="frame" x="1" y="236" width="81" height="32"/>
+ <rect key="frame" x="221" y="236" width="110" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
- <buttonCell key="cell" type="push" title="Button" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="0bJ-RB-L5x" customClass="MockedAppKitButton">
+ <buttonCell key="cell" type="push" title="Mock AppKit" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="0bJ-RB-L5x" customClass="MockedAppKitButton">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
@@ -686,9 +708,9 @@
</connections>
</button>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="fbd-bO-O5O">
- <rect key="frame" x="92" y="236" width="81" height="32"/>
+ <rect key="frame" x="331" y="236" width="110" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
- <buttonCell key="cell" type="push" title="Button" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="Ttv-Om-Ige">
+ <buttonCell key="cell" type="push" title="AppKit" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="Ttv-Om-Ige">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
diff --git a/Xamarin.PropertyEditing.Mac.Standalone/MockedAppKitButton.cs b/Xamarin.PropertyEditing.Mac.Standalone/MockedAppKitButton.cs
new file mode 100644
index 0000000..81e9957
--- /dev/null
+++ b/Xamarin.PropertyEditing.Mac.Standalone/MockedAppKitButton.cs
@@ -0,0 +1,21 @@
+using System;
+using Foundation;
+using Xamarin.PropertyEditing.Tests.MockControls;
+
+namespace Xamarin.PropertyEditing.Mac.Standalone
+{
+ [Foundation.Register ("MockedAppKitButton")]
+ public class MockedAppKitButton : MockedControlButton<MockNSButton>
+ {
+ // Called when created from unmanaged code
+ public MockedAppKitButton (IntPtr handle) : base (new MockNSButton (), handle)
+ {
+ }
+
+ // Called when created directly from a XIB file
+ [Export ("initWithCoder:")]
+ public MockedAppKitButton (NSCoder coder) : base (new MockNSButton (), coder)
+ {
+ }
+ }
+}
diff --git a/Xamarin.PropertyEditing.Mac.Standalone/MockedAppKitControlButton.cs b/Xamarin.PropertyEditing.Mac.Standalone/MockedAppKitControlButton.cs
deleted file mode 100644
index ad2e4d0..0000000
--- a/Xamarin.PropertyEditing.Mac.Standalone/MockedAppKitControlButton.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-using System;
-using Foundation;
-using AppKit;
-using Xamarin.PropertyEditing.Tests.MockControls;
-
-namespace Xamarin.PropertyEditing.Mac.Standalone
-{
- public abstract class MockedAppKitControlButton<T> : AppKit.NSButtonCell where T : MockControl
- {
- protected MockedAppKitControlButton (T mockedControl, IntPtr handle) : base (handle)
- {
- MockedControl = mockedControl;
- Initialize ();
- }
-
- protected MockedAppKitControlButton (T mockedControl, NSCoder coder) : base (coder)
- {
- Initialize ();
- MockedControl = mockedControl;
- }
-
- // Shared initialization code
- void Initialize ()
- {
- }
-
- public T MockedControl { get; }
- }
-
- public partial class MockedAppKitButton : MockedAppKitControlButton<MockNSButton>
- {
- // Called when created from unmanaged code
- public MockedAppKitButton (IntPtr handle) : base (new MockNSButton (), handle)
- {
- }
-
- // Called when created directly from a XIB file
- [Export ("initWithCoder:")]
- public MockedAppKitButton (NSCoder coder) : base (new MockNSButton (), coder)
- {
- }
- }
-}
diff --git a/Xamarin.PropertyEditing.Mac.Standalone/MockedAppKitControlButton.designer.cs b/Xamarin.PropertyEditing.Mac.Standalone/MockedAppKitControlButton.designer.cs
deleted file mode 100644
index c81fc16..0000000
--- a/Xamarin.PropertyEditing.Mac.Standalone/MockedAppKitControlButton.designer.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-namespace Xamarin.PropertyEditing.Mac.Standalone
-{
-
- // Should subclass AppKit.NSView
- [Foundation.Register ("MockedAppKitButton")]
- public partial class MockedAppKitButton
- {
- }
-}
diff --git a/Xamarin.PropertyEditing.Mac.Standalone/MockedControlButton.cs b/Xamarin.PropertyEditing.Mac.Standalone/MockedControlButton.cs
new file mode 100644
index 0000000..91e3acf
--- /dev/null
+++ b/Xamarin.PropertyEditing.Mac.Standalone/MockedControlButton.cs
@@ -0,0 +1,32 @@
+using System;
+using Foundation;
+using AppKit;
+using Xamarin.PropertyEditing.Tests.MockControls;
+
+namespace Xamarin.PropertyEditing.Mac.Standalone
+{
+ public abstract class MockedControlButton<T> : NSButtonCell, IMockedControl
+ where T : MockControl
+ {
+ protected MockedControlButton (T mockedControl, IntPtr handle) : base (handle)
+ {
+ MockedControl = mockedControl;
+ Initialize ();
+ }
+
+ protected MockedControlButton (T mockedControl, NSCoder coder) : base (coder)
+ {
+ Initialize ();
+ MockedControl = mockedControl;
+ }
+
+ // Shared initialization code
+ void Initialize ()
+ {
+ }
+
+ public T MockedControl { get; }
+
+ object IMockedControl.MockedControl => MockedControl;
+ }
+}
diff --git a/Xamarin.PropertyEditing.Mac.Standalone/MockedSampleControlButton.cs b/Xamarin.PropertyEditing.Mac.Standalone/MockedSampleControlButton.cs
new file mode 100644
index 0000000..8a441a7
--- /dev/null
+++ b/Xamarin.PropertyEditing.Mac.Standalone/MockedSampleControlButton.cs
@@ -0,0 +1,21 @@
+using System;
+using Foundation;
+using Xamarin.PropertyEditing.Tests.MockControls;
+
+namespace Xamarin.PropertyEditing.Mac.Standalone
+{
+ [Foundation.Register ("MockedSampleControlButton")]
+ public class MockedSampleControlButton : MockedControlButton<MockSampleControl>
+ {
+ // Called when created from unmanaged code
+ public MockedSampleControlButton (IntPtr handle) : base (new MockSampleControl (), handle)
+ {
+ }
+
+ // Called when created directly from a XIB file
+ [Export ("initWithCoder:")]
+ public MockedSampleControlButton (NSCoder coder) : base (new MockSampleControl (), coder)
+ {
+ }
+ }
+}
diff --git a/Xamarin.PropertyEditing.Mac.Standalone/ViewController.cs b/Xamarin.PropertyEditing.Mac.Standalone/ViewController.cs
index 9e38609..25571c7 100644
--- a/Xamarin.PropertyEditing.Mac.Standalone/ViewController.cs
+++ b/Xamarin.PropertyEditing.Mac.Standalone/ViewController.cs
@@ -35,7 +35,7 @@ namespace Xamarin.PropertyEditing.Mac.Standalone
partial void OnClickEvent (NSObject sender)
{
var clickedButton = sender as NSButton;
- var mockedButton = clickedButton?.Cell as MockedAppKitButton;
+ var mockedButton = clickedButton?.Cell as IMockedControl;
var inspectedObject = (mockedButton == null || mockedButton.MockedControl == null)
? (object)sender : mockedButton.MockedControl;
if (PropertyPanel.SelectedItems.Contains (inspectedObject)) {
diff --git a/Xamarin.PropertyEditing.Mac.Standalone/Xamarin.PropertyEditing.Mac.Standalone.csproj b/Xamarin.PropertyEditing.Mac.Standalone/Xamarin.PropertyEditing.Mac.Standalone.csproj
index b7503e1..620721d 100644
--- a/Xamarin.PropertyEditing.Mac.Standalone/Xamarin.PropertyEditing.Mac.Standalone.csproj
+++ b/Xamarin.PropertyEditing.Mac.Standalone/Xamarin.PropertyEditing.Mac.Standalone.csproj
@@ -81,10 +81,10 @@
<Compile Include="ViewController.designer.cs">
<DependentUpon>ViewController.cs</DependentUpon>
</Compile>
- <Compile Include="MockedAppKitControlButton.cs" />
- <Compile Include="MockedAppKitControlButton.designer.cs">
- <DependentUpon>MockedAppKitControlButton.cs</DependentUpon>
- </Compile>
+ <Compile Include="MockedControlButton.cs" />
+ <Compile Include="MockedAppKitButton.cs" />
+ <Compile Include="IMockedControl.cs" />
+ <Compile Include="MockedSampleControlButton.cs" />
</ItemGroup>
<ItemGroup>
<InterfaceDefinition Include="Main.storyboard" />