diskimage: Compiler delint
[AROS.git] / rom / intuition / screenposition.c
blob5ac98a1d86a1a87e898fb2b65a6405adef0e7168
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved.
4 $Id$
5 */
7 #include <proto/graphics.h>
9 #include "intuition_intern.h"
11 /*****************************************************************************
13 NAME */
14 #include <proto/intuition.h>
16 AROS_LH6(void, ScreenPosition,
18 /* SYNOPSIS */
19 AROS_LHA(struct Screen *, screen, A0),
20 AROS_LHA(ULONG , flags, D0),
21 AROS_LHA(LONG , x1, D1),
22 AROS_LHA(LONG , y1, D2),
23 AROS_LHA(LONG , x2, D3),
24 AROS_LHA(LONG , y2, D4),
26 /* LOCATION */
27 struct IntuitionBase *, IntuitionBase, 132, Intuition)
29 /* FUNCTION
30 Move a screen to the specified position or by the specified
31 increment. Resolution is always the screen resolution.
32 If this move would be out of bounds, the move is clipped at
33 these boundaries. The real new position can be obtained from
34 LeftEdge and TopEdge of the screen's structure.
36 INPUTS
37 screen - Move this screen
38 flags - One of SPOS_RELATIVE, SPOS_ABSOLUTE or SPOS_MAKEVISIBLE
39 Use SPOS_FORCEDRAG to override non-movable screens ie. screens
40 opened with {SA_Draggable,FLASE} attribute.
42 SPOS_RELATIVE (or NULL) moves the screen by a delta of x1,y1.
44 SPOS_ABSOLUTE moves the screen to the specified position x1,y1.
46 SPOS_MAKEVISIBLE moves an oversized scrolling screen to make
47 the rectangle (x1,y1),(x2,y2) visible
48 x1,y1 - Absolute (SPOS_ABSOLUTE) or relative (SPOS_RELATIVE) coordinate
49 to move screen, or upper-left corner of rectangle
50 (SPOS_MAKEVISIBLE)
51 x2,y2 - Ignored with SPOS_ABSOLUTE and SPOS_RELATIVE.
52 Lower-right corner of rectangle with SPOS_MAKEVISIBLE.
54 RESULT
55 None.
57 NOTES
58 SPOS_FORCEDRAG should only be used by the owner of the screen.
60 EXAMPLE
62 BUGS
64 SEE ALSO
65 MoveScreen(), RethinkDisplay()
67 INTERNALS
69 HISTORY
71 *****************************************************************************/
73 AROS_LIBFUNC_INIT
75 struct GfxBase *GfxBase = GetPrivIBase(IntuitionBase)->GfxBase;
77 if ((flags & SPOS_FORCEDRAG) || (GetPrivScreen(screen)->SpecialFlags & SF_Draggable)) {
79 /* First we update the viewport, then attempt to scroll. The bitmap may refuse to scroll
80 too far, in this case offsets in the ViewPort will be adjusted to reflect the real situation.
81 TODO: check if additional bounding has to be implemented. Graphics driver could for example let
82 to scroll the bitmap completely out of the display. */
83 if (flags & SPOS_ABSOLUTE) {
84 D(bug("[ScreenPosition] Absolute position: (%d, %d)\n", x1, y1));
85 screen->ViewPort.DxOffset = x1;
86 screen->ViewPort.DyOffset = y1;
87 } else {
88 D(bug("[ScreenPosition] Relative position: (%d, %d)\n", x1, y1));
89 screen->ViewPort.DxOffset = screen->LeftEdge + x1;
90 screen->ViewPort.DyOffset = screen->TopEdge + y1;
92 D(bug("[ScreenPosition] Scroll to: (%d, %d)\n",screen->ViewPort.DxOffset, screen->ViewPort.DyOffset));
93 ScrollVPort(&screen->ViewPort);
95 /* Bring back the actual resulting values to our screen structure */
96 D(bug("[ScreenPosition] Scroll result: (%d, %d)\n",screen->ViewPort.DxOffset, screen->ViewPort.DyOffset));
97 screen->LeftEdge = screen->ViewPort.DxOffset;
98 screen->TopEdge = screen->ViewPort.DyOffset;
101 AROS_LIBFUNC_EXIT
102 } /* ScreenPosition */