Updated PCI IDs to latest snapshot.
[tangerine.git] / workbench / libs / desktop / dodesktopoperation.c
blob3ace4c0ec6b39d338c1c48b8109af003a948b7c1
1 /*
2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #define MUIMASTER_YES_INLINE_STDARG
8 #include <exec/types.h>
9 #include <exec/memory.h>
10 #include <intuition/classusr.h>
11 #include <libraries/desktop.h>
12 #include <libraries/mui.h>
13 #include <utility/tagitem.h>
15 #include <proto/exec.h>
16 #include <proto/intuition.h>
17 #include <proto/muimaster.h>
18 #include <proto/utility.h>
20 #include "desktop_intern.h"
21 #include "support.h"
23 #include "operationclass.h"
25 #define DEBUG 1
26 #include <aros/debug.h>
28 /*****************************************************************************
30 NAME */
32 #include <proto/desktop.h>
34 AROS_LH2(ULONG, DoDesktopOperationA,
36 /* SYNOPSIS */
38 AROS_LHA(ULONG, operationCode, D0),
39 AROS_LHA(struct TagItem *, tags, D2),
41 /* LOCATION */
43 struct DesktopBase *, DesktopBase, 9, Desktop)
45 FUNCTION
47 INPUTS
49 RESULT
51 NOTES
53 EXAMPLE
55 BUGS
57 SEE ALSO
59 INTERNALS
61 HISTORY
63 *****************************************************************************
66 AROS_LIBFUNC_INIT
67 struct DesktopOperation *dop,
68 *subdop;
69 BOOL found = FALSE;
70 ULONG result = 0;
71 Object *newObject;
72 Object *target;
74 dop = (struct DesktopOperation *) DesktopBase->db_OperationList.lh_Head;
75 while (dop->do_Node.ln_Succ && !found)
77 if (operationCode == dop->do_Code)
79 newObject = NewObjectA(dop->do_Impl->mcc_Class, NULL, NULL);
80 if (newObject)
82 target = (Object *) GetTagData(DDO_Target, NULL, tags);
83 if (target)
85 result =
86 DoMethod(newObject, OPM_Execute, (IPTR) target,
87 operationCode);
89 DisposeObject(newObject);
92 found = TRUE;
95 if (!IsListEmpty(&dop->do_SubItems))
97 subdop = (struct DesktopOperation *) dop->do_SubItems.lh_Head;
98 while (subdop->do_Node.ln_Succ && !found)
100 if (operationCode == subdop->do_Code)
102 newObject =
103 NewObjectA(subdop->do_Impl->mcc_Class, NULL, NULL);
104 if (newObject)
106 target = (Object *) GetTagData(DDO_Target, NULL, tags);
107 if (target)
109 result =
110 DoMethod(newObject, OPM_Execute, (IPTR) target,
111 operationCode);
113 DisposeObject(newObject);
116 found = TRUE;
119 subdop = (struct DesktopOperation *) subdop->do_Node.ln_Succ;
124 dop = (struct DesktopOperation *) dop->do_Node.ln_Succ;
127 return result;
129 AROS_LIBFUNC_EXIT
130 } /* DoDesktopOperationA */