2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved.
7 #include <proto/utility.h>
8 #include <intuition/windecorclass.h>
9 #include <intuition/scrdecorclass.h>
10 #include <intuition/screens.h>
12 #include <proto/dos.h>
14 #include "intuition_intern.h"
15 #include "intuition_customize.h"
16 #include "inputhandler_actions.h"
18 /*****************************************************************************
21 #include <proto/intuition.h>
23 AROS_LH2(void, ChangeDecoration
,
26 AROS_LHA(ULONG
, ID
, D0
),
27 AROS_LHA(struct NewDecorator
*, nd
, A0
),
30 struct IntuitionBase
*, IntuitionBase
, 152, Intuition
)
33 Setup a new decorator for intuition windows, screens or menus.
36 ID - identifier for decorations, see screens.h
37 nd - an ID dependent NewDecorator structure
43 The function fails if screens are open; use ChangeIntuition() to
44 notify applications that the UI will be changed.
46 This function is private and AROS-specific. Do not use it in regular
58 *****************************************************************************/
62 ObtainSemaphore(&((struct IntIntuitionBase
*)(IntuitionBase
))->ScrDecorSem
);
63 if (ID
== DECORATION_SET
)
66 /* if the current decorator isn´t used remove it */
68 struct NewDecorator
* tnd
;
69 tnd
= ((struct IntIntuitionBase
*)(IntuitionBase
))->Decorator
;
70 if ((tnd
!= NULL
) && (tnd
!= nd
))
72 int_UnloadDecorator(tnd
, IntuitionBase
);
80 if (nd
->nd_Pattern
!= NULL
)
82 nd
->nd_IntPattern
= AllocVec(strlen(nd
->nd_Pattern
) * 2 + 1, MEMF_CLEAR
);
83 if (nd
->nd_IntPattern
)
85 struct DosLibrary
*DOSBase
= GetPrivIBase(IntuitionBase
)->DOSBase
;
87 GetPrivIBase(IntuitionBase
)->DOSBase
= DOSBase
= (struct DosLibrary
*)OpenLibrary("dos.library", 36);
91 if (ParsePattern(nd
->nd_Pattern
, nd
->nd_IntPattern
, strlen(nd
->nd_Pattern
) * 2 + 1) == -1)
93 FreeVec(nd
->nd_IntPattern
);
94 nd
->nd_IntPattern
= NULL
;
102 nd
->nd_ScreenObjOffset
= ((IPTR
) ( (char *)&((struct IntScreen
*)0)->ScrDecorObj
- (char *)0 ));
103 nd
->nd_ScreenMenuObjOffset
= ((IPTR
) ( (char *)&((struct IntScreen
*)0)->MenuDecorObj
- (char *)0 ));
104 nd
->nd_ScreenWindowObjOffset
= ((IPTR
) ( (char *)&((struct IntScreen
*)0)->WinDecorObj
- (char *)0 ));
106 bug("intuition.decor: offsets titleobj = %d, menuobj = %d, winobj = %d\n", nd
->nd_ScreenObjOffset
, nd
->nd_ScreenMenuObjOffset
, nd
->nd_ScreenWindowObjOffset
);
107 Enqueue(&((struct IntIntuitionBase
*)(IntuitionBase
))->Decorations
, (struct Node
*)nd
);
111 ((struct IntIntuitionBase
*)(IntuitionBase
))->Decorator
= nd
;
112 ((struct IntIntuitionBase
*)(IntuitionBase
))->ScrDecorClass
= nd
->nd_ScreenClass
;
113 ((struct IntIntuitionBase
*)(IntuitionBase
))->ScrDecorTags
= nd
->nd_ScreenTags
;
114 ((struct IntIntuitionBase
*)(IntuitionBase
))->MenuDecorClass
= nd
->nd_MenuClass
;
115 ((struct IntIntuitionBase
*)(IntuitionBase
))->MenuDecorTags
= nd
->nd_MenuTags
;
116 ((struct IntIntuitionBase
*)(IntuitionBase
))->WinDecorClass
= nd
->nd_WindowClass
;
117 ((struct IntIntuitionBase
*)(IntuitionBase
))->WinDecorTags
= nd
->nd_WindowTags
;
120 ReleaseSemaphore(&((struct IntIntuitionBase
*)(IntuitionBase
))->ScrDecorSem
);