New bitmap method SetRGBConversionFunction which can be used to
[tangerine.git] / rom / intuition / changedecorationa.c
blobd714b0fa11d946ff5926b122ac05b94d5fc82479
1 /*
2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved.
4 $Id: sendintuimessage.c 23476 2005-07-31 17:07:04Z stegerg $
5 */
7 #include <proto/utility.h>
8 #include <intuition/windecorclass.h>
9 #include <intuition/scrdecorclass.h>
10 #include <intuition/screens.h>
12 #include "intuition_intern.h"
13 #include "inputhandler_actions.h"
15 struct ChangeDecorationActionMsg
17 struct IntuiActionMsg msg;
18 ULONG which;
19 Object **decorobjptr;
20 struct SignalSemaphore *decorsem;
21 struct DrawInfo *dri;
24 static VOID int_changedecoration(struct ChangeDecorationActionMsg *msg,
25 struct IntuitionBase *IntuitionBase);
27 /*****************************************************************************
29 NAME */
30 #include <proto/intuition.h>
32 AROS_LH4(Object *, ChangeDecorationA,
34 /* SYNOPSIS */
35 AROS_LHA(ULONG, which, D0),
36 AROS_LHA(CONST_STRPTR, classID, A1),
37 AROS_LHA(struct DrawInfo *, dri, A0),
38 AROS_LHA(struct TagItem *, tagList, A2),
40 /* LOCATION */
41 struct IntuitionBase *, IntuitionBase, 153, Intuition)
43 /* FUNCTION
45 INPUTS
47 RESULT
49 NOTES
51 EXAMPLE
53 BUGS
55 SEE ALSO
57 INTERNALS
59 *****************************************************************************/
61 AROS_LIBFUNC_INIT
62 AROS_LIBBASE_EXT_DECL(struct IntuitionBase *,IntuitionBase)
64 Object *old = 0, *new;
65 struct TagItem decor_tags[] =
67 {TAG_IGNORE , (IPTR)dri },
68 {TAG_IGNORE , (IPTR)((struct IntDrawInfo *)dri)->dri_Screen },
69 {TAG_DONE }
71 struct ChangeDecorationActionMsg msg;
73 ASSERT_VALID_PTR(dri);
75 switch(which)
77 case DECORATION_WINDOW:
78 decor_tags[0].ti_Tag = WDA_DrawInfo;
79 decor_tags[1].ti_Tag = WDA_Screen;
80 msg.decorobjptr = &((struct IntDrawInfo *)dri)->dri_WinDecorObj;
81 msg.decorsem = &((struct IntDrawInfo *)dri)->dri_WinDecorSem;
82 break;
84 case DECORATION_SCREEN:
85 decor_tags[0].ti_Tag = SDA_DrawInfo;
86 decor_tags[1].ti_Tag = SDA_Screen;
87 msg.decorobjptr = &((struct IntDrawInfo *)dri)->dri_ScrDecorObj;
88 msg.decorsem = &((struct IntDrawInfo *)dri)->dri_ScrDecorSem;
89 break;
91 default:
92 return 0;
95 new = NewObjectA(NULL, (UBYTE *)classID, decor_tags);
96 if (new)
98 ObtainSemaphore(msg.decorsem);
99 old = *msg.decorobjptr;
100 *msg.decorobjptr = new;
101 ReleaseSemaphore(msg.decorsem);
104 msg.dri = dri;
105 msg.which = which;
106 DoASyncAction((APTR)int_changedecoration, &msg.msg, sizeof(msg), IntuitionBase);
108 return old;
110 AROS_LIBFUNC_EXIT
113 static VOID int_changedecoration(struct ChangeDecorationActionMsg *msg,
114 struct IntuitionBase *IntuitionBase)
116 struct Screen *scr = ((struct IntDrawInfo *)msg->dri)->dri_Screen;
117 struct Window *win;
119 if (!ResourceExisting(scr, RESOURCE_SCREEN, IntuitionBase)) return;
121 switch(msg->which)
123 case DECORATION_WINDOW:
124 for(win = scr->FirstWindow; win; win = win->NextWindow)
126 LOCKGADGET
128 if (win->FirstGadget)
130 struct wdpLayoutBorderGadgets layoutmsg;
132 layoutmsg.MethodID = WDM_LAYOUT_BORDERGADGETS;
133 layoutmsg.wdp_Window = win;
134 layoutmsg.wdp_Gadgets = win->FirstGadget;
135 layoutmsg.wdp_Flags = WDF_LBG_MULTIPLE |
136 WDF_LBG_INGADLIST;
138 LOCKSHARED_WINDECOR(msg->dri);
139 DoMethodA(((struct IntDrawInfo *)msg->dri)->dri_WinDecorObj, (Msg)&layoutmsg);
140 UNLOCK_WINDECOR(msg->dri);
143 UNLOCKGADGET
145 RefreshWindowFrame(win);
147 } /* for(win = scr->FirstWindow; win; win = win->NextWindow) */
148 break;
150 case DECORATION_SCREEN:
151 RenderScreenBar(scr, FALSE, IntuitionBase);
152 break;
154 } /* switch(msg->which) */