1 /*
2  * Motif Tools Library, Version 3.1
3  * $Id: InputField.h,v 1.2 2001/04/15 15:29:36 grmcdorman Exp $
4  *
5  * Written by David Flanagan.
6  * Copyright (c) 1992-2001 by David Flanagan.
7  * All Rights Reserved.  See the file COPYRIGHT for details.
8  * This is open source software.  See the file LICENSE for details.
9  * There is no warranty for this software.  See NO_WARRANTY for details.
10  *
11  * $Log: InputField.h,v $
12  * Revision 1.2  2001/04/15 15:29:36  grmcdorman
13  *   * XmtCallCallback has two new arguments types: XmtRCallbackUserData, which
14  *     is the XmNuserData value, and XmtRCallbackImmediate, which is a value
15  *     embedded in the list.
16  *
17  *   * Two new functions, XmtCreateQueryListChildren and XmtCreateQueryListChild,
18  *     are provided. They are like the XmtCreate* functions except that they
19  *     return a list of the widgets created (quark and pointer to the widget).
20  *
21  *   * Major enhancements to XmtInputField:
22  *     - The input field now has a cancel() action. This reverts the field's
23  *       value to that prior to the start of editing (i.e. the last commit).
24  *       No default translation is bound to this action, however.
25  *     - There is a callback for the cancel action (XmtNcancelCallback).
26  *     - The input field can be set to cancel, commit, or do nothing on focus
27  *       out. (Previously, it always did a commit). The default is commit.
28  *       (XmtNfocusOutAction)
29  *
30  *   * XmtLayout:
31  *     - It now has a losingFocusCallback (XmNloosingFocusCallback).
32  *     - It, and the layout widgets (XmtLayoutBox/XmtLayoutString), now
33  *       support background pixmaps.
34  *     - It now supports XmNresizePolicy.
35  *     - Strings in the layout parser are converted to XmStrings by
36  *       XtConvertAndStore, so any custom XmString conversion is used
37  *       (as, for example, the Xmt convert, which supports the @[]
38  *       embedded items)
39  *
40  *   * Other:
41  *     - Pixmaps are convered using XtConvertAndStore, again to allow
42  *       custom converters.
43  *
44  * Bug Fixes: (for Solaris 2.5.1/Motif 1.2/Sparc system)
45  *   * XmtInputField did not work properly if the widget had traversalOn
46  *     false.
47  *   * XmtLayout's child geometry manager was called by Xt when
48  *     a shell child was added to the layout; it did not handle
49  *     this case.
50  *   * XmtLayout had an XmtWarningMsg call with a missing argument (line 2029).
51  *   * Widgets automatically created by XmtLayout parsing have been given
52  *     non-blank names. [You may wish to tweak this by adding, for example,
53  *     a leading underscore.]
54  *   * Under some circumstances, XmtNameToWidget could be called during
55  *     widget creation, with 'w->core.num_popups' uninitialized. The
56  *     workaround applied is to ignore the popup list if the 'num_popups'
57  *     value is more than 50 or negative.
58  *
59  * Revision 1.1.1.1  2001/02/10 13:44:32  motiftools
60  * Initial import of Xmt310 to CVS
61  *
62  *
63  */
64 
65 #ifndef _XmtInputField_h
66 #define _XmtInputField_h
67 
68 #include <Xm/Text.h>
69 
70 typedef enum {
71     XmtINPUT_COMMIT,
72     XmtINPUT_CANCEL,
73     XmtINPUT_NONE
74 } XmtInputFieldActions;
75 
76 externalref WidgetClass xmtInputFieldWidgetClass;
77 typedef struct _XmtInputFieldClassRec *XmtInputFieldWidgetClass;
78 typedef struct _XmtInputFieldRec *XmtInputFieldWidget;
79 
80 typedef struct {
81     StringConst input;
82                    /* this string can be replaced, but not modified or freed */
83     Boolean okay;  /* set to False if the string is bad */
84                    /* or, set to True to stop error handling */
85 } XmtInputFieldCallbackStruct;
86 
87 externalref _Xconst char XmtInputFieldStrings[];
88 #ifndef XmtNautoDelete
89 #define XmtNautoDelete ((char*)&XmtInputFieldStrings[0])
90 #endif
91 #ifndef XmtNautoInsert
92 #define XmtNautoInsert ((char*)&XmtInputFieldStrings[11])
93 #endif
94 #ifndef XmtNbeepOnError
95 #define XmtNbeepOnError ((char*)&XmtInputFieldStrings[22])
96 #endif
97 #ifndef XmtNbufferSymbolName
98 #define XmtNbufferSymbolName ((char*)&XmtInputFieldStrings[34])
99 #endif
100 #ifndef XmtNcancelCallback
101 #define XmtNcancelCallback ((char*)&XmtInputFieldStrings[399])
102 #endif
103 #ifndef XmtNerrorBackground
104 #define XmtNerrorBackground ((char*)&XmtInputFieldStrings[51])
105 #endif
106 #ifndef XmtNerrorCallback
107 #define XmtNerrorCallback ((char*)&XmtInputFieldStrings[67])
108 #endif
109 #ifndef XmtNerrorForeground
110 #define XmtNerrorForeground ((char*)&XmtInputFieldStrings[81])
111 #endif
112 #ifndef XmtNerrorString
113 #define XmtNerrorString ((char*)&XmtInputFieldStrings[97])
114 #endif
115 #ifndef XmtNfocusOutAction
116 #define XmtNfocusOutAction ((char*)&XmtInputFieldStrings[414])
117 #endif
118 #ifndef XmtNhighlightOnError
119 #define XmtNhighlightOnError ((char*)&XmtInputFieldStrings[109])
120 #endif
121 #ifndef XmtNinput
122 #define XmtNinput ((char*)&XmtInputFieldStrings[126])
123 #endif
124 #ifndef XmtNinputCallback
125 #define XmtNinputCallback ((char*)&XmtInputFieldStrings[132])
126 #endif
127 #ifndef XmtNmatchAll
128 #define XmtNmatchAll ((char*)&XmtInputFieldStrings[146])
129 #endif
130 #ifndef XmtNoverstrike
131 #define XmtNoverstrike ((char*)&XmtInputFieldStrings[155])
132 #endif
133 #ifndef XmtNpattern
134 #define XmtNpattern ((char*)&XmtInputFieldStrings[166])
135 #endif
136 #ifndef XmtNreplaceOnError
137 #define XmtNreplaceOnError ((char*)&XmtInputFieldStrings[174])
138 #endif
139 #ifndef XmtNtargetSymbolName
140 #define XmtNtargetSymbolName ((char*)&XmtInputFieldStrings[189])
141 #endif
142 #ifndef XmtNverifyCallback
143 #define XmtNverifyCallback ((char*)&XmtInputFieldStrings[206])
144 #endif
145 #ifndef XmtCAutoDelete
146 #define XmtCAutoDelete ((char*)&XmtInputFieldStrings[221])
147 #endif
148 #ifndef XmtCAutoInsert
149 #define XmtCAutoInsert ((char*)&XmtInputFieldStrings[232])
150 #endif
151 #ifndef XmtCBeepOnError
152 #define XmtCBeepOnError ((char*)&XmtInputFieldStrings[243])
153 #endif
154 #ifndef XmtCBufferSymbolName
155 #define XmtCBufferSymbolName ((char*)&XmtInputFieldStrings[255])
156 #endif
157 #ifndef XmtCErrorBackground
158 #define XmtCErrorBackground ((char*)&XmtInputFieldStrings[272])
159 #endif
160 #ifndef XmtCErrorForeground
161 #define XmtCErrorForeground ((char*)&XmtInputFieldStrings[288])
162 #endif
163 #ifndef XmtCErrorString
164 #define XmtCErrorString ((char*)&XmtInputFieldStrings[304])
165 #endif
166 #ifndef XmtCFocusOutAction
167 #define XmtCFocusOutAction ((char*)&XmtInputFieldStrings[429])
168 #endif
169 #ifndef XmtCHighlightOnError
170 #define XmtCHighlightOnError ((char*)&XmtInputFieldStrings[316])
171 #endif
172 #ifndef XmtCInput
173 #define XmtCInput ((char*)&XmtInputFieldStrings[333])
174 #endif
175 #ifndef XmtCMatchAll
176 #define XmtCMatchAll ((char*)&XmtInputFieldStrings[339])
177 #endif
178 #ifndef XmtCOverstrike
179 #define XmtCOverstrike ((char*)&XmtInputFieldStrings[348])
180 #endif
181 #ifndef XmtCPattern
182 #define XmtCPattern ((char*)&XmtInputFieldStrings[359])
183 #endif
184 #ifndef XmtCReplaceOnError
185 #define XmtCReplaceOnError ((char*)&XmtInputFieldStrings[367])
186 #endif
187 #ifndef XmtCTargetSymbolName
188 #define XmtCTargetSymbolName ((char*)&XmtInputFieldStrings[382])
189 #endif
190 #ifndef XmtRXmtInputFieldActions
191 #define XmtRXmtInputFieldActions ((char*)&XmtInputFieldStrings[444])
192 #endif
193 
194 _XFUNCPROTOBEGIN
195 #if NeedFunctionPrototypes
196 extern Widget XmtCreateInputField(Widget, StringConst, ArgList, Cardinal);
197 extern void XmtRegisterInputField(void);
198 extern String XmtInputFieldGetString(Widget);
199 extern void XmtInputFieldSetString(Widget, StringConst);
200 #else
201 extern Widget XmtCreateInputField();
202 extern void XmtRegisterInputField();
203 extern String XmtInputFieldGetString();
204 extern void XmtInputFieldSetString();
205 #endif
206 _XFUNCPROTOEND
207 
208 #endif /* _XmtInputField_h */
209