New bitmap method SetRGBConversionFunction which can be used to
[tangerine.git] / workbench / libs / desktop / createdesktopobjecta.c
blobfc2594f04e4e88fdfe81f081fc17140759933f2a
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 This function is sloppy - sort it out!
58 EXAMPLE
60 BUGS
62 SEE ALSO
64 INTERNALS
66 *****************************************************************************
69 AROS_LIBFUNC_INIT
71 Object *newObject = NULL,
72 *semanticObject = NULL;
74 switch (kind)
76 case CDO_IconContainer:
78 STRPTR dir = NULL;
79 struct TagItem *tag;
81 tag = FindTagItem(ICOA_Directory, tags);
82 if (tag)
84 dir = (STRPTR) tag->ti_Data;
85 tag->ti_Tag = TAG_IGNORE;
88 newObject = NewObjectA(IconContainer->mcc_Class, NULL, tags);
90 semanticObject = NewObject
92 IconContainerObserver->mcc_Class, NULL,
94 OA_Presentation, (IPTR) newObject,
95 ICOA_Directory, (IPTR) dir,
97 TAG_END
100 set(newObject, PA_Observer, (IPTR) semanticObject);
102 break;
105 case CDO_DiskIcon:
107 STRPTR label = NULL;
108 struct TagItem *labelTI = FindTagItem(IA_Label, tags);
110 if (labelTI != NULL)
112 label = (STRPTR) labelTI->ti_Data;
115 newObject = NewObjectA(DiskIcon->mcc_Class, NULL, tags);
117 semanticObject = NewObject
119 DiskIconObserver->mcc_Class, NULL,
121 IOA_Name, (IPTR) label,
122 OA_Presentation, (IPTR) newObject,
124 TAG_DONE
127 break;
130 case CDO_DrawerIcon:
132 STRPTR label = NULL,
133 directory = NULL;
134 struct TagItem *labelTI = FindTagItem(IA_Label, tags),
135 *directoryTI = FindTagItem(IOA_Directory, tags);
137 if (labelTI != NULL)
139 label = (STRPTR) labelTI->ti_Data;
142 if (directoryTI != NULL)
144 directory = (STRPTR) directoryTI->ti_Data;
147 newObject = NewObjectA(DrawerIcon->mcc_Class, NULL, tags);
149 semanticObject = NewObject
151 DrawerIconObserver->mcc_Class, NULL,
153 IOA_Name, (IPTR) label,
154 OA_Presentation, (IPTR) newObject,
155 IOA_Directory, (IPTR) directory,
157 TAG_DONE
160 break;
163 case CDO_ToolIcon:
165 newObject = NewObjectA(ToolIcon->mcc_Class, NULL, tags);
167 semanticObject = NewObject(ToolIconObserver->mcc_Class, NULL,
168 OA_Presentation, (IPTR) newObject, TAG_END);
169 break;
171 case CDO_ProjectIcon:
172 newObject = NewObjectA(ProjectIcon->mcc_Class, NULL, tags);
174 semanticObject = NewObject
176 ProjectIconObserver->mcc_Class, NULL,
177 OA_Presentation, (IPTR) newObject,
178 TAG_END
180 break;
182 case CDO_TrashcanIcon:
183 newObject = NewObjectA(TrashcanIcon->mcc_Class, NULL, tags);
185 semanticObject = NewObject
187 TrashcanIconObserver->mcc_Class, NULL,
188 OA_Presentation, (IPTR) newObject,
189 TAG_END
191 break;
193 case CDO_Desktop:
194 newObject = NewObjectA
196 DesktopBase->db_Desktop->mcc_Class, NULL, tags
199 semanticObject = NewObject
201 DesktopObserver->mcc_Class, NULL,
202 OA_Presentation, (IPTR) newObject,
203 TAG_END
206 break;
208 case CDO_DirectoryWindow:
210 STRPTR windowClass;
211 Object *windowObject;
213 if (DesktopBase->db_DefaultWindow)
215 windowClass = DesktopBase->db_DefaultWindow->cl_ID;
217 else
219 windowClass = MUIC_Window;
222 windowObject = MUI_NewObject
224 windowClass,
226 MUIA_Window_UseBottomBorderScroller, TRUE,
227 MUIA_Window_UseRightBorderScroller, TRUE,
229 WindowContents, (IPTR) CreateDesktopObjectA
231 CDO_IconContainer, tags
234 TAG_DONE
237 break;
240 return newObject;
242 AROS_LIBFUNC_EXIT
243 } /* CreateWorkbenchObjectA */