2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved.
7 #include "intuition_intern.h"
8 #include "inputhandler_actions.h"
10 struct ZipWindowActionMsg
12 struct IntuiActionMsg msg
;
13 struct Window
*window
;
16 static VOID
int_zipwindow(struct ZipWindowActionMsg
*msg
,
17 struct IntuitionBase
*IntuitionBase
);
19 /*****************************************************************************
22 #include <intuition/intuition.h>
23 #include <proto/intuition.h>
25 AROS_LH1(void, ZipWindow
,
28 AROS_LHA(struct Window
*, window
, A0
),
31 struct IntuitionBase
*, IntuitionBase
, 84, Intuition
)
34 "Zip" (move and resize) a window to the coordinates and dimensions
35 the window had at the last call of ZipWindow(), or invoked via the
45 This call is deferred. Wait() for IDCMP_CHANGEWINDOW if your
46 program depends on the new size.
53 ChangeWindowBox(), MoveWindow(), SizeWindow()
59 *****************************************************************************/
63 struct ZipWindowActionMsg msg
;
65 DEBUG_ZIPWINDOW(dprintf("ZipWindow(Window 0x%lx)\n",window
));
71 DoASyncAction((APTR
)int_zipwindow
, &msg
.msg
, sizeof(msg
), IntuitionBase
);
72 // DoSyncAction((APTR)int_zipwindow, &msg.msg, IntuitionBase);
79 static VOID
int_zipwindow(struct ZipWindowActionMsg
*msg
,
80 struct IntuitionBase
*IntuitionBase
)
82 struct Window
*window
= msg
->window
;
83 struct IntWindow
*w
= (struct IntWindow
*)window
;
84 LONG NewLeftEdge
, NewTopEdge
, NewWidth
, NewHeight
;
86 if (!ResourceExisting(window
, RESOURCE_WINDOW
, IntuitionBase
)) return;
88 NewLeftEdge
= window
->LeftEdge
;
89 if (w
->ZipLeftEdge
!= ~0)
91 NewLeftEdge
= w
->ZipLeftEdge
;
93 w
->ZipLeftEdge
= w
->window
.LeftEdge
;
95 w
->ZipLeftEdge
= w
->window
.RelLeftEdge
;
99 NewTopEdge
= window
->TopEdge
;
100 if (w
->ZipTopEdge
!= ~0)
102 NewTopEdge
= w
->ZipTopEdge
;
104 w
->ZipTopEdge
= w
->window
.TopEdge
;
106 w
->ZipTopEdge
= w
->window
.RelTopEdge
;
110 NewWidth
= window
->Width
;
111 if (w
->ZipWidth
!= ~0)
113 NewWidth
= w
->ZipWidth
;
114 if (window
->Flags
& WFLG_SIZEGADGET
)
116 if (NewWidth
< (ULONG
)window
->MinWidth
) NewWidth
= window
->MinWidth
;
117 if (NewWidth
> (ULONG
)window
->MaxWidth
) NewWidth
= window
->MaxWidth
;
119 w
->ZipWidth
= w
->window
.Width
;
122 NewHeight
= window
->Height
;
123 if (w
->ZipHeight
!= ~0)
125 NewHeight
= w
->ZipHeight
;
126 if (window
->Flags
& WFLG_SIZEGADGET
)
128 if (NewHeight
< (ULONG
)window
->MinHeight
) NewHeight
= window
->MinHeight
;
129 if (NewHeight
> (ULONG
)window
->MaxHeight
) NewHeight
= window
->MaxHeight
;
131 w
->ZipHeight
= w
->window
.Height
;
134 DoMoveSizeWindow(window
, NewLeftEdge
, NewTopEdge
, NewWidth
, NewHeight
, TRUE
, IntuitionBase
);