Browse Source

implement max client size and top most.

pull/1977/head
Dan Walmsley 8 years ago
parent
commit
07774ea4be
  1. 20
      src/Avalonia.Native.OSX/window.mm
  2. 5
      src/Avalonia.Native/Helpers.cs
  3. 15
      src/Avalonia.Native/WindowImplBase.cs
  4. 3
      src/headers/avalonia-native.h

20
src/Avalonia.Native.OSX/window.mm

@ -44,6 +44,13 @@ public:
return S_OK;
}
virtual HRESULT SetTopMost (bool value)
{
[Window setLevel: value ? NSFloatingWindowLevel : NSNormalWindowLevel];
return S_OK;
}
virtual HRESULT Close()
{
[Window close];
@ -60,6 +67,19 @@ public:
return S_OK;
}
virtual HRESULT GetMaxClientSize(AvnSize* ret)
{
if(ret == nullptr)
return E_POINTER;
auto size = [NSScreen.screens objectAtIndex:0].frame.size;
ret->Height = size.height;
ret->Width = size.width;
return S_OK;
}
virtual HRESULT GetScaling (double* ret)
{
if(ret == nullptr)

5
src/Avalonia.Native/Helpers.cs

@ -14,5 +14,10 @@ namespace Avalonia.Native
{
return new AvnPoint { X = pt.X, Y = pt.Y };
}
public static Size ToAvaloniaSize (this AvnSize size)
{
return new Size(size.Width, size.Height);
}
}
}

15
src/Avalonia.Native/WindowImplBase.cs

@ -190,9 +190,17 @@ namespace Avalonia.Native
_native.BeginMoveDrag();
}
#region Stubs
public Size MaxClientSize => _native.GetMaxClientSize().ToAvaloniaSize();
public void SetTopmost(bool value)
{
_native.SetTopMost(value);
}
public double Scaling => _native.GetScaling();
#region Stubs
public Action<Point> PositionChanged { get; set; }
public Action Deactivated { get; set; }
public Action Activated { get; set; }
@ -201,16 +209,11 @@ namespace Avalonia.Native
Action<double> ScalingChanged { get; set; }
public IPlatformHandle Handle => new PlatformHandle(IntPtr.Zero, "NOT SUPPORTED");
public Size MaxClientSize => new Size(1600, 900);
public IScreenImpl Screen => new ScreenImpl();
Action<double> ITopLevelImpl.ScalingChanged { get; set; }
public void SetTopmost(bool value)
{
}
public void SetMinMaxSize(Size minSize, Size maxSize)
{
}

3
src/headers/avalonia-native.h

@ -73,6 +73,7 @@ AVNCOM(IAvnWindowBase, 02) : virtual IUnknown
virtual HRESULT Hide () = 0;
virtual HRESULT Close() = 0;
virtual HRESULT GetClientSize(AvnSize*ret) = 0;
virtual HRESULT GetMaxClientSize(AvnSize* ret) = 0;
virtual HRESULT GetScaling(double*ret)=0;
virtual HRESULT Resize(double width, double height) = 0;
virtual void Invalidate (AvnRect rect) = 0;
@ -81,6 +82,8 @@ AVNCOM(IAvnWindowBase, 02) : virtual IUnknown
virtual void SetPosition (AvnPoint point) = 0;
virtual HRESULT PointToClient (AvnPoint point, AvnPoint*ret) = 0;
virtual HRESULT PointToScreen (AvnPoint point, AvnPoint*ret) = 0;
virtual HRESULT SetTopMost (bool value) = 0;
};
AVNCOM(IAvnPopup, 03) : virtual IAvnWindowBase

Loading…
Cancel
Save