diff options
-rw-r--r-- | generic/tkEntry.c | 6 | ||||
-rw-r--r-- | generic/tkEntry.h | 6 | ||||
-rw-r--r-- | generic/ttk/ttkEntry.c | 14 | ||||
-rw-r--r-- | tests/entry.test | 12 | ||||
-rw-r--r-- | tests/ttk/entry.test | 12 |
5 files changed, 25 insertions, 25 deletions
diff --git a/generic/tkEntry.c b/generic/tkEntry.c index 054da2f..ac39e22 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.c @@ -56,7 +56,7 @@ enum validateType { }; #define DEF_ENTRY_VALIDATE "none" #define DEF_ENTRY_INVALIDCMD "" -#define DEF_ENTRY_PLACEHOLDERTEXT "" +#define DEF_ENTRY_PLACEHOLDER "" #define DEF_ENTRY_PLACEHOLDERFG "#b3b3b3" /* @@ -85,8 +85,8 @@ static const Tk_OptionSpec entryOptSpec[] = { Tk_Offset(Entry, dfgColorPtr), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_COLOR, "-placeholderforeground", "placeholderForeground", "PlaceholderForeground", DEF_ENTRY_PLACEHOLDERFG, -1, Tk_Offset(Entry, placeholderColorPtr), 0, 0, 0}, - {TK_OPTION_STRING, "-placeholdertext", "placeholderText", "PlaceholderText", - DEF_ENTRY_PLACEHOLDERTEXT, -1, Tk_Offset(Entry, placeholderString), + {TK_OPTION_STRING, "-placeholder", "placeHolder", "PlaceHolder", + DEF_ENTRY_PLACEHOLDER, -1, Tk_Offset(Entry, placeholderString), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BOOLEAN, "-exportselection", "exportSelection", "ExportSelection", DEF_ENTRY_EXPORT_SELECTION, -1, diff --git a/generic/tkEntry.h b/generic/tkEntry.h index 1ad2962..9b82f6c 100644 --- a/generic/tkEntry.h +++ b/generic/tkEntry.h @@ -132,10 +132,10 @@ typedef struct { * Fields used in displaying help text if entry value is empty */ Tk_TextLayout placeholderLayout;/* Cached placeholder text layout information. */ - char *placeholderString; /* String value of -placeholdertext */ - int placeholderChars; /* Number of chars in -placeholdertext */ + char *placeholderString; /* String value of -placeholder */ + int placeholderChars; /* Number of chars in -placeholder */ XColor *placeholderColorPtr;/* Color value of -placeholderforeground */ - GC placeholderGC; /* For drawing -placeholdertext text. */ + GC placeholderGC; /* For drawing -placeholder text. */ /* * Fields whose values are derived from the current values of the diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c index 9f27ef7..54c0d91 100644 --- a/generic/ttk/ttkEntry.c +++ b/generic/ttk/ttkEntry.c @@ -119,7 +119,7 @@ typedef struct { Tcl_Obj *stateObj; /* Compatibility option -- see CheckStateObj */ - Tcl_Obj *placeholderTextObj;/* Text to display for placeholder text */ + Tcl_Obj *placeholderObj; /* Text to display for placeholder text */ /* * Derived resources: @@ -159,8 +159,8 @@ typedef struct { #define DEF_LIST_HEIGHT "10" static Tk_OptionSpec EntryOptionSpecs[] = { - {TK_OPTION_STRING, "-placeholdertext", "placeholderText", "PlaceholderText", - NULL, Tk_Offset(Entry, entry.placeholderTextObj), -1, + {TK_OPTION_STRING, "-placeholder", "placeHolder", "PlaceHolder", + NULL, Tk_Offset(Entry, entry.placeholderObj), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BOOLEAN, "-exportselection", "exportSelection", "ExportSelection", "1", -1, Tk_Offset(Entry, entry.exportSelection), @@ -321,14 +321,14 @@ static void EntryUpdateTextLayout(Entry *entryPtr) int length; char *text; Tk_FreeTextLayout(entryPtr->entry.textLayout); - if (entryPtr->entry.numChars>0 || entryPtr->entry.placeholderTextObj==NULL) { + if (entryPtr->entry.numChars>0 || entryPtr->entry.placeholderObj==NULL) { entryPtr->entry.textLayout = Tk_ComputeTextLayout( Tk_GetFontFromObj(entryPtr->core.tkwin, entryPtr->entry.fontObj), entryPtr->entry.displayString, entryPtr->entry.numChars, 0/*wraplength*/, entryPtr->entry.justify, TK_IGNORE_NEWLINES, &entryPtr->entry.layoutWidth, &entryPtr->entry.layoutHeight); } else { - text = Tcl_GetStringFromObj(entryPtr->entry.placeholderTextObj,&length); + text = Tcl_GetStringFromObj(entryPtr->entry.placeholderObj,&length); entryPtr->entry.textLayout = Tk_ComputeTextLayout( Tk_GetFontFromObj(entryPtr->core.tkwin, entryPtr->entry.fontObj), text,length, @@ -1293,8 +1293,8 @@ static void EntryDisplay(void *clientData, Drawable d) /* Draw the text: */ if (*(entryPtr->entry.displayString) == '\0' - && entryPtr->entry.placeholderTextObj != NULL) { - /* When no display text and -placeholdertext given */ + && entryPtr->entry.placeholderObj != NULL) { + /* When no display text and -placeholder given */ Tcl_GetStringFromObj(es.placeholderForegroundObj,&rightIndex); if (++rightIndex > 1) { foregroundObj = es.placeholderForegroundObj; diff --git a/tests/entry.test b/tests/entry.test index 6a1a22f..7696198 100644 --- a/tests/entry.test +++ b/tests/entry.test @@ -627,11 +627,11 @@ test entry-1.58 {configuration option: "xscrollcommand" for entry} -setup { destroy .e } -result {Some command} -test entry-1.59 {configuration option: "-placeholdertext"} -setup { +test entry-1.59 {configuration option: "-placeholder"} -setup { pack [entry .e] } -body { - .e configure -placeholdertext {Some text} - .e cget -placeholdertext + .e configure -placeholder {Some text} + .e cget -placeholder } -cleanup { destroy .e } -result {Some text} @@ -639,7 +639,7 @@ test entry-1.59 {configuration option: "-placeholdertext"} -setup { test entry-1.60 {configuration option: "-placeholderforeground"} -setup { pack [entry .e] } -body { - .e configure -placeholdertext {Some text} -placeholderforeground red + .e configure -placeholder {Some text} -placeholderforeground red .e cget -placeholderforeground } -cleanup { destroy .e @@ -3519,10 +3519,10 @@ test entry-24.1 {textvariable lives in a non-existing namespace} -setup { destroy .e } -result {can't trace "thisnsdoesntexist::myvar": parent namespace doesn't exist} -test entry-25.1 {-placeholdertext on/off shown} -setup { +test entry-25.1 {-placeholder on/off shown} -setup { pack [entry .e] } -body { - .e configure -placeholdertext {placeholder} -textvariable ::_e + .e configure -placeholder {placeholder} -textvariable ::_e update; after 1000 set ::_e entry update; after 1000 diff --git a/tests/ttk/entry.test b/tests/ttk/entry.test index 5cfdfee..5495fdd 100644 --- a/tests/ttk/entry.test +++ b/tests/ttk/entry.test @@ -280,11 +280,11 @@ test entry-9.1 "Index range invariants" -setup { destroy .e } -test entry-10.1 {configuration option: "-placeholdertext"} -setup { +test entry-10.1 {configuration option: "-placeholder"} -setup { pack [entry .e] } -body { - .e configure -placeholdertext {Some text} - .e cget -placeholdertext + .e configure -placeholder {Some text} + .e cget -placeholder } -cleanup { destroy .e } -result {Some text} @@ -293,7 +293,7 @@ test entry-10.2 {style option: "-placeholderforeground"} -setup { pack [entry .e] } -body { ttk::style configure TEntry -foreground red - .e configure -placeholdertext {Some text} + .e configure -placeholder {Some text} update ttk::style configure TEntry -foreground #b3b3b3 update @@ -301,10 +301,10 @@ test entry-10.2 {style option: "-placeholderforeground"} -setup { destroy .e } -result {} -test entry-10.3 {placeholdertext on/off shown} -setup { +test entry-10.3 {placeholder on/off shown} -setup { pack [entry .e] } -body { - .e configure -placeholdertext {placeholder} -textvariable ::_e + .e configure -placeholder {placeholder} -textvariable ::_e update; after 1000 set ::_e entry update; after 1000 |