New bitmap method SetRGBConversionFunction which can be used to
[tangerine.git] / rom / intuition / changewindowbox.c
blob5ccf32bf3892ec96fef055b2081c0b2ea8392604
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 Change position and size of a window.
7 */
9 #include "intuition_intern.h"
10 #include "inputhandler_actions.h"
12 struct ChangeWindowBoxActionMsg
14 struct IntuiActionMsg msg;
15 struct Window *window;
16 LONG left;
17 LONG top;
18 LONG width;
19 LONG height;
22 static VOID int_changewindowbox(struct ChangeWindowBoxActionMsg *msg,
23 struct IntuitionBase *IntuitionBase);
25 /*****************************************************************************
27 NAME */
28 #include <proto/intuition.h>
30 AROS_LH5(void, ChangeWindowBox,
32 /* SYNOPSIS */
33 AROS_LHA(struct Window *, window, A0),
34 AROS_LHA(LONG , left, D0),
35 AROS_LHA(LONG , top, D1),
36 AROS_LHA(LONG , width, D2),
37 AROS_LHA(LONG , height, D3),
39 /* LOCATION */
40 struct IntuitionBase *, IntuitionBase, 81, Intuition)
42 /* FUNCTION
43 Set the new position and size of a window in one call.
45 INPUTS
46 window - Change this window
47 left, top - New position
48 width, height - New size
50 RESULT
52 NOTES
53 This call is deferred. Wait() for IDCMP_CHANGEWINDOW if your
54 program depends on the new size.
56 EXAMPLE
58 BUGS
60 SEE ALSO
62 INTERNALS
64 HISTORY
66 *****************************************************************************/
68 AROS_LIBFUNC_INIT
69 AROS_LIBBASE_EXT_DECL(struct IntuitionBase *,IntuitionBase)
71 struct ChangeWindowBoxActionMsg msg;
73 DEBUG_CHANGEWINDOWBOX(dprintf("ChangeWindowBox: Window 0x%lx Left %d Top %d Width %d Height %d\n",
74 window, left, top, width, height));
76 if (!window)
77 return;
79 EXTENDWORD(left);
80 EXTENDWORD(top);
81 EXTENDWORD(width);
82 EXTENDWORD(height);
84 msg.window = window;
85 msg.left = left;
86 msg.top = top;
87 msg.width = width;
88 msg.height = height;
90 DoASyncAction((APTR)int_changewindowbox, &msg.msg, sizeof(msg), IntuitionBase);
91 // DoSyncAction((APTR)int_changewindowbox, &msg.msg, IntuitionBase);
93 AROS_LIBFUNC_EXIT
95 } /* ChangeWindowBox */
98 static VOID int_changewindowbox(struct ChangeWindowBoxActionMsg *msg,
99 struct IntuitionBase *IntuitionBase)
101 struct Window *window = msg->window;
103 if (!ResourceExisting(window, RESOURCE_WINDOW, IntuitionBase)) return;
105 if (window->Flags & WFLG_SIZEGADGET)
107 if (msg->width < window->MinWidth) msg->width = window->MinWidth;
108 if (msg->width > (UWORD)window->MaxWidth) msg->width = (UWORD)window->MaxWidth;
110 if (msg->width > window->WScreen->Width) msg->width = window->WScreen->Width;
112 if (window->Flags & WFLG_SIZEGADGET)
114 if (msg->height < window->MinHeight) msg->height = window->MinHeight;
115 if (msg->height > (UWORD)window->MaxHeight) msg->height = (UWORD)window->MaxHeight;
117 if (msg->height > window->WScreen->Height) msg->height = window->WScreen->Height;
119 DoMoveSizeWindow(window, msg->left, msg->top, msg->width, msg->height, TRUE, IntuitionBase);