Skip to content

Commit 13999b3

Browse files
committed
Add missing SetMinimum/MaximumSize to the window classes
1 parent 62c34c1 commit 13999b3

File tree

3 files changed

+144
-0
lines changed

3 files changed

+144
-0
lines changed

src/SFML.Graphics/RenderWindow.cs

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,42 @@ public override Vector2u Size
143143
////////////////////////////////////////////////////////////
144144
public bool IsSrgb => sfRenderWindow_isSrgb(CPointer);
145145

146+
////////////////////////////////////////////////////////////
147+
/// <summary>
148+
/// Set the minimum window rendering region size
149+
/// </summary>
150+
/// <param name="minimumSize">New minimum size, in pixels, null to reset the minimum size</param>
151+
////////////////////////////////////////////////////////////
152+
public override SetMinimumSize(Vector2u? minimumSize)
153+
{
154+
if (minimumSize.HasValue)
155+
{
156+
sfRenderWindow_setMinimumSize(CPointer, ref minimumSize.Value);
157+
}
158+
else
159+
{
160+
sfRenderWindow_setMinimumSize(CPointer, IntPtr.Zero);
161+
}
162+
}
163+
164+
////////////////////////////////////////////////////////////
165+
/// <summary>
166+
/// Set the maximum window rendering region size
167+
/// </summary>
168+
/// <param name="maximumSize">New maximum size, in pixels, null to reset the maximum size</param>
169+
////////////////////////////////////////////////////////////
170+
public override MaximumSize(Vector2u? maximumSize)
171+
{
172+
if (maximumSize.HasValue)
173+
{
174+
sfRenderWindow_setMaximumSize(CPointer, ref maximumSize.Value);
175+
}
176+
else
177+
{
178+
sfRenderWindow_setMaximumSize(CPointer, IntPtr.Zero);
179+
}
180+
}
181+
146182
////////////////////////////////////////////////////////////
147183
/// <summary>
148184
/// Change the title of the window
@@ -761,6 +797,18 @@ private void Initialize()
761797
[DllImport(CSFML.Graphics, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
762798
private static extern void sfRenderWindow_setSize(IntPtr cPointer, Vector2u size);
763799

800+
[DllImport(CSFML.Graphics, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
801+
private static extern void sfRenderWindow_setMinimumSize(IntPtr cPointer, IntPtr minimumSize);
802+
803+
[DllImport(CSFML.Graphics, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
804+
private static extern void sfRenderWindow_setMinimumSize(IntPtr cPointer, ref Vector2u minimumSize);
805+
806+
[DllImport(CSFML.Graphics, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
807+
private static extern void sfRenderWindow_setMaximumSize(IntPtr cPointer, IntPtr maximumSize);
808+
809+
[DllImport(CSFML.Graphics, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
810+
private static extern void sfRenderWindow_setMaximumSize(IntPtr cPointer, ref Vector2u maximumSize);
811+
764812
[DllImport(CSFML.Graphics, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
765813
private static extern void sfRenderWindow_setUnicodeTitle(IntPtr cPointer, IntPtr title);
766814

src/SFML.Window/Window.cs

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,42 @@ public override void SetTitle(string title)
162162
}
163163
}
164164

165+
////////////////////////////////////////////////////////////
166+
/// <summary>
167+
/// Set the minimum window rendering region size
168+
/// </summary>
169+
/// <param name="minimumSize">New minimum size, in pixels, null to reset the minimum size</param>
170+
////////////////////////////////////////////////////////////
171+
public override void SetMinimumSize(Vector2u? minimumSize)
172+
{
173+
if (minimumSize.HasValue)
174+
{
175+
sfWindow_setMinimumSize(CPointer, ref minimumSize.Value);
176+
}
177+
else
178+
{
179+
sfWindow_setMinimumSize(CPointer, IntPtr.Zero);
180+
}
181+
}
182+
183+
////////////////////////////////////////////////////////////
184+
/// <summary>
185+
/// Set the maximum window rendering region size
186+
/// </summary>
187+
/// <param name="maximumSize">New maximum size, in pixels, null to reset the maximum size</param>
188+
////////////////////////////////////////////////////////////
189+
public override void SetMaximumSize(Vector2u? maximumSize)
190+
{
191+
if (maximumSize.HasValue)
192+
{
193+
sfWindow_setMaximumSize(CPointer, ref maximumSize.Value);
194+
}
195+
else
196+
{
197+
sfWindow_setMaximumSize(CPointer, IntPtr.Zero);
198+
}
199+
}
200+
165201
////////////////////////////////////////////////////////////
166202
/// <summary>
167203
/// Change the window's icon
@@ -441,6 +477,18 @@ protected Window(IntPtr cPointer, int dummy) :
441477
[DllImport(CSFML.Window, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
442478
private static extern void sfWindow_setSize(IntPtr cPointer, Vector2u size);
443479

480+
[DllImport(CSFML.Window, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
481+
private static extern void sfWindow_setMinimumSize(IntPtr cPointer, IntPtr minimumSize);
482+
483+
[DllImport(CSFML.Window, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
484+
private static extern void sfWindow_setMinimumSize(IntPtr cPointer, Vector2u minimumSize);
485+
486+
[DllImport(CSFML.Window, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
487+
private static extern void sfWindow_setMaximumSize(IntPtr cPointer, IntPtr maximumSize);
488+
489+
[DllImport(CSFML.Window, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
490+
private static extern void sfWindow_setMaximumSize(IntPtr cPointer, Vector2u maximumSize);
491+
444492
[DllImport(CSFML.Window, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
445493
private static extern void sfWindow_setUnicodeTitle(IntPtr cPointer, IntPtr title);
446494

src/SFML.Window/WindowBase.cs

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,42 @@ public virtual Vector2u Size
139139
set => sfWindowBase_setSize(CPointer, value);
140140
}
141141

142+
////////////////////////////////////////////////////////////
143+
/// <summary>
144+
/// Set the minimum window rendering region size
145+
/// </summary>
146+
/// <param name="minimumSize">New minimum size, in pixels, null to reset the minimum size</param>
147+
////////////////////////////////////////////////////////////
148+
public virtual void SetMinimumSize(Vector2u? minimumSize)
149+
{
150+
if (minimumSize.HasValue)
151+
{
152+
sfWindowBase_setMinimumSize(CPointer, ref minimumSize.Value);
153+
}
154+
else
155+
{
156+
sfWindowBase_setMinimumSize(CPointer, IntPtr.Zero);
157+
}
158+
}
159+
160+
////////////////////////////////////////////////////////////
161+
/// <summary>
162+
/// Set the maximum window rendering region size
163+
/// </summary>
164+
/// <param name="maximumSize">New maximum size, in pixels, null to reset the maximum size</param>
165+
////////////////////////////////////////////////////////////
166+
public virtual void SetMaximumSize(Vector2u? maximumSize)
167+
{
168+
if (maximumSize.HasValue)
169+
{
170+
sfWindowBase_setMaximumSize(CPointer, ref maximumSize.Value);
171+
}
172+
else
173+
{
174+
sfWindowBase_setMaximumSize(CPointer, IntPtr.Zero);
175+
}
176+
}
177+
142178
////////////////////////////////////////////////////////////
143179
/// <summary>
144180
/// Change the title of the window
@@ -615,6 +651,18 @@ private void CallEventHandler(Event e)
615651
[DllImport(CSFML.Window, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
616652
private static extern void sfWindowBase_setSize(IntPtr cPointer, Vector2u size);
617653

654+
[DllImport(CSFML.Window, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
655+
private static extern void sfWindowBase_setMinimumSize(IntPtr cPointer, IntPtr minimumSize);
656+
657+
[DllImport(CSFML.Window, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
658+
private static extern void sfWindowBase_setMinimumSize(IntPtr cPointer, ref Vector2u minimumSize);
659+
660+
[DllImport(CSFML.Window, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
661+
private static extern void sfWindowBase_setMaximumSize(IntPtr cPointer, IntPtr maximumSize);
662+
663+
[DllImport(CSFML.Window, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
664+
private static extern void sfWindowBase_setMaximumSize(IntPtr cPointer, ref Vector2u maximumSize);
665+
618666
[DllImport(CSFML.Window, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
619667
private static extern void sfWindowBase_setUnicodeTitle(IntPtr cPointer, IntPtr title);
620668

0 commit comments

Comments
 (0)