2 Copyright © 1995-2007, 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 functions 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.
57 *****************************************************************************/
63 DEBUG_WINDOWLIMITS(dprintf("WindowLimits(Window 0x%lx MinWidth %ld MinHeight %ld MaxWidth %ld MaxHeight %ld)\n",window
,MinWidth
,MinHeight
,MaxWidth
,MaxHeight
));
65 IntuitionBase
= IntuitionBase
; /* shut up the compiler */
67 SANITY_CHECKR(window
,FALSE
)
69 /* convert -1 to screen width/height */
70 if ((WORD
)MaxWidth
== -1) MaxWidth
= window
->WScreen
->Width
;
71 if ((WORD
)MaxHeight
== -1) MaxHeight
= window
->WScreen
->Height
;
73 /* crop maxwidth/height to screen width/height */
74 if (MaxWidth
> window
->WScreen
->Width
) MaxWidth
= window
->WScreen
->Width
;
75 if (MaxHeight
> window
->WScreen
->Height
) MaxHeight
= window
->WScreen
->Height
;
79 if(window
->Width
>= MinWidth
)
80 window
->MinWidth
= MinWidth
;
87 if(window
->Height
>= MinHeight
)
88 window
->MinHeight
= MinHeight
;
95 if(window
->Width
<= MaxWidth
)
96 window
->MaxWidth
= MaxWidth
;
103 if(window
->Height
<= MaxHeight
)
104 window
->MaxHeight
= MaxHeight
;