tkEntry.c revision 3f54fd611f536639ec30dd53c48e5ec1897cc7d9
/*
* tkEntry.c --
*
* This module implements entry widgets for the Tk
* toolkit. An entry displays a string and allows
* the string to be edited.
*
* Copyright (c) 1990-1994 The Regents of the University of California.
* Copyright (c) 1994-1996 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* SCCS: @(#) tkEntry.c 1.102 96/08/06 17:27:33
*/
#include "tkInt.h"
#include "tkDefault.h"
/*
* A data structure of the following type is kept for each entry
* widget managed by this file:
*/
typedef struct {
* means that the window has been destroyed
* but the data structures haven't yet been
* cleaned up.*/
* other things, so that resources can be
* freed even after tkwin has gone away. */
int numChars; /* Number of non-NULL characters in
* string (may be 0). */
char *string; /* Pointer to storage for string;
* NULL-terminated; malloc-ed. */
char *textVarName; /* Name of variable (malloc'ed) or NULL.
* If non-NULL, entry's string tracks the
* contents of this variable and vice versa. */
* when disabled. */
/*
* Information used when displaying widget:
*/
* window, plus used for background. */
int borderWidth; /* Width of 3-D border around window. */
int relief; /* 3-D effect: TK_RELIEF_RAISED, etc. */
* characters. */
int selBorderWidth; /* Width of border around selection. */
* cursor. */
int insertWidth; /* Total width of insert cursor. */
int insertBorderWidth; /* Width of 3-D border around insert cursor. */
int insertOnTime; /* Number of milliseconds cursor should spend
* in "on" state for each blink. */
int insertOffTime; /* Number of milliseconds cursor should spend
* in "off" state for each blink. */
/* Timer handler used to blink cursor on and
* off. */
int highlightWidth; /* Width in pixels of highlight to draw
* around widget when it has the focus.
* <= 0 means don't draw a highlight. */
/* Color for drawing traversal highlight
* area when highlight is off. */
* window. */
int avgWidth; /* Width of average character. */
int prefWidth; /* Desired width of window, measured in
* average characters. */
int inset; /* Number of pixels on the left and right
* sides that are taken up by XPAD, borderWidth
* (if any), and highlightWidth (if any). */
int leftIndex; /* Index of left-most character visible in
* window. */
int leftX; /* X position at which leftIndex is drawn
* (varies depending on justify). */
int tabOrigin; /* Origin for tabs (left edge of string[0]). */
int insertPos; /* Index of character before which next
* typed character will be inserted. */
char *showChar; /* Value of -show option. If non-NULL, first
* character is used for displaying all
* characters in entry. Malloc'ed. */
char *displayString; /* If non-NULL, points to string with same
* length as string but whose characters
* are all equal to showChar. Malloc'ed. */
/*
* Information about what's selected, if any.
*/
int selectFirst; /* Index of first selected character (-1 means
* nothing selected. */
int selectLast; /* Index of last selected character (-1 means
* nothing selected. */
int selectAnchor; /* Fixed end of selection (i.e. "select to"
* operation will use this as one end of the
* selection). */
int exportSelection; /* Non-zero means tie internal entry selection
* to X selection. */
/*
* Information for scanning:
*/
int scanMarkX; /* X-position at which scan started (e.g.
* button was pressed here). */
int scanMarkIndex; /* Index of character that was at left of
* window when scan started. */
/*
* Miscellaneous information:
*/
char *takeFocus; /* Value of -takefocus option; not used in
* the C code, but used by keyboard traversal
* scripts. Malloc'ed, but may be NULL. */
char *scrollCmd; /* Command prefix for communicating with
* scrollbar(s). Malloc'ed. NULL means
* no command to issue. */
int flags; /* Miscellaneous flags; see below for
* definitions. */
} Entry;
/*
* Assigned bits of "flags" fields of Entry structures, and what those
* bits mean:
*
* REDRAW_PENDING: Non-zero means a DoWhenIdle handler has
* already been queued to redisplay the entry.
* BORDER_NEEDED: Non-zero means 3-D border must be redrawn
* around window during redisplay. Normally
* only text portion needs to be redrawn.
* CURSOR_ON: Non-zero means insert cursor is displayed at
* present. 0 means it isn't displayed.
* GOT_FOCUS: Non-zero means this window has the input
* focus.
* UPDATE_SCROLLBAR: Non-zero means scrollbar should be updated
* during next redisplay operation.
*/
#define REDRAW_PENDING 1
#define BORDER_NEEDED 2
#define CURSOR_ON 4
#define GOT_FOCUS 8
#define UPDATE_SCROLLBAR 16
/*
* The following macro defines how many extra pixels to leave on each
* side of the text in the entry.
*/
#define XPAD 1
#define YPAD 1
/*
* Information used for argv parsing.
*/
static Tk_ConfigSpec configSpecs[] = {
(char *) NULL, 0, 0},
(char *) NULL, 0, 0},
"ExportSelection", DEF_ENTRY_EXPORT_SELECTION,
(char *) NULL, 0, 0},
"HighlightBackground", DEF_ENTRY_HIGHLIGHT_BG,
"HighlightThickness",
(char *) NULL, 0, 0}
};
/*
* Flags for GetEntryIndex procedure:
*/
#define ZERO_OK 1
#define LAST_PLUS_ONE_OK 2
/*
* Forward declarations for procedures defined later in this file:
*/
int flags));
int count));
static void EntryCmdDeletedProc _ANSI_ARGS_((
int gotFocus));
static void EntryLostSelection _ANSI_ARGS_((
char *value));
static void EntrySelectTo _ANSI_ARGS_((
int flags));
char *string));
/*
*--------------------------------------------------------------
*
* Tk_EntryCmd --
*
* This procedure is invoked to process the "entry" Tcl
* command. See the user documentation for details on what
* it does.
*
* Results:
* A standard Tcl result.
*
* Side effects:
* See the user documentation.
*
*--------------------------------------------------------------
*/
int
* interpreter. */
int argc; /* Number of arguments. */
char **argv; /* Argument strings. */
{
if (argc < 2) {
return TCL_ERROR;
}
return TCL_ERROR;
}
/*
* Initialize the fields of the structure that won't be initialized
* by ConfigureEntry, or that ConfigureEntry requires to be
* initialized already (e.g. resource pointers).
*/
entryPtr->borderWidth = 0;
entryPtr->selBorderWidth = 0;
entryPtr->insertWidth = 0;
entryPtr->insertBorderWidth = 0;
entryPtr->insertOnTime = 0;
entryPtr->insertOffTime = 0;
entryPtr->highlightWidth = 0;
entryPtr->selectAnchor = 0;
entryPtr->scanMarkIndex = 0;
goto error;
}
return TCL_OK;
return TCL_ERROR;
}
/*
*--------------------------------------------------------------
*
* EntryWidgetCmd --
*
* This procedure is invoked to process the Tcl command
* that corresponds to a widget managed by this module.
* See the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
*
* Side effects:
* See the user documentation.
*
*--------------------------------------------------------------
*/
static int
int argc; /* Number of arguments. */
char **argv; /* Argument strings. */
{
int c, height;
if (argc < 2) {
return TCL_ERROR;
}
c = argv[1][0];
if (argc != 3) {
argv[0], " bbox index\"",
(char *) NULL);
goto error;
}
goto error;
}
index--;
}
&x1);
&x2);
} else {
}
&& (length >= 2)) {
if (argc != 3) {
argv[0], " cget option\"",
(char *) NULL);
goto error;
}
&& (length >= 2)) {
if (argc == 2) {
} else if (argc == 3) {
} else {
}
argv[0], " delete firstIndex ?lastIndex?\"",
(char *) NULL);
goto error;
}
goto error;
}
if (argc == 3) {
} else {
goto error;
}
}
}
if (argc != 2) {
goto error;
}
&& (length >= 2)) {
if (argc != 3) {
argv[0], " icursor pos\"",
(char *) NULL);
goto error;
}
!= TCL_OK) {
goto error;
}
&& (length >= 3)) {
int index;
if (argc != 3) {
goto error;
}
goto error;
}
&& (length >= 3)) {
int index;
if (argc != 4) {
argv[0], " insert index text\"",
(char *) NULL);
goto error;
}
goto error;
}
}
int x;
if (argc != 4) {
goto error;
}
goto error;
}
EntryScanTo(entryPtr, x);
} else {
"\": must be mark or dragto", (char *) NULL);
goto error;
}
if (argc < 3) {
goto error;
}
c = argv[2][0];
if (argc != 3) {
goto error;
}
}
goto done;
if (argc != 3) {
goto error;
}
} else {
}
goto done;
}
if (argc >= 4) {
goto error;
}
}
if (argc != 4) {
argv[0], " selection adjust index\"",
(char *) NULL);
goto error;
}
if (entryPtr->selectFirst >= 0) {
} else {
/*
* We're at about the halfway point in the selection;
* just keep the existing anchor.
*/
}
}
if (argc != 4) {
argv[0], " selection from index\"",
(char *) NULL);
goto error;
}
if (argc != 5) {
argv[0], " selection range start end\"",
(char *) NULL);
goto error;
}
goto error;
}
} else {
&& (entryPtr->exportSelection)) {
}
}
}
if (argc != 4) {
argv[0], " selection to index\"",
(char *) NULL);
goto error;
}
} else {
"\": must be adjust, clear, from, present, range, or to",
(char *) NULL);
goto error;
}
if (argc == 2) {
goto done;
} else if (argc == 3) {
goto error;
}
} else {
switch (type) {
case TK_SCROLL_ERROR:
goto error;
case TK_SCROLL_MOVETO:
break;
case TK_SCROLL_PAGES:
if (charsPerPage < 1) {
charsPerPage = 1;
}
break;
case TK_SCROLL_UNITS:
break;
}
}
}
if (index < 0) {
index = 0;
}
} else {
"\": must be bbox, cget, configure, delete, get, ",
"icursor, index, insert, scan, selection, or xview",
(char *) NULL);
goto error;
}
done:
return result;
return TCL_ERROR;
}
/*
*----------------------------------------------------------------------
*
* DestroyEntry --
*
* This procedure is invoked by Tcl_EventuallyFree or Tcl_Release
* to clean up the internal structure of an entry at a safe time
* (when no-one is using it anymore).
*
* Results:
* None.
*
* Side effects:
* Everything associated with the entry is freed up.
*
*----------------------------------------------------------------------
*/
static void
char *memPtr; /* Info about entry widget. */
{
/*
* Free up all the stuff that requires special handling, then
* let Tk_FreeOptions handle all the standard option-related
* stuff.
*/
}
}
}
}
}
/*
*----------------------------------------------------------------------
*
* ConfigureEntry --
*
* the Tk option database, in order to configure (or reconfigure)
* an entry widget.
*
* Results:
* The return value is a standard Tcl result. If TCL_ERROR is
* returned, then interp->result contains an error message.
*
* Side effects:
* Configuration information, such as colors, border width,
* etc. get set for entryPtr; old resources get freed,
* if there were any.
*
*----------------------------------------------------------------------
*/
static int
* not already have values for some fields. */
int argc; /* Number of valid entries in argv. */
char **argv; /* Arguments. */
int flags; /* Flags to pass to Tk_ConfigureWidget. */
{
int oldExport;
/*
* Eliminate any existing trace on a variable monitored by the entry.
*/
}
return TCL_ERROR;
}
/*
* If the entry is tied to the value of a variable, then set up
* a trace on the variable's value, create the variable if it doesn't
* exist, and set the entry's value from the variable's value.
*/
char *value;
} else {
}
}
/*
* A few other options also need special processing, such as parsing
* the geometry and setting the background from a 3-D border.
*/
"\": must be normal or disabled", (char *) NULL);
return TCL_ERROR;
}
&gcValues);
}
}
if (entryPtr->insertWidth <= 0) {
}
}
/*
* Restart the cursor timing sequence in case the on-time or off-time
* just changed.
*/
}
/*
* Claim the selection if we've suddenly started exporting it.
*/
(ClientData) entryPtr);
}
/*
* Recompute the window's geometry and arrange for it to be
* redisplayed.
*/
if (entryPtr->highlightWidth <= 0) {
entryPtr->highlightWidth = 0;
}
return TCL_OK;
}
/*
*--------------------------------------------------------------
*
* DisplayEntry --
*
* This procedure redraws the contents of an entry window.
*
* Results:
* None.
*
* Side effects:
* Information appears on the screen.
*
*--------------------------------------------------------------
*/
static void
{
char *displayString;
return;
}
/*
* Update the scrollbar if that's needed.
*/
}
/*
* In order to avoid screen flashes, this procedure redraws the
* textual area of the entry into off-screen memory, then copies
* it back on-screen in a single operation. This means there's
* no point in time where the on-screen image has been cleared.
*/
/*
* Compute x-coordinate of the pixel just after last visible
* one, plus vertical position of baseline of text.
*/
/*
* Draw the background in three layers. From bottom to top the
* layers are: normal background, selection background, and
* insertion cursor background.
*/
} else {
}
} else {
}
} else {
}
}
/*
* Draw a special background for the insertion cursor, overriding
* even the selection background. As a special hack to keep the
* cursor visible when the insertion cursor color is the same as
* the color for selected text (e.g., on mono displays), write
* background in the cursor area (instead of nothing) when the
* cursor isn't on. Otherwise the selection would hide the cursor.
*/
0, TK_RELIEF_FLAT);
}
}
}
/*
* Draw the text in three pieces: first the piece to the left of
* the selection, then the selection, then the piece to the right
* of the selection.
*/
} else {
if (count > 0) {
} else {
}
}
}
}
/*
* Draw the border and focus highlight last, so they will overwrite
* any text that extends past the viewable part of the window.
*/
}
if (entryPtr->highlightWidth != 0) {
} else {
}
}
/*
* Everything's been redisplayed; now copy the pixmap onto the screen
* and free up the pixmap.
*/
0, 0);
}
/*
*----------------------------------------------------------------------
*
* EntryComputeGeometry --
*
* This procedure is invoked to recompute information about where
* in its window an entry's string will be displayed. It also
* computes the requested size for the window.
*
* Results:
* None.
*
* Side effects:
* The leftX and tabOrigin fields are recomputed for entryPtr,
* and leftIndex may be adjusted. Tk_GeometryRequest is called
* to register the desired dimensions for the window.
*
*----------------------------------------------------------------------
*/
static void
{
char *p, *displayString;
/*
* If we're displaying a special character instead of the value of
* the entry, recompute the displayString.
*/
}
i--, p++) {
}
*p = 0;
} else {
}
/*
* Recompute where the leftmost character on the display will
* be drawn (entryPtr->leftX) and adjust leftIndex if necessary
* so that we don't let characters hang off the edge of the
* window unless the entire window is full.
*/
if (overflow <= 0) {
- totalLength;
} else {
}
} else {
/*
* The whole string can't fit in the window. Compute the
* maximum number of characters that may be off-screen to
* the left without leaving empty space on the right of the
* window, then don't let leftIndex be any greater than that.
*/
maxOffScreen += 1;
}
}
}
} else {
if (totalLength == 0) {
} else {
}
}
}
/*
*----------------------------------------------------------------------
*
* InsertChars --
*
* Add new characters to an entry widget.
*
* Results:
* None.
*
* Side effects:
* New information gets added to entryPtr; it will be redisplayed
* soon, but not necessarily immediately.
*
*----------------------------------------------------------------------
*/
static void
* elements. */
int index; /* Add the new elements before this
* element. */
char *string; /* New characters to add (NULL-terminated
* string). */
{
int length;
char *new;
if (length == 0) {
return;
}
/*
* Inserting characters invalidates all indexes into the string.
* Touch up the indexes so that they still refer to the same
* characters (at new positions). When updating the selection
* end-points, don't include the new text in the selection unless
* it was completely surrounded by the selection.
*/
}
}
}
}
}
}
/*
*----------------------------------------------------------------------
*
* DeleteChars --
*
* Remove one or more characters from an entry widget.
*
* Results:
* None.
*
* Side effects:
* Memory gets freed, the entry gets modified and (eventually)
* redisplayed.
*
*----------------------------------------------------------------------
*/
static void
int index; /* Index of first character to delete. */
int count; /* How many characters to delete. */
{
char *new;
}
if (count <= 0) {
return;
}
/*
* Deleting characters results in the remaining characters being
* renumbered. Update the various indexes into the string to reflect
* this change.
*/
} else {
}
}
} else {
}
}
}
} else {
}
}
} else {
}
}
} else {
}
}
}
/*
*----------------------------------------------------------------------
*
* EntryValueChanged --
*
* This procedure is invoked when characters are inserted into
* an entry or deleted from it. It updates the entry's associated
* variable, if there is one, and does other bookkeeping such
* as arranging for redisplay.
*
* Results:
* None.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
static void
{
char *newValue;
} else {
}
/*
* The value of the variable is different than what we asked for.
* This means that a trace on the variable modified it. In this
* case our trace procedure wasn't invoked since the modification
* came while a trace was already active on the variable. So,
* update our value to reflect the variable's latest value.
*/
} else {
/*
* Arrange for redisplay.
*/
}
}
/*
*----------------------------------------------------------------------
*
* EntrySetValue --
*
* Replace the contents of a text entry with a given value. This
* procedure is invoked when updating the entry from the entry's
* associated variable.
*
* Results:
* None.
*
* Side effects:
* The string displayed in the entry will change. The selection,
* insertion point, and view may have to be adjusted to keep them
* within the bounds of the new string. Note: this procedure does
* *not* update the entry's associated variable, since that could
* result in an infinite loop.
*
*----------------------------------------------------------------------
*/
static void
* changed. */
char *value; /* New text to display in entry. */
{
}
}
}
}
}
/*
*--------------------------------------------------------------
*
* EntryEventProc --
*
* This procedure is invoked by the Tk dispatcher for various
* events on entryes.
*
* Results:
* None.
*
* Side effects:
* When the window gets deleted, internal structures get
* cleaned up. When it gets exposed, it is redisplayed.
*
*--------------------------------------------------------------
*/
static void
{
}
}
}
EntryFocusProc(entryPtr, 0);
}
}
}
/*
*----------------------------------------------------------------------
*
* EntryCmdDeletedProc --
*
* This procedure is invoked when a widget command is deleted. If
* the widget isn't already in the process of being destroyed,
* this command destroys it.
*
* Results:
* None.
*
* Side effects:
* The widget is destroyed.
*
*----------------------------------------------------------------------
*/
static void
{
/*
* This procedure could be invoked either because the window was
* destroyed and the command was then deleted (in which case tkwin
* is NULL) or because the command was deleted, and then this procedure
* destroys the widget.
*/
}
}
/*
*--------------------------------------------------------------
*
* GetEntryIndex --
*
* Parse an index into an entry and return either its value
* or an error.
*
* Results:
* A standard Tcl result. If all went well, then *indexPtr is
* filled in with the index (into entryPtr) corresponding to
* string. The index value is guaranteed to lie between 0 and
* the number of characters in the string, inclusive. If an
* error occurs then an error message is left in interp->result.
*
* Side effects:
* None.
*
*--------------------------------------------------------------
*/
static int
* specified. */
char *string; /* Specifies character in entryPtr. */
int *indexPtr; /* Where to store converted index. */
{
if (string[0] == 'a') {
} else {
/*
* Some of the paths here leave messages in interp->result,
* so we have to clear it out before storing our own message.
*/
"\"", (char *) NULL);
return TCL_ERROR;
}
} else if (string[0] == 'e') {
} else {
goto badIndex;
}
} else if (string[0] == 'i') {
} else {
goto badIndex;
}
} else if (string[0] == 's') {
return TCL_ERROR;
}
if (length < 5) {
goto badIndex;
}
} else {
goto badIndex;
}
} else if (string[0] == '@') {
goto badIndex;
}
}
roundUp = 0;
roundUp = 1;
}
*indexPtr = 0;
} else {
}
/*
* Special trick: if the x-position was off-screen to the right,
* round the index up to refer to the character just after the
* last visible one on the screen. This is needed to enable the
* last character to be selected, for example.
*/
*indexPtr += 1;
}
} else {
goto badIndex;
}
if (*indexPtr < 0){
*indexPtr = 0;
}
}
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* EntryScanTo --
*
* Given a y-coordinate (presumably of the curent mouse location)
* drag the view in the window to implement the scan operation.
*
* Results:
* None.
*
* Side effects:
* The view in the window may change.
*
*----------------------------------------------------------------------
*/
static void
EntryScanTo(entryPtr, x)
int x; /* X-coordinate to use for scan
* operation. */
{
int newLeftIndex;
/*
* Compute new leftIndex for entry by amplifying the difference
* between the current position and the place where the scan
* started (the "mark" position). If we run off the left or right
* side of the entry, then reset the mark point so that the current
* position continues to correspond to the edge of the window.
* This means that the picture will start dragging as soon as the
* mouse reverses direction (without this reset, might have to slide
* mouse a long ways back before the picture starts moving again).
*/
}
if (newLeftIndex < 0) {
}
}
}
/*
*----------------------------------------------------------------------
*
* EntrySelectTo --
*
* Modify the selection by moving its un-anchored end. This could
* make the selection either larger or smaller.
*
* Results:
* None.
*
* Side effects:
* The selection changes.
*
*----------------------------------------------------------------------
*/
static void
int index; /* Index of element that is to
* become the "other" end of the
* selection. */
{
/*
* Grab the selection if we don't own it already.
*/
(ClientData) entryPtr);
}
/*
* Pick new starting and ending points for the selection.
*/
}
} else {
if (newLast < 0) {
}
}
return;
}
}
/*
*----------------------------------------------------------------------
*
* EntryFetchSelection --
*
* This procedure is called back by Tk when the selection is
* requested by someone. It returns part or all of the selection
* in a buffer provided by the caller.
*
* Results:
* The return value is the number of non-NULL bytes stored
* at buffer. Buffer is filled (or partially filled) with a
* NULL-terminated string containing part or all of the selection,
* as given by offset and maxBytes.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
static int
int offset; /* Offset within selection of first
* character to be returned. */
char *buffer; /* Location in which to place
* selection. */
int maxBytes; /* Maximum number of bytes to place
* at buffer, not including terminating
* NULL character. */
{
int count;
char *displayString;
return -1;
}
}
if (count <= 0) {
return 0;
}
} else {
}
return count;
}
/*
*----------------------------------------------------------------------
*
* EntryLostSelection --
*
* This procedure is called back by Tk when the selection is
* grabbed away from an entry widget.
*
* Results:
* None.
*
* Side effects:
* The existing selection is unhighlighted, and the window is
* marked as not containing a selection.
*
*----------------------------------------------------------------------
*/
static void
{
}
}
/*
*----------------------------------------------------------------------
*
* EventuallyRedraw --
*
* Ensure that an entry is eventually redrawn on the display.
*
* Results:
* None.
*
* Side effects:
* Information gets redisplayed. Right now we don't do selective
* redisplays: the whole window will be redrawn. This doesn't
* seem to hurt performance noticeably, but if it does then this
* could be changed.
*
*----------------------------------------------------------------------
*/
static void
{
return;
}
/*
* Right now we don't do selective redisplays: the whole window
* will be redrawn. This doesn't seem to hurt performance noticeably,
* but if it does then this could be changed.
*/
}
}
/*
*----------------------------------------------------------------------
*
* EntryVisibleRange --
*
* Return information about the range of the entry that is
* currently visible.
*
* Results:
* *firstPtr and *lastPtr are modified to hold fractions between
* 0 and 1 identifying the range of characters visible in the
* entry.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
static void
double *firstPtr; /* Return position of first visible
* character in widget. */
double *lastPtr; /* Return position of char just after
* last visible one. */
{
char *displayString;
int charsInWindow, endX;
} else {
}
*firstPtr = 0.0;
*lastPtr = 1.0;
} else {
}
}
/*
*----------------------------------------------------------------------
*
* EntryUpdateScrollbar --
*
* This procedure is invoked whenever information has changed in
* an entry in a way that would invalidate a scrollbar display.
* If there is an associated scrollbar, then this procedure updates
* it by invoking a Tcl command.
*
* Results:
* None.
*
* Side effects:
* A Tcl command is invoked, and an additional command may be
* invoked to process errors in the command.
*
*----------------------------------------------------------------------
*/
static void
{
char args[100];
int code;
return;
}
"\n (horizontal scrolling command executed by entry)");
}
}
/*
*----------------------------------------------------------------------
*
* EntryBlinkProc --
*
* This procedure is called as a timer handler to blink the
* insertion cursor off and on.
*
* Results:
* None.
*
* Side effects:
* The cursor gets turned on or off, redisplay gets invoked,
* and this procedure reschedules itself.
*
*----------------------------------------------------------------------
*/
static void
{
return;
}
} else {
}
}
/*
*----------------------------------------------------------------------
*
* EntryFocusProc --
*
* This procedure is called whenever the entry gets or loses the
* input focus. It's also called whenever the window is reconfigured
* while it has the focus.
*
* Results:
* None.
*
* Side effects:
* The cursor gets turned on or off.
*
*----------------------------------------------------------------------
*/
static void
int gotFocus; /* 1 means window is getting focus, 0 means
* it's losing it. */
{
if (gotFocus) {
if (entryPtr->insertOffTime != 0) {
(ClientData) entryPtr);
}
} else {
}
}
/*
*--------------------------------------------------------------
*
* EntryTextVarProc --
*
* This procedure is invoked when someone changes the variable
* whose contents are to be displayed in an entry.
*
* Results:
* NULL is always returned.
*
* Side effects:
* The text displayed in the entry will change to match the
* variable.
*
*--------------------------------------------------------------
*/
/* ARGSUSED */
static char *
char *name1; /* Not used. */
char *name2; /* Not used. */
int flags; /* Information about what happened. */
{
char *value;
/*
* If the variable is unset, then immediately recreate it unless
* the whole interpreter is going away.
*/
if (flags & TCL_TRACE_UNSETS) {
}
return (char *) NULL;
}
/*
* Update the entry's text with the value of the variable, unless
* the entry already has that value (this happens when the variable
* changes value because we changed it because someone typed in
* the entry).
*/
value = "";
}
}
return (char *) NULL;
}