2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved.
6 Set the minimum and maximum size of a window.
9 #include "intuition_intern.h"
11 /*****************************************************************************
14 #include <exec/types.h>
15 #include <intuition/intuition.h>
16 #include <proto/intuition.h>
18 AROS_LH5(BOOL
, WindowLimits
,
21 AROS_LHA(struct Window
*, window
, A0
),
22 AROS_LHA(WORD
, MinWidth
, D0
),
23 AROS_LHA(WORD
, MinHeight
, D1
),
24 AROS_LHA(UWORD
, MaxWidth
, D2
),
25 AROS_LHA(UWORD
, MaxHeight
, D3
),
28 struct IntuitionBase
*, IntuitionBase
, 53, Intuition
)
31 This function sets the minimum and maximum sizes of a window.
34 window - window to change
35 MinWidth, MinHeight - the minimum size, may be 0 for no change
36 MaxWidth, MaxHeight - the maximum size, may be 0 for no change,
37 may be -1 for no maximum size
40 A boolean. FALSE is returned if any of the provided sizes is out
41 of range. Note that the other sizes take effect, though. TRUE if
42 all sizes could be set.
55 *****************************************************************************/
61 DEBUG_WINDOWLIMITS(dprintf("WindowLimits(Window 0x%lx MinWidth %ld MinHeight %ld MaxWidth %ld MaxHeight %ld)\n",window
,MinWidth
,MinHeight
,MaxWidth
,MaxHeight
));
63 IntuitionBase
= IntuitionBase
; /* shut up the compiler */
65 SANITY_CHECKR(window
,FALSE
)
67 /* convert -1 to screen width/height */
68 if ((WORD
)MaxWidth
== -1) MaxWidth
= window
->WScreen
->Width
;
69 if ((WORD
)MaxHeight
== -1) MaxHeight
= window
->WScreen
->Height
;
71 /* crop maxwidth/height to screen width/height */
72 if (MaxWidth
> window
->WScreen
->Width
) MaxWidth
= window
->WScreen
->Width
;
73 if (MaxHeight
> window
->WScreen
->Height
) MaxHeight
= window
->WScreen
->Height
;
77 if(window
->Width
>= MinWidth
)
78 window
->MinWidth
= MinWidth
;
85 if(window
->Height
>= MinHeight
)
86 window
->MinHeight
= MinHeight
;
93 if(window
->Width
<= MaxWidth
)
94 window
->MaxWidth
= MaxWidth
;
101 if(window
->Height
<= MaxHeight
)
102 window
->MaxHeight
= MaxHeight
;