summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tkButton.c35
-rw-r--r--generic/tkInt.h2
-rw-r--r--generic/tkListbox.c6
-rw-r--r--generic/tkMenu.c17
-rw-r--r--generic/tkMenu.h4
-rw-r--r--generic/tkMenubutton.c22
-rw-r--r--generic/tkScale.c11
-rw-r--r--generic/tkText.c12
-rw-r--r--tests/menuDraw.test2
9 files changed, 26 insertions, 85 deletions
diff --git a/generic/tkButton.c b/generic/tkButton.c
index 057b11c..5a11ad6 100644
--- a/generic/tkButton.c
+++ b/generic/tkButton.c
@@ -29,20 +29,11 @@ static Tcl_ThreadDataKey dataKey;
static const char *const classNames[] = {"Label", "Button", "Checkbutton", "Radiobutton"};
/*
- * The following table defines the legal values for the -default option. It is
- * used together with the "enum defaultValue" declaration in tkButton.h.
+ * The following table defines the legal values for the -default/-state options.
+ * It is used together with the "enum defaultValue/state" declarations in tkButton.h.
*/
-static const char *const defaultStrings[] = {
- "active", "disabled", "normal", NULL
-};
-
-/*
- * The following table defines the legal values for the -state option.
- * It is used together with the "enum state" declaration in tkButton.h.
- */
-
-static const char *const stateStrings[] = {
+const char *const tkStateStrings[] = {
"active", "disabled", "normal", NULL
};
@@ -51,7 +42,7 @@ static const char *const stateStrings[] = {
* It is used with the "enum compound" declaration in tkButton.h
*/
-static const char *const compoundStrings[] = {
+const char *const tkCompoundStrings[] = {
"bottom", "center", "left", "none", "right", "top", NULL
};
@@ -92,7 +83,7 @@ static const Tk_OptionSpec labelOptionSpecs[] = {
offsetof(TkButton, borderWidth), 0, 0, 0},
{TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound",
DEF_BUTTON_COMPOUND, TCL_INDEX_NONE, offsetof(TkButton, compound), 0,
- compoundStrings, 0},
+ tkCompoundStrings, 0},
{TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor",
DEF_BUTTON_CURSOR, TCL_INDEX_NONE, offsetof(TkButton, cursor),
TK_OPTION_NULL_OK, 0, 0},
@@ -134,7 +125,7 @@ static const Tk_OptionSpec labelOptionSpecs[] = {
DEF_LABCHKRAD_RELIEF, TCL_INDEX_NONE, offsetof(TkButton, relief), 0, 0, 0},
{TK_OPTION_STRING_TABLE, "-state", "state", "State",
DEF_BUTTON_STATE, TCL_INDEX_NONE, offsetof(TkButton, state),
- 0, stateStrings, 0},
+ 0, tkStateStrings, 0},
{TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus",
DEF_LABEL_TAKE_FOCUS, offsetof(TkButton, takeFocusPtr), TCL_INDEX_NONE,
TK_OPTION_NULL_OK, 0, 0},
@@ -180,13 +171,13 @@ static const Tk_OptionSpec buttonOptionSpecs[] = {
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound",
DEF_BUTTON_COMPOUND, TCL_INDEX_NONE, offsetof(TkButton, compound), 0,
- compoundStrings, 0},
+ tkCompoundStrings, 0},
{TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor",
DEF_BUTTON_CURSOR, TCL_INDEX_NONE, offsetof(TkButton, cursor),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING_TABLE, "-default", "default", "Default",
DEF_BUTTON_DEFAULT, TCL_INDEX_NONE, offsetof(TkButton, defaultState),
- 0, defaultStrings, 0},
+ 0, tkStateStrings, 0},
{TK_OPTION_COLOR, "-disabledforeground", "disabledForeground",
"DisabledForeground", DEF_BUTTON_DISABLED_FG_COLOR,
TCL_INDEX_NONE, offsetof(TkButton, disabledFg), TK_OPTION_NULL_OK,
@@ -235,7 +226,7 @@ static const Tk_OptionSpec buttonOptionSpecs[] = {
0, 0, 0},
{TK_OPTION_STRING_TABLE, "-state", "state", "State",
DEF_BUTTON_STATE, TCL_INDEX_NONE, offsetof(TkButton, state),
- 0, stateStrings, 0},
+ 0, tkStateStrings, 0},
{TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus",
DEF_BUTTON_TAKE_FOCUS, offsetof(TkButton, takeFocusPtr), TCL_INDEX_NONE,
TK_OPTION_NULL_OK, 0, 0},
@@ -281,7 +272,7 @@ static const Tk_OptionSpec checkbuttonOptionSpecs[] = {
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound",
DEF_BUTTON_COMPOUND, TCL_INDEX_NONE, offsetof(TkButton, compound), 0,
- compoundStrings, 0},
+ tkCompoundStrings, 0},
{TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor",
DEF_BUTTON_CURSOR, TCL_INDEX_NONE, offsetof(TkButton, cursor),
TK_OPTION_NULL_OK, 0, 0},
@@ -340,7 +331,7 @@ static const Tk_OptionSpec checkbuttonOptionSpecs[] = {
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING_TABLE, "-state", "state", "State",
DEF_BUTTON_STATE, TCL_INDEX_NONE, offsetof(TkButton, state),
- 0, stateStrings, 0},
+ 0, tkStateStrings, 0},
{TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus",
DEF_BUTTON_TAKE_FOCUS, offsetof(TkButton, takeFocusPtr), TCL_INDEX_NONE,
TK_OPTION_NULL_OK, 0, 0},
@@ -394,7 +385,7 @@ static const Tk_OptionSpec radiobuttonOptionSpecs[] = {
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound",
DEF_BUTTON_COMPOUND, TCL_INDEX_NONE, offsetof(TkButton, compound), 0,
- compoundStrings, 0},
+ tkCompoundStrings, 0},
{TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor",
DEF_BUTTON_CURSOR, TCL_INDEX_NONE, offsetof(TkButton, cursor),
TK_OPTION_NULL_OK, 0, 0},
@@ -450,7 +441,7 @@ static const Tk_OptionSpec radiobuttonOptionSpecs[] = {
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING_TABLE, "-state", "state", "State",
DEF_BUTTON_STATE, TCL_INDEX_NONE, offsetof(TkButton, state),
- 0, stateStrings, 0},
+ 0, tkStateStrings, 0},
{TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus",
DEF_BUTTON_TAKE_FOCUS, offsetof(TkButton, takeFocusPtr), TCL_INDEX_NONE,
TK_OPTION_NULL_OK, 0, 0},
diff --git a/generic/tkInt.h b/generic/tkInt.h
index 948ddad..f0605d2 100644
--- a/generic/tkInt.h
+++ b/generic/tkInt.h
@@ -931,6 +931,8 @@ typedef struct TkWindow {
* String tables:
*/
+MODULE_SCOPE const char *const tkStateStrings[];
+MODULE_SCOPE const char *const tkCompoundStrings[];
MODULE_SCOPE const char *const tkAnchorStrings[];
MODULE_SCOPE const char *const tkReliefStrings[];
MODULE_SCOPE const char *const tkJustifyStrings[];
diff --git a/generic/tkListbox.c b/generic/tkListbox.c
index 6a3b73e..c9ccdfe 100644
--- a/generic/tkListbox.c
+++ b/generic/tkListbox.c
@@ -220,10 +220,6 @@ enum state {
STATE_DISABLED, STATE_NORMAL
};
-static const char *const stateStrings[] = {
- "disabled", "normal", NULL
-};
-
enum activeStyle {
ACTIVE_STYLE_DOTBOX, ACTIVE_STYLE_NONE, ACTIVE_STYLE_UNDERLINE
};
@@ -297,7 +293,7 @@ static const Tk_OptionSpec optionSpecs[] = {
DEF_LISTBOX_SET_GRID, TCL_INDEX_NONE, offsetof(Listbox, setGrid), 0, 0, 0},
{TK_OPTION_STRING_TABLE, "-state", "state", "State",
DEF_LISTBOX_STATE, TCL_INDEX_NONE, offsetof(Listbox, state),
- 0, stateStrings, 0},
+ 0, &tkStateStrings[1], 0},
{TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus",
DEF_LISTBOX_TAKE_FOCUS, TCL_INDEX_NONE, offsetof(Listbox, takeFocus),
TK_OPTION_NULL_OK, 0, 0},
diff --git a/generic/tkMenu.c b/generic/tkMenu.c
index 8958c51..bc248c2 100644
--- a/generic/tkMenu.c
+++ b/generic/tkMenu.c
@@ -101,21 +101,10 @@ TCL_DECLARE_MUTEX(menuMutex)
* to update code in TkpMenuInit that changes the font string entry.
*/
-static const char *const menuStateStrings[] = {"active", "normal", "disabled", NULL};
-
static const char *const menuEntryTypeStrings[] = {
"cascade", "checkbutton", "command", "radiobutton", "separator", NULL
};
-/*
- * The following table defines the legal values for the -compound option. It
- * is used with the "enum compound" declaration in tkMenu.h
- */
-
-static const char *const compoundStrings[] = {
- "bottom", "center", "left", "none", "right", "top", NULL
-};
-
static const Tk_OptionSpec tkBasicMenuEntryConfigSpecs[] = {
{TK_OPTION_BORDER, "-activebackground", NULL, NULL,
DEF_MENU_ENTRY_ACTIVE_BG, offsetof(TkMenuEntry, activeBorderPtr), TCL_INDEX_NONE,
@@ -140,7 +129,7 @@ static const Tk_OptionSpec tkBasicMenuEntryConfigSpecs[] = {
offsetof(TkMenuEntry, commandPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL, 0},
{TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound",
DEF_MENU_ENTRY_COMPOUND, TCL_INDEX_NONE, offsetof(TkMenuEntry, compound), 0,
- (ClientData) compoundStrings, 0},
+ tkCompoundStrings, 0},
{TK_OPTION_FONT, "-font", NULL, NULL,
DEF_MENU_ENTRY_FONT,
offsetof(TkMenuEntry, fontPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL, 0},
@@ -159,7 +148,7 @@ static const Tk_OptionSpec tkBasicMenuEntryConfigSpecs[] = {
{TK_OPTION_STRING_TABLE, "-state", NULL, NULL,
DEF_MENU_ENTRY_STATE,
TCL_INDEX_NONE, offsetof(TkMenuEntry, state), 0,
- (ClientData) menuStateStrings, 0},
+ tkStateStrings, 0},
{TK_OPTION_INDEX, "-underline", NULL, NULL,
TK_OPTION_UNDERLINE_DEF(TkMenuEntry, underline), 0},
{TK_OPTION_END, NULL, NULL, NULL, 0, 0, 0, 0, NULL, 0}
@@ -229,7 +218,7 @@ static const Tk_OptionSpec tkTearoffEntryConfigSpecs[] = {
offsetof(TkMenuEntry, borderPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL, 0},
{TK_OPTION_STRING_TABLE, "-state", NULL, NULL,
DEF_MENU_ENTRY_STATE, TCL_INDEX_NONE, offsetof(TkMenuEntry, state), 0,
- (ClientData) menuStateStrings, 0},
+ tkStateStrings, 0},
{TK_OPTION_END, NULL, NULL, NULL, 0, 0, 0, 0, NULL, 0}
};
diff --git a/generic/tkMenu.h b/generic/tkMenu.h
index 522a00c..cc19b92 100644
--- a/generic/tkMenu.h
+++ b/generic/tkMenu.h
@@ -244,8 +244,8 @@ typedef struct TkMenuEntry {
*/
#define ENTRY_ACTIVE 0
-#define ENTRY_NORMAL 1
-#define ENTRY_DISABLED 2
+#define ENTRY_DISABLED 1
+#define ENTRY_NORMAL 2
/*
* A data structure of the following type is kept for each menu widget:
diff --git a/generic/tkMenubutton.c b/generic/tkMenubutton.c
index e81342e..0c80aef 100644
--- a/generic/tkMenubutton.c
+++ b/generic/tkMenubutton.c
@@ -36,24 +36,6 @@ static const char *const directionStrings[] = {
};
/*
- * The following table defines the legal values for the -state option. It is
- * used together with the "enum state" declaration in tkMenubutton.h.
- */
-
-static const char *const stateStrings[] = {
- "active", "disabled", "normal", NULL
-};
-
-/*
- * The following table defines the legal values for the -compound option. It
- * is used with the "enum compound" declaration in tkMenuButton.h
- */
-
-static const char *const compoundStrings[] = {
- "bottom", "center", "left", "none", "right", "top", NULL
-};
-
-/*
* Information used for parsing configuration specs:
*/
@@ -132,10 +114,10 @@ static const Tk_OptionSpec optionSpecs[] = {
0, 0, 0},
{TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound",
DEF_BUTTON_COMPOUND, TCL_INDEX_NONE, offsetof(TkMenuButton, compound), 0,
- compoundStrings, 0},
+ tkCompoundStrings, 0},
{TK_OPTION_STRING_TABLE, "-state", "state", "State",
DEF_MENUBUTTON_STATE, TCL_INDEX_NONE, offsetof(TkMenuButton, state),
- 0, stateStrings, 0},
+ 0, tkStateStrings, 0},
{TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus",
DEF_MENUBUTTON_TAKE_FOCUS, TCL_INDEX_NONE,
offsetof(TkMenuButton, takeFocus), TK_OPTION_NULL_OK, 0, 0},
diff --git a/generic/tkScale.c b/generic/tkScale.c
index c67e35c..0428f4a 100644
--- a/generic/tkScale.c
+++ b/generic/tkScale.c
@@ -34,15 +34,6 @@ static const char *const orientStrings[] = {
"horizontal", "vertical", NULL
};
-/*
- * The following table defines the legal values for the -state option. It is
- * used together with the "enum state" declaration in tkScale.h.
- */
-
-static const char *const stateStrings[] = {
- "active", "disabled", "normal", NULL
-};
-
static const Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground",
DEF_SCALE_ACTIVE_BG_COLOR, TCL_INDEX_NONE, offsetof(TkScale, activeBorder),
@@ -118,7 +109,7 @@ static const Tk_OptionSpec optionSpecs[] = {
0, 0, 0},
{TK_OPTION_STRING_TABLE, "-state", "state", "State",
DEF_SCALE_STATE, TCL_INDEX_NONE, offsetof(TkScale, state),
- 0, stateStrings, 0},
+ 0, tkStateStrings, 0},
{TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus",
DEF_SCALE_TAKE_FOCUS, offsetof(TkScale, takeFocusPtr), TCL_INDEX_NONE,
TK_OPTION_NULL_OK, 0, 0},
diff --git a/generic/tkText.c b/generic/tkText.c
index b1475b0..5287288 100644
--- a/generic/tkText.c
+++ b/generic/tkText.c
@@ -43,16 +43,6 @@
#define PIXEL_CLIENTS 5
/*
- * The 'TkTextState' enum in tkText.h is used to define a type for the -state
- * option of the Text widget. These values are used as indices into the string
- * table below.
- */
-
-static const char *const stateStrings[] = {
- "disabled", "normal", NULL
-};
-
-/*
* The 'TkWrapMode' enum in tkText.h is used to define a type for the -wrap
* option of the Text widget. These values are used as indices into the string
* table below.
@@ -230,7 +220,7 @@ static const Tk_OptionSpec optionSpecs[] = {
&lineOption, TK_TEXT_LINE_RANGE},
{TK_OPTION_STRING_TABLE, "-state", "state", "State",
DEF_TEXT_STATE, TCL_INDEX_NONE, offsetof(TkText, state),
- 0, stateStrings, 0},
+ 0, &tkStateStrings[1], 0},
{TK_OPTION_STRING, "-tabs", "tabs", "Tabs",
DEF_TEXT_TABS, offsetof(TkText, tabOptionPtr), TCL_INDEX_NONE,
TK_OPTION_NULL_OK, 0, TK_TEXT_LINE_GEOMETRY},
diff --git a/tests/menuDraw.test b/tests/menuDraw.test
index 96cdb71..ff639c1 100644
--- a/tests/menuDraw.test
+++ b/tests/menuDraw.test
@@ -132,7 +132,7 @@ test menuDraw-6.6 {TkMenuConfigureEntryDrawOptions - bad state} -setup {
.m1 entryconfigure 1 -state foo
} -cleanup {
deleteWindows
-} -returnCodes error -result {bad state "foo": must be active, normal, or disabled}
+} -returnCodes error -result {bad state "foo": must be active, disabled, or normal}
test menuDraw-6.7 {TkMenuConfigureEntryDrawOptions - tkfont specified} -setup {
deleteWindows
} -body {