Autodoc headers unified to avoid misinterpretation by the build script.
[cake.git] / workbench / libs / desktop / createdesktopobjecta.c
blob9fe388fc1f6432ce496d1f1f549a9106ac272315
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 "iconclass.h"
24 #include "iconobserver.h"
25 #include "iconcontainerclass.h"
26 #include "iconcontainerobserver.h"
27 #include "observer.h"
28 #include "presentation.h"
30 #define DEBUG 1
31 #include <aros/debug.h>
33 /*****************************************************************************
35 NAME */
37 #include <proto/desktop.h>
39 AROS_LH2(Object *, CreateDesktopObjectA,
41 /* SYNOPSIS */
43 AROS_LHA(ULONG, kind, D0),
44 AROS_LHA(struct TagItem *, tags, A0),
46 /* LOCATION */
48 struct DesktopBase *, DesktopBase, 8, Desktop)
50 FUNCTION
52 INPUTS
54 RESULT
56 NOTES
58 This function is sloppy - sort it out!
60 EXAMPLE
62 BUGS
64 SEE ALSO
66 INTERNALS
68 *****************************************************************************
71 AROS_LIBFUNC_INIT
73 Object *newObject = NULL,
74 *semanticObject = NULL;
76 switch (kind)
78 case CDO_IconContainer:
80 STRPTR dir = NULL;
81 struct TagItem *tag;
83 tag = FindTagItem(ICOA_Directory, tags);
84 if (tag)
86 dir = (STRPTR) tag->ti_Data;
87 tag->ti_Tag = TAG_IGNORE;
90 newObject = NewObjectA(IconContainer->mcc_Class, NULL, tags);
92 semanticObject = NewObject
94 IconContainerObserver->mcc_Class, NULL,
96 OA_Presentation, (IPTR) newObject,
97 ICOA_Directory, (IPTR) dir,
99 TAG_END
102 set(newObject, PA_Observer, (IPTR) semanticObject);
104 break;
107 case CDO_DiskIcon:
109 STRPTR label = NULL;
110 struct TagItem *labelTI = FindTagItem(IA_Label, tags);
112 if (labelTI != NULL)
114 label = (STRPTR) labelTI->ti_Data;
117 newObject = NewObjectA(DiskIcon->mcc_Class, NULL, tags);
119 semanticObject = NewObject
121 DiskIconObserver->mcc_Class, NULL,
123 IOA_Name, (IPTR) label,
124 OA_Presentation, (IPTR) newObject,
126 TAG_DONE
129 break;
132 case CDO_DrawerIcon:
134 STRPTR label = NULL,
135 directory = NULL;
136 struct TagItem *labelTI = FindTagItem(IA_Label, tags),
137 *directoryTI = FindTagItem(IOA_Directory, tags);
139 if (labelTI != NULL)
141 label = (STRPTR) labelTI->ti_Data;
144 if (directoryTI != NULL)
146 directory = (STRPTR) directoryTI->ti_Data;
149 newObject = NewObjectA(DrawerIcon->mcc_Class, NULL, tags);
151 semanticObject = NewObject
153 DrawerIconObserver->mcc_Class, NULL,
155 IOA_Name, (IPTR) label,
156 OA_Presentation, (IPTR) newObject,
157 IOA_Directory, (IPTR) directory,
159 TAG_DONE
162 break;
165 case CDO_ToolIcon:
167 newObject = NewObjectA(ToolIcon->mcc_Class, NULL, tags);
169 semanticObject = NewObject(ToolIconObserver->mcc_Class, NULL,
170 OA_Presentation, (IPTR) newObject, TAG_END);
171 break;
173 case CDO_ProjectIcon:
174 newObject = NewObjectA(ProjectIcon->mcc_Class, NULL, tags);
176 semanticObject = NewObject
178 ProjectIconObserver->mcc_Class, NULL,
179 OA_Presentation, (IPTR) newObject,
180 TAG_END
182 break;
184 case CDO_TrashcanIcon:
185 newObject = NewObjectA(TrashcanIcon->mcc_Class, NULL, tags);
187 semanticObject = NewObject
189 TrashcanIconObserver->mcc_Class, NULL,
190 OA_Presentation, (IPTR) newObject,
191 TAG_END
193 break;
195 case CDO_Desktop:
196 newObject = NewObjectA
198 DesktopBase->db_Desktop->mcc_Class, NULL, tags
201 semanticObject = NewObject
203 DesktopObserver->mcc_Class, NULL,
204 OA_Presentation, (IPTR) newObject,
205 TAG_END
208 break;
210 case CDO_DirectoryWindow:
212 STRPTR windowClass;
213 Object *windowObject;
215 if (DesktopBase->db_DefaultWindow)
217 windowClass = DesktopBase->db_DefaultWindow->cl_ID;
219 else
221 windowClass = MUIC_Window;
224 windowObject = MUI_NewObject
226 windowClass,
228 MUIA_Window_UseBottomBorderScroller, TRUE,
229 MUIA_Window_UseRightBorderScroller, TRUE,
231 WindowContents, (IPTR) CreateDesktopObjectA
233 CDO_IconContainer, tags
236 TAG_DONE
239 break;
242 return newObject;
244 AROS_LIBFUNC_EXIT
245 } /* CreateWorkbenchObjectA */