This is a patch for the gtkentry widget. It has been made against gtk+-1.1.1.
but has also been successfully applied against the gtk+-SNAP-980808 snapshot.

It enhances the entry field with the functionality of a validation mask.
The entry example has also been updated to reflect the changes.
As a side effect an overstrike mode could now easily be added (the hooks are
there now, however as overstriking should be an application state and not a
widget state I haven't done it )

A Mask is set using:
void gtk_entry_set_validation_mask(GtkEntry *entry, const gchar *inmask); 
It may be cleard again by passing a NULL pointer as inmask.

A validation mask is a text string. Each character in the validation mask
corresponds to a character in the entry field, and specifies wich characters
are valid at that field position.

The following characters can be included as part of a validtaion mask:
	#	Any digit, minus sign, comma, decimal point, or plus sign
		is valid at this field position.
	@	Any digit is valid at this field position.
	H	Any hexadecimal digit (digit plus A-F) is valid at this
		field position
	U	Any alphabetic character is valid at this field position.
		Lower case characters are converted to upper case.
	L	Any alphabetic character is valid at this field position.
		Upper case characters are converted to lower case
	A	Any alphabetic character is valid at this field position.
		No case conversion performed
	*	Any character is valid at this field position.
	\	The next character is treadted as a literal, even if it is
		one of the characters listed above
		(in an actual C string that would have to be "\\A" for example
	Any character that appears in a mask and is not one of the special
	characters described above is treated as a literal. Literals are
	displayed in the field to help the user recognize what the field is
	expected to contain. They cannot be deleted or overwritten by the user.
	If setting a value with gtk_entry_set_text literals must not be
	included. However they are currently being returned when text is
	retrieved using gtk_entry_get_text.

Text cannot be deleted, only overwritten, while a validation mask is set.
Should deletion be desired the user whould have to catch the delete signal
and perform an appropiate action (substituting default values or something
like this).

Future development could include:
valid char set	use ? to allow any character in valid char set
visual clues	thins like mask="@@.@@.@@" clue="DD.MM.YY" upon inital showing
partial matching allowing parts of the mask to be left blank


Have fun
Jan

gentsch@ifm.uni-hamburg.de
http://ifmpc118.ifm.uni-hamburg.de

