Minor fixes to comments.
[AROS.git] / rom / intuition / changewindowbox.c
blob50958ab59a01e1dfb43142a7d9cb134f2eed8aad
1 /*
2 Copyright © 1995-2007, 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
70 struct ChangeWindowBoxActionMsg msg;
72 DEBUG_CHANGEWINDOWBOX(dprintf("ChangeWindowBox: Window 0x%lx Left %d Top %d Width %d Height %d\n",
73 window, left, top, width, height));
75 if (!window)
76 return;
78 EXTENDWORD(left);
79 EXTENDWORD(top);
80 EXTENDWORD(width);
81 EXTENDWORD(height);
83 msg.window = window;
84 msg.left = left;
85 msg.top = top;
86 msg.width = width;
87 msg.height = height;
89 DoASyncAction((APTR)int_changewindowbox, &msg.msg, sizeof(msg), IntuitionBase);
90 // DoSyncAction((APTR)int_changewindowbox, &msg.msg, IntuitionBase);
92 AROS_LIBFUNC_EXIT
94 } /* ChangeWindowBox */
97 static VOID int_changewindowbox(struct ChangeWindowBoxActionMsg *msg,
98 struct IntuitionBase *IntuitionBase)
100 struct Window *window = msg->window;
102 if (!ResourceExisting(window, RESOURCE_WINDOW, IntuitionBase)) return;
104 if (window->Flags & WFLG_SIZEGADGET)
106 if (msg->width < window->MinWidth) msg->width = window->MinWidth;
107 if (msg->width > (UWORD)window->MaxWidth) msg->width = (UWORD)window->MaxWidth;
109 if (msg->width > window->WScreen->Width) msg->width = window->WScreen->Width;
111 if (window->Flags & WFLG_SIZEGADGET)
113 if (msg->height < window->MinHeight) msg->height = window->MinHeight;
114 if (msg->height > (UWORD)window->MaxHeight) msg->height = (UWORD)window->MaxHeight;
116 if (msg->height > window->WScreen->Height) msg->height = window->WScreen->Height;
118 DoMoveSizeWindow(window, msg->left, msg->top, msg->width, msg->height, TRUE, IntuitionBase);