Some fix for scrolling with lasso.
[tangerine.git] / rom / workbench / addappwindowa.c
blobb489139072b168cfff3fe5a86a15dae4f7f00600
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Add a window to Workbench's list of AppWindows.
6 Lang: English
7 */
9 #include <exec/types.h>
10 #include <exec/ports.h>
11 #include <utility/tagitem.h>
12 #include <intuition/intuition.h>
13 #include <proto/alib.h>
15 #include "workbench_intern.h"
16 #include <workbench/workbench.h>
18 /*****************************************************************************
20 NAME */
22 #include <proto/workbench.h>
24 AROS_LH5(struct AppWindow *, AddAppWindowA,
26 /* SYNOPSIS */
27 AROS_LHA(ULONG , id , D0),
28 AROS_LHA(ULONG , userdata, D1),
29 AROS_LHA(struct Window * , window , A0),
30 AROS_LHA(struct MsgPort *, msgport , A1),
31 AROS_LHA(struct TagItem *, taglist , A2),
33 /* LOCATION */
34 struct WorkbenchBase *, WorkbenchBase, 8, Workbench)
36 /* FUNCTION
38 Try to add an AppWindow to workbench.library's list of AppWindow:s.
39 The supplied message port will be used to send notification messages
40 whenever an icon is dropped on the window. The message will be of
41 type 'MTYPE_APPWINDOW' and am_ArgList will point to the list of icons
42 that were dropped in the window.
44 INPUTS
46 id -- window identifier; for your convenience (ignored by
47 workbench.library)
48 userdata -- user specific data (ignored by workbench.library)
49 window -- pointer to the window to add AppWindow functionality to
50 msgport -- port to which notification messages regarding the window
51 will be sent
52 taglist -- tags (must be NULL)
54 RESULT
56 A pointer to an AppWindow structure to use with RemoveAppWindow() when
57 you want to remove the window from the list of AppWindow:s, or NULL
58 if it was not possible to add the 'window' to the AppWindow list.
60 NOTES
62 Applications generally want to call GetDiskObjectNew() -- rather than
63 GetDiskObject() -- to get disk objects for icons dropped in the window.
64 Contrary to AmigaOS, this function will succeed even when there
65 is no running workbench application.
67 EXAMPLE
69 BUGS
71 SEE ALSO
73 AddAppWindowDropZoneA(), RemoveAppWindow()
75 INTERNALS
77 ******************************************************************************/
79 AROS_LIBFUNC_INIT
80 AROS_LIBBASE_EXT_DECL(struct WorkbenchBase *, WorkbenchBase)
82 struct AppWindow *appWindow;
84 if (window == NULL || msgport == NULL)
86 return NULL;
89 appWindow = AllocVec(sizeof(struct AppWindow), MEMF_ANY | MEMF_CLEAR);
91 if (appWindow == NULL)
93 return NULL;
96 appWindow->aw_ID = id;
97 appWindow->aw_UserData = userdata;
98 appWindow->aw_Window = window;
99 appWindow->aw_MsgPort = msgport;
101 NewList(&appWindow->aw_DropZones);
103 LockWorkbench();
104 AddTail(&WorkbenchBase->wb_AppWindows, (struct Node *)appWindow);
105 UnlockWorkbench();
107 /* NotifyWorkbench(WBNOTIFY_Create, WBNOTIFY_AppWindow, WorkbenchBase); */
109 return appWindow;
111 AROS_LIBFUNC_EXIT
112 } /* AddAppWindowA */