2 Copyright © 1995-2013, 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()
57 *****************************************************************************/
61 struct ZipWindowActionMsg msg
;
63 DEBUG_ZIPWINDOW(dprintf("ZipWindow(Window 0x%lx)\n",window
));
69 DoASyncAction((APTR
)int_zipwindow
, &msg
.msg
, sizeof(msg
), IntuitionBase
);
70 // DoSyncAction((APTR)int_zipwindow, &msg.msg, IntuitionBase);
77 static VOID
int_zipwindow(struct ZipWindowActionMsg
*msg
,
78 struct IntuitionBase
*IntuitionBase
)
80 struct Window
*window
= msg
->window
;
81 struct IntWindow
*w
= (struct IntWindow
*)window
;
82 LONG NewLeftEdge
, NewTopEdge
, NewWidth
, NewHeight
;
84 if (!ResourceExisting(window
, RESOURCE_WINDOW
, IntuitionBase
)) return;
86 NewLeftEdge
= window
->LeftEdge
;
87 if (w
->ZipLeftEdge
!= ~0)
89 NewLeftEdge
= w
->ZipLeftEdge
;
91 w
->ZipLeftEdge
= w
->window
.LeftEdge
;
93 w
->ZipLeftEdge
= w
->window
.RelLeftEdge
;
97 NewTopEdge
= window
->TopEdge
;
98 if (w
->ZipTopEdge
!= ~0)
100 NewTopEdge
= w
->ZipTopEdge
;
102 w
->ZipTopEdge
= w
->window
.TopEdge
;
104 w
->ZipTopEdge
= w
->window
.RelTopEdge
;
108 NewWidth
= window
->Width
;
109 if (w
->ZipWidth
!= ~0)
111 NewWidth
= w
->ZipWidth
;
112 if (window
->Flags
& WFLG_SIZEGADGET
)
114 if (NewWidth
< (ULONG
)window
->MinWidth
) NewWidth
= window
->MinWidth
;
115 if (NewWidth
> (ULONG
)window
->MaxWidth
) NewWidth
= window
->MaxWidth
;
117 w
->ZipWidth
= w
->window
.Width
;
120 NewHeight
= window
->Height
;
121 if (w
->ZipHeight
!= ~0)
123 NewHeight
= w
->ZipHeight
;
124 if (window
->Flags
& WFLG_SIZEGADGET
)
126 if (NewHeight
< (ULONG
)window
->MinHeight
) NewHeight
= window
->MinHeight
;
127 if (NewHeight
> (ULONG
)window
->MaxHeight
) NewHeight
= window
->MaxHeight
;
129 w
->ZipHeight
= w
->window
.Height
;
132 DoMoveSizeWindow(window
, NewLeftEdge
, NewTopEdge
, NewWidth
, NewHeight
, TRUE
, IntuitionBase
);
134 if (window
->Flags
& WFLG_ZOOMED
)
135 AROS_ATOMIC_AND(window
->Flags
, ~WFLG_ZOOMED
);
137 AROS_ATOMIC_OR(window
->Flags
, WFLG_ZOOMED
);