Updated PCI IDs to latest snapshot.
[tangerine.git] / rom / workbench / addappwindowa.c
blob63d34baf9d6d93376b0caba3314762692bf34d5c
1 /*
2 Copyright © 1995-2007, 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
81 struct AppWindow *appWindow;
83 if (window == NULL || msgport == NULL)
85 return NULL;
88 appWindow = AllocVec(sizeof(struct AppWindow), MEMF_ANY | MEMF_CLEAR);
90 if (appWindow == NULL)
92 return NULL;
95 appWindow->aw_ID = id;
96 appWindow->aw_UserData = userdata;
97 appWindow->aw_Window = window;
98 appWindow->aw_MsgPort = msgport;
100 NewList(&appWindow->aw_DropZones);
102 LockWorkbench();
103 AddTail(&WorkbenchBase->wb_AppWindows, (struct Node *)appWindow);
104 UnlockWorkbench();
106 /* NotifyWorkbench(WBNOTIFY_Create, WBNOTIFY_AppWindow, WorkbenchBase); */
108 return appWindow;
110 AROS_LIBFUNC_EXIT
111 } /* AddAppWindowA */