2 Copyright © 1995-2002, The AROS Development Team. All rights reserved.
7 #include <aros/debug.h>
9 #include <exec/types.h>
10 #include <exec/memory.h>
11 #include <libraries/mui.h>
12 #include <libraries/desktop.h>
14 #include <proto/exec.h>
15 #include <proto/dos.h>
16 #include <proto/desktop.h>
17 #include <proto/graphics.h>
18 #include <proto/intuition.h>
19 #include <proto/icon.h>
20 #include <proto/layers.h>
21 #include <proto/alib.h>
22 #include <proto/muimaster.h>
23 #include <proto/utility.h>
25 #include <workbench/workbench.h>
30 struct Library
*DesktopBase
;
31 struct Library
*MUIMasterBase
;
35 Object
*app
, *win
, *iconCon
, *vert
, *horiz
;
37 struct MUI_CustomClass
*iconContainerClass
;
40 struct Screen
*screen
;
41 struct NewMenu
*menuDat
;
42 struct TagItem icTags
[6];
45 MUIMasterBase
=OpenLibrary("muimaster.library", 0);
47 printf("could not open muimaster.library\n");
48 DesktopBase
=OpenLibrary("desktop.library", 0);
50 printf("could not open desktop.library\n");
52 menuDat
=BuildDesktopMenus();
54 kprintf("EEK! EEKK! Menu ERROR!!!\n");
56 screen
=LockPubScreen(NULL
);
59 MUIA_Prop_Horiz
, TRUE
,
61 MUIA_Prop_UseWinBorder
, MUIV_Prop_UseWinBorder_Bottom
,
64 MUIA_Prop_Horiz
, FALSE
,
65 MUIA_Prop_UseWinBorder
, MUIV_Prop_UseWinBorder_Right
,
68 icTags
[0].ti_Tag
=MUIA_InnerLeft
;
70 icTags
[1].ti_Tag
=MUIA_InnerTop
;
72 icTags
[2].ti_Tag
=MUIA_InnerBottom
;
74 icTags
[3].ti_Tag
=MUIA_InnerRight
;
76 icTags
[4].ti_Tag
=MUIA_FillArea
;
77 icTags
[4].ti_Data
=FALSE
;
78 // icTags[1].ti_Tag=ICOA_Directory;
79 // icTags[1].ti_Data="C:";
80 // icTags[2].ti_Tag=ICA_VertScroller;
81 // icTags[2].ti_Data=vert;
82 // icTags[3].ti_Tag=ICA_HorizScroller;
83 // icTags[3].ti_Data=horiz;
84 icTags
[5].ti_Tag
=TAG_END
;
89 app
=ApplicationObject
,
90 SubWindow
, win
=WindowObject
,
91 MUIA_Window_Backdrop
, TRUE
,
92 MUIA_Window_Borderless
, TRUE
,
93 MUIA_Window_CloseGadget
, FALSE
,
94 MUIA_Window_DepthGadget
, FALSE
,
95 MUIA_Window_SizeGadget
, FALSE
,
96 MUIA_Window_DragBar
, FALSE
,
97 MUIA_Window_LeftEdge
, 0,
98 MUIA_Window_TopEdge
, screen
->BarHeight
+1,
99 MUIA_Window_Width
, screen
->Width
,
100 MUIA_Window_Height
, screen
->Height
-screen
->BarHeight
-1,
101 MUIA_Window_Menustrip
, strip
=MUI_MakeObject(MUIO_MenustripNM
, menuDat
, 0),
102 // MUIA_Window_UseBottomBorderScroller, TRUE,
103 // MUIA_Window_UseRightBorderScroller, TRUE,
104 MUIA_Window_EraseArea
, FALSE
,
105 WindowContents
, iconCon
=CreateDesktopObjectA(CDO_Desktop
, icTags
),
112 DoMethod(win
, MUIM_Notify
, MUIA_Window_CloseRequest
, TRUE
, app
, 2, MUIM_Application_ReturnID
, MUIV_Application_ReturnID_Quit
);
114 // these are here temporarily..
115 DoMethod(vert
, MUIM_Notify
, MUIA_Prop_First
, MUIV_EveryTime
, iconCon
, 3, MUIM_Set
, ICA_ScrollToVert
, MUIV_TriggerValue
);
116 DoMethod(horiz
, MUIM_Notify
, MUIA_Prop_First
, MUIV_EveryTime
, iconCon
, 3, MUIM_Set
, ICA_ScrollToHoriz
, MUIV_TriggerValue
);
118 SetAttrs(win
, MUIA_Window_Open
, TRUE
, TAG_DONE
);
122 inputResult
=DoMethod(app
, MUIM_Application_Input
, &signals
);
125 case MUIV_Application_ReturnID_Quit
:
133 // a menuitem was selected...
134 struct MinList
*subjects
=NULL
;
135 Object
*member
, *ostate
;
136 Tag activeSubjectsTag
;
137 struct TagItem args
[2];
139 if(inputResult
& DOC_DESKTOPOP
)
141 args
[0].ti_Tag
=DDO_Target
;
142 args
[0].ti_Data
=iconCon
;
143 args
[1].ti_Tag
=TAG_END
;
146 DoDesktopOperation(inputResult
, args
);
148 else if(inputResult
& DOC_ICONOP
)
150 GetAttr(AICA_SelectedIcons
, iconCon
, &subjects
);
152 ostate
=subjects
->mlh_Head
;
153 while((member
=NextObject(&ostate
)))
155 args
[0].ti_Tag
=DDO_Target
;
156 args
[0].ti_Data
=member
;
157 args
[1].ti_Tag
=TAG_END
;
160 DoDesktopOperation(inputResult
, args
);
163 else if(inputResult
& DOC_WINDOWOP
)
165 GetAttr(DA_ActiveWindow
, iconCon
, &subjects
);
167 args
[0].ti_Tag
=DDO_Target
;
168 args
[0].ti_Data
=subjects
;
169 args
[1].ti_Tag
=TAG_END
;
172 DoDesktopOperation(inputResult
, args
);
177 if(running
&& signals
)
181 SetAttrs(win
, MUIA_Window_Open
, FALSE
, TAG_DONE
);
186 kprintf("could not create app\n");
189 CloseLibrary(DesktopBase
);
190 CloseLibrary(MUIMasterBase
);