Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / libs / reqtools / rtgetstringa.c
blob208647ce1ba520843d9d830deb0665347fd6b7bb
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: English
7 */
9 #include <exec/types.h>
10 #include <proto/exec.h>
11 #include <proto/reqtools.h>
12 #include <proto/intuition.h>
13 #include <exec/libraries.h>
14 #include <exec/memory.h>
15 #include <libraries/reqtools.h>
16 #include <aros/libcall.h>
18 #include "reqtools_intern.h"
19 #include "general.h"
21 /*****************************************************************************
23 NAME */
25 AROS_LH5(ULONG, rtGetStringA,
27 /* SYNOPSIS */
29 AROS_LHA(UBYTE *, buffer, A1),
30 AROS_LHA(ULONG, maxchars, D0),
31 AROS_LHA(char *, title, A2),
32 AROS_LHA(struct rtReqInfo *, reqinfo, A3),
33 AROS_LHA(struct TagItem *, taglist, A0),
35 /* LOCATION */
37 struct ReqToolsBase *, ReqToolsBase, 12, ReqTools)
39 /* FUNCTION
40 Puts up a string requester to get a line of text from the user. The
41 string present in 'buffer' upon entry will be displayed, ready to
42 be edited.
44 'reqinfo' can be used to customize the requester. For greater
45 control use the tags listed below. The advantage of the rtReqInfo
46 structure is that it is global, where tags have to be specified
47 each function call. See libraries/reqtools.[hi] for a description
48 of the rtReqInfo structure.
50 INPUTS
51 buffer - pointer to buffer to hold characters entered.
52 maxchars - maximum number of characters that fit in buffer
53 (EX-cluding the 0 to terminate the string !).
54 title - pointer to null terminated title of requester window.
55 reqinfo - pointer to a rtReqInfo structure allocated with
56 rtAllocRequest() or NULL.
57 taglist - pointer to a TagItem array.
59 TAGS
60 RT_Window - see rtEZRequestA()
62 RT_IDCMPFlags - see rtEZRequestA()
64 RT_ReqPos - see rtEZRequestA()
66 RT_LeftOffset - see rtEZRequestA()
68 RT_TopOffset - see rtEZRequestA()
70 RT_PubScrName - see rtEZRequestA()
72 RT_Screen - see rtEZRequestA()
74 RT_ReqHandler - see rtEZRequestA()
76 RT_WaitPointer - see rtEZRequestA()
78 RT_Underscore - [V38] see rtEZRequestA(). Only when you also use
79 the RTGS_GadFmt tag.
81 RT_LockWindow - [V38] see rtEZRequestA()
83 RT_ScreenToFront - [V38] see rtEZRequestA()
85 RT_ShareIDCMP - [V38] see rtEZRequestA()
87 RT_Locale - [V38] see rtEZRequestA()
89 RT_IntuiMsgFunc - [V38] see rtEZRequestA()
91 RT_TextAttr - [V38] see rtEZRequestA(). Note that under 1.2/1.3 the
92 string gadget's font will remain the screen font.
94 RTGS_Width - (ULONG) Width of requester window in pixels. This is
95 only a suggestion. rtGetStringA() will not go below a certain
96 width.
98 RTGS_AllowEmpty - (BOOL) If RTGS_AllowEmpty is TRUE an empty string
99 will also be accepted and returned. Defaults to FALSE, meaning
100 that if the user enters an empty string the requester will be
101 canceled.
103 RTGS_GadFmt - (char *) [V38] Using this tag you can offer the user
104 severalresponses. See rtEZRequestA() for more information. Note
105 that selecting this gadget is considered a positive response so
106 the string in the gadget is copied to 'buffer'.
108 RTGS_GadFmtArgs - (APTR) [V38] If you used formatting codes with
109 RTGS_GadFmt use this tag to pass the arguments.
111 RTGS_Invisible - (BOOL) [V38] Using this tag you can switch on
112 invisible typing. Very useful if you need to get something like
113 a password from the user. It is strongly advised to use an
114 empty initial string or the user may get very confused!
115 Default is FALSE.
117 RTGS_BackFill - (BOOL) [V38] Backfill requester window with
118 pattern. Default TRUE.
120 RTGS_TextFmt - (char *) [V38] Print these lines of text above the
121 gadget in the requester. Very useful to inform the user of what
122 he should enter. Most of the time you will also want to set the
123 GSREQF_CENTERTEXT flag. If you set the RTGS_BackFill tag to
124 FALSE _no_ recessed border will be placed around the text.
125 Formatting codes may be used in the string (see
126 RTGS_TextFmtArgs tag).
128 RTGS_TextFmtArgs - (APTR) [V38] If you used formatting codes with
129 RTGS_TextFmt use this tag to pass the arguments.
131 RTGS_Flags - (ULONG) [V38]
133 GSREQF_CENTERTEXT - centers each line of text above the gadget
134 in the requester window. Should be generally set.
136 GSREQF_HIGHLIGHTTEXT - Highlight text above the gadget. You
137 will normally only want to use this if you also turned off
138 the window backfilling.
140 RESULT
141 ret - TRUE if user entered something, FALSE if not. If one of your
142 idcmp flags caused the requester to end 'ret' will hold this
143 flag. If you used the RTGS_GadFmt tag the return code will hold
144 the value of the response as with rtEZRequestA().
146 NOTES
147 The contents of the buffer will NOT change if the requester is
148 aborted.
150 Automatically adjusts the requester to the screen font.
152 rtGetStringA() checks the pr_WindowPtr of your process to find the
153 screen to put the requester on.
155 If you use the RTGS_GadFmt tag the return value is not always the
156 gadget the user selected. If the string gadget is empty and the
157 user presses the leftmost gadget (normally 'Ok') rtGetString() will
158 return 0 (FALSE)! If the string gadget is empty and the user
159 presses one of the other gadgets rtGetString() _will_ return its
160 value! Important: 'buffer' will not be changed in either of these
161 cases.
162 If you set the RTGS_AllowEmpty tag to TRUE 'buffer' will always be
163 changed of course, and rtGetString() will always return the value
164 of the gadget pressed.
166 EXAMPLE
168 BUGS
169 none known
171 SEE ALSO
173 INTERNALS
175 HISTORY
177 ******************************************************************************/
179 AROS_LIBFUNC_INIT
181 return GetString(buffer,
182 maxchars,
183 title,
185 NULL,
186 ENTER_STRING,
187 reqinfo,
188 taglist);
190 AROS_LIBFUNC_EXIT
192 } /* rtgetstringa */