HUNKF_FAST | HUNKF_CHIP = next long is memory flag. HUNKF_ADVISORY = ignore following...
[AROS.git] / rom / intuition / setwindowtitles.c
blob620c7601530f7e292cfcfef61cf7e84f2312add6
1 /*
2 Copyright 1995-2008, The AROS Development Team. All rights reserved.
3 Copyright 2001-2003, The MorphOS Development Team. All Rights Reserved.
4 $Id$
5 */
7 #include <proto/layers.h>
8 #include "intuition_intern.h"
9 #include "inputhandler_actions.h"
11 #ifdef __MORPHOS__
12 # include "renderwindowframe.h"
13 #endif
15 #include <string.h>
17 struct SetWindowTitlesActionMsg
19 struct IntuiActionMsg msg;
20 struct Window *window;
21 CONST_STRPTR windowTitle;
22 CONST_STRPTR screenTitle;
25 static VOID int_setwindowtitles(struct SetWindowTitlesActionMsg *msg,
26 struct IntuitionBase *IntuitionBase);
28 /*****************************************************************************
30 NAME */
31 #include <proto/intuition.h>
33 AROS_LH3(void, SetWindowTitles,
35 /* SYNOPSIS */
36 AROS_LHA(struct Window *, window, A0),
37 AROS_LHA(CONST_STRPTR, windowTitle, A1),
38 AROS_LHA(CONST_STRPTR, screenTitle, A2),
40 /* LOCATION */
41 struct IntuitionBase *, IntuitionBase, 46, Intuition)
43 /* FUNCTION
44 Changes the current window and/or the screen title.
46 INPUTS
47 window - Change the title for this window or the screen which the
48 window contains.
49 windowTitle - New title for the window or ((UBYTE *)~0L) to keep the
50 old title or NULL for no title. If you specify a string,
51 this string is *NOT* copied.
52 screenTitle - New title for the screen of the window or ((UBYTE *)~0L)
53 to keep the old title or NULL for no title. If you specify
54 a title for the screen, this title will be shown when the
55 window becomes active. If you specify a string, this string
56 is *NOT* copied.
58 RESULT
59 None.
61 NOTES
62 You should be careful with specifying a screen title because that
63 may irritate the user.
65 EXAMPLE
67 BUGS
69 SEE ALSO
71 INTERNALS
73 *****************************************************************************/
75 AROS_LIBFUNC_INIT
77 struct SetWindowTitlesActionMsg msg;
79 SANITY_CHECK(window)
81 msg.window = window;
82 msg.windowTitle = windowTitle;
83 msg.screenTitle = screenTitle;
85 DoASyncAction((APTR)int_setwindowtitles , &msg.msg, sizeof(msg), IntuitionBase);
87 AROS_LIBFUNC_EXIT
88 } /* SetWindowTitles */
90 static VOID int_setwindowtitles(struct SetWindowTitlesActionMsg *msg,
91 struct IntuitionBase *IntuitionBase)
93 struct Window *window = msg->window;
94 CONST_STRPTR windowTitle = msg->windowTitle;
95 CONST_STRPTR screenTitle = msg->screenTitle;
96 BOOL change = TRUE;
98 LOCKWINDOWLAYERS(window);
100 /* Change window's title */
101 if (windowTitle == (CONST_STRPTR)~0)
103 change = FALSE;
105 else
107 /* FIXME: Should we be strdup()ing this? */
108 window->Title = (UBYTE *)windowTitle;
109 if (windowTitle)
110 if (strncmp(windowTitle,IW(window)->titlebuffer,TITLEBUFFERLEN) == 0) change = FALSE;
113 if (change)
115 #ifdef __MORPHOS__
116 if (window == GetPrivScreen(window->WScreen)->TitlebarBufferWin) GetPrivScreen(window->WScreen)->TitlebarBufferWin = 0;
117 #endif
118 int_RefreshWindowFrame(window, REFRESHGAD_TOPBORDER, 0, DOUBLEBUFFER, IntuitionBase);
121 /* Change screen's title */
122 if (screenTitle != (CONST_STRPTR)~0)
124 //LONG lock = LockIBase(0);
126 /* FIXME: Should we be strdup()ing this? */
127 window->ScreenTitle = (UBYTE *)screenTitle;
129 if (window->Flags & (WFLG_WINDOWACTIVE | WFLG_TOOLBOX))
131 if (screenTitle)
132 /* FIXME: Should we be strdup()ing this? */
133 window->WScreen->Title = (UBYTE *)screenTitle;
134 else
135 window->WScreen->Title = window->WScreen->DefaultTitle;
137 RenderScreenBar(window->WScreen, FALSE, IntuitionBase);
139 //UnlockIBase(lock);
142 UNLOCKWINDOWLAYERS(window);