1 /* 2 * Motif Tools Library, Version 3.1 3 * $Id: InputFieldP.h,v 1.3 2001/07/20 23:07:49 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: InputFieldP.h,v $ 12 * Revision 1.3 2001/07/20 23:07:49 grmcdorman 13 * This change provides two optional Motif/NuTCracker bug workarounds. 14 * Defines in Xmt.tmpl (normally commented out) turn them on. 15 * 16 * Revision 1.2 2001/04/15 15:29:36 grmcdorman 17 * * XmtCallCallback has two new arguments types: XmtRCallbackUserData, which 18 * is the XmNuserData value, and XmtRCallbackImmediate, which is a value 19 * embedded in the list. 20 * 21 * * Two new functions, XmtCreateQueryListChildren and XmtCreateQueryListChild, 22 * are provided. They are like the XmtCreate* functions except that they 23 * return a list of the widgets created (quark and pointer to the widget). 24 * 25 * * Major enhancements to XmtInputField: 26 * - The input field now has a cancel() action. This reverts the field's 27 * value to that prior to the start of editing (i.e. the last commit). 28 * No default translation is bound to this action, however. 29 * - There is a callback for the cancel action (XmtNcancelCallback). 30 * - The input field can be set to cancel, commit, or do nothing on focus 31 * out. (Previously, it always did a commit). The default is commit. 32 * (XmtNfocusOutAction) 33 * 34 * * XmtLayout: 35 * - It now has a losingFocusCallback (XmNloosingFocusCallback). 36 * - It, and the layout widgets (XmtLayoutBox/XmtLayoutString), now 37 * support background pixmaps. 38 * - It now supports XmNresizePolicy. 39 * - Strings in the layout parser are converted to XmStrings by 40 * XtConvertAndStore, so any custom XmString conversion is used 41 * (as, for example, the Xmt convert, which supports the @[] 42 * embedded items) 43 * 44 * * Other: 45 * - Pixmaps are convered using XtConvertAndStore, again to allow 46 * custom converters. 47 * 48 * Bug Fixes: (for Solaris 2.5.1/Motif 1.2/Sparc system) 49 * * XmtInputField did not work properly if the widget had traversalOn 50 * false. 51 * * XmtLayout's child geometry manager was called by Xt when 52 * a shell child was added to the layout; it did not handle 53 * this case. 54 * * XmtLayout had an XmtWarningMsg call with a missing argument (line 2029). 55 * * Widgets automatically created by XmtLayout parsing have been given 56 * non-blank names. [You may wish to tweak this by adding, for example, 57 * a leading underscore.] 58 * * Under some circumstances, XmtNameToWidget could be called during 59 * widget creation, with 'w->core.num_popups' uninitialized. The 60 * workaround applied is to ignore the popup list if the 'num_popups' 61 * value is more than 50 or negative. 62 * 63 * Revision 1.1.1.1 2001/02/10 13:44:34 motiftools 64 * Initial import of Xmt310 to CVS 65 * 66 * 67 */ 68 69 #ifndef _XmtInputFieldP_h 70 #define _XmtInputFieldP_h 71 72 #include <Xmt/XmtP.h> 73 #include <Xm/TextP.h> 74 #include <Xmt/InputField.h> 75 #include <Xmt/Symbols.h> 76 77 typedef struct _XmtInputFieldClassPart { 78 XtPointer extension; 79 XtActionProc superclassGrabFocus; 80 } XmtInputFieldClassPart; 81 82 typedef struct _XmtInputFieldClassRec { 83 CoreClassPart core_class; 84 XmPrimitiveClassPart primitive_class; 85 XmTextClassPart text_class; 86 XmtInputFieldClassPart input_field_class; 87 } XmtInputFieldClassRec; 88 89 externalref XmtInputFieldClassRec xmtInputFieldClassRec; 90 91 typedef struct _XmtInputFieldPart { 92 /* resources */ 93 String input; /* The string that goes in the text widget */ 94 String pattern; /* allowed characters for the string */ 95 Boolean overstrike; /* overstrike mode? */ 96 String buffer_symbol_name; /* the symbol name for the text value */ 97 String target_symbol_name; /* the symbol name for the converted value */ 98 Boolean auto_insert; /* auto insert constant chars in pattern? */ 99 Boolean auto_delete; /* auto delete constant chars in pattern? */ 100 Boolean match_all; /* input must match all of pattern? */ 101 XtCallbackList cancel_callback; /* called on Cancel action */ 102 XtCallbackList input_callback; /* called on activate or focus out */ 103 XtCallbackList verify_callback; /* called before stuffing into buffer */ 104 XtCallbackList error_callback; /* called when new value is bad */ 105 Boolean beep_on_error; /* beep on bad input? */ 106 Boolean replace_on_error; /*erase bad input and replace with old value?*/ 107 Boolean highlight_on_error; /* highlight bad input? */ 108 String error_string; /* string to display on bad input */ 109 Pixel error_foreground; /* color for highlighting bad input */ 110 Pixel error_background; /* color for highlighting bad input */ 111 int focus_out_action; /* Commit, cancel, or neither on focus out */ 112 /* internal state */ 113 Boolean input_changed; /* whether value has changed since last stored */ 114 String error_value; /* temp. storage for a bad value */ 115 short pattern_length; /* strlen(pattern); */ 116 short pattern_skip; /* state variable for HandlePattern() */ 117 Boolean error_state; /* state variable for HandleError() & UndoError()*/ 118 XmtSymbol buffer_symbol;/* bound buffer symbol */ 119 XmtSymbol target_symbol;/* bound target symbol */ 120 Boolean ignore_symbol_notify; /* prevent recursive loop */ 121 int max_length; /* used with overstrike mode */ 122 Pixel foreground, background; /* save old color values */ 123 #ifdef NUTCRACKER_BUG_WORKAROUND 124 Pixel sensitive_background; /* NuTCracker WINTIF bug work-around */ 125 #endif 126 Boolean notTraversable; /* whether XmPrimitive traversalOn is False */ 127 } XmtInputFieldPart; 128 129 typedef struct _XmtInputFieldRec { 130 CorePart core; 131 XmPrimitivePart primitive; 132 XmTextPart text; 133 XmtInputFieldPart input_field; 134 } XmtInputFieldRec; 135 136 #endif /* _XmtInputFieldP_h */ 137