New bitmap method SetRGBConversionFunction which can be used to
[tangerine.git] / rom / intuition / windowlimits.c
blob320d1b335a2b2445fc8c72b234bc31ddc57deb46
1 /*
2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved.
4 $Id$
6 Set the minimum and maximum size of a window.
7 */
9 #include "intuition_intern.h"
11 /*****************************************************************************
13 NAME */
14 #include <exec/types.h>
15 #include <intuition/intuition.h>
16 #include <proto/intuition.h>
18 AROS_LH5(BOOL, WindowLimits,
20 /* SYNOPSIS */
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),
27 /* LOCATION */
28 struct IntuitionBase *, IntuitionBase, 53, Intuition)
30 /* FUNCTION
31 This functions sets the minimum and maximum sizes of a window.
33 INPUTS
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
39 RESULT
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.
44 NOTES
46 EXAMPLE
48 BUGS
50 SEE ALSO
51 OpenWindow()
53 INTERNALS
55 HISTORY
57 *****************************************************************************/
59 AROS_LIBFUNC_INIT
60 AROS_LIBBASE_EXT_DECL(struct IntuitionBase *,IntuitionBase)
62 BOOL retval = TRUE;
64 DEBUG_WINDOWLIMITS(dprintf("WindowLimits(Window 0x%lx MinWidth %ld MinHeight %ld MaxWidth %ld MaxHeight %ld)\n",window,MinWidth,MinHeight,MaxWidth,MaxHeight));
66 IntuitionBase = IntuitionBase; /* shut up the compiler */
68 SANITY_CHECKR(window,FALSE)
70 /* convert -1 to screen width/height */
71 if ((WORD)MaxWidth == -1) MaxWidth = window->WScreen->Width;
72 if ((WORD)MaxHeight == -1) MaxHeight = window->WScreen->Height;
74 /* crop maxwidth/height to screen width/height */
75 if (MaxWidth > window->WScreen->Width) MaxWidth = window->WScreen->Width;
76 if (MaxHeight > window->WScreen->Height) MaxHeight = window->WScreen->Height;
78 if (MinWidth)
80 if(window->Width >= MinWidth)
81 window->MinWidth = MinWidth;
82 else
83 retval = FALSE;
86 if (MinHeight)
88 if(window->Height >= MinHeight)
89 window->MinHeight = MinHeight;
90 else
91 retval = FALSE;
94 if (MaxWidth)
96 if(window->Width <= MaxWidth)
97 window->MaxWidth = MaxWidth;
98 else
99 retval = FALSE;
102 if (MaxHeight)
104 if(window->Height <= MaxHeight)
105 window->MaxHeight = MaxHeight;
106 else
107 retval = FALSE;
110 return retval;
112 AROS_LIBFUNC_EXIT
114 } /* WindowLimits */