Fixed warnings.
[cake.git] / rom / workbench / removeappwindowdropzone.c
blob8524370fa0f3e028d1938c13a369d793a660d4e3
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Remove a dropzone from a AppWindow's list of AppWindowDropZones.
6 Lang: English
7 */
9 #include <exec/types.h>
10 #include <exec/ports.h>
11 #include <utility/tagitem.h>
12 #include <intuition/intuition.h>
14 #include "workbench_intern.h"
15 #include <workbench/workbench.h>
17 /*****************************************************************************
19 NAME */
21 #include <proto/workbench.h>
23 AROS_LH2(BOOL, RemoveAppWindowDropZone,
25 /* SYNOPSIS */
26 AROS_LHA(struct AppWindow * , aw , A0),
27 AROS_LHA(struct AppWindowDropZone *, dropZone, A1),
29 /* LOCATION */
30 struct WorkbenchBase *, WorkbenchBase, 20, Workbench)
32 /* FUNCTION
34 Try to remove a drop zone from an AppWindow.
36 INPUTS
38 appWindow -- pointer to the AppWindow (as returned by AddAppWindow()) to
39 try to remove the drop zone from; a value of NULL will
40 result in no operation
41 dropZone -- pointer to an AppWindowDropZone (as returned by
42 AddAppWindowDropZone()); a value of NULL will result in
43 no operation
45 RESULT
47 TRUE if the drop zone could be removed, FALSE otherwise. In case of
48 failure, the reason may be obtained from dos.library/IoErr(). This
49 function may fail if the specified drop zone is not registered with
50 the supplied AppWindow.
52 NOTES
54 You must check for drop zone messages for zones that you just removed as
55 there might have been messages sent between the last time you checked and
56 the call to this function.
58 EXAMPLE
60 BUGS
62 SEE ALSO
64 INTERNALS
66 ******************************************************************************/
68 AROS_LIBFUNC_INIT
70 struct AppWindowDropZone *dz;
72 BOOL found = FALSE; /* Is the drop zone 'dropZone' added to the
73 window 'aw'? */
75 if ((aw == NULL) || (dropZone == NULL))
77 SetIoErr(ERROR_REQUIRED_ARG_MISSING);
79 return FALSE;
82 LockWorkbench();
83 ForeachNode(&aw->aw_DropZones, dz)
85 if (dz == dropZone)
87 found = TRUE;
88 break;
92 if (!found)
94 UnlockWorkbench();
95 SetIoErr(ERROR_OBJECT_NOT_FOUND);
97 return FALSE;
100 Remove((struct Node *)dropZone);
101 UnlockWorkbench();
103 FreeVec(dropZone);
105 /* NotifyWorkbench(WBNOTIFY_Delete, WBNOTIFY_DropZone, WorkbenchBase); */
107 return TRUE;
109 AROS_LIBFUNC_EXIT
110 } /* RemoveAppWindowDropZone */