summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2021-02-03 09:48:39 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2021-02-03 09:48:39 (GMT)
commit860ffe5f9af35a0d54fef347d3aacb8b3585800a (patch)
tree6d7910a1938039f4d352d3bf82c402abcc91532e /generic
parent06420ba2fed328cf5559b51d715c8554ff00c69c (diff)
downloadtk-860ffe5f9af35a0d54fef347d3aacb8b3585800a.zip
tk-860ffe5f9af35a0d54fef347d3aacb8b3585800a.tar.gz
tk-860ffe5f9af35a0d54fef347d3aacb8b3585800a.tar.bz2
New macro TK_OPTION_UNDERLINE_DEF, which simplifies the default handling for "-underline" options.
Diffstat (limited to 'generic')
-rw-r--r--generic/tkButton.c8
-rw-r--r--generic/tkInt.h1
-rw-r--r--generic/tkMenu.c2
-rw-r--r--generic/tkMenubutton.c3
4 files changed, 7 insertions, 7 deletions
diff --git a/generic/tkButton.c b/generic/tkButton.c
index 04c9d78..03496bb 100644
--- a/generic/tkButton.c
+++ b/generic/tkButton.c
@@ -144,7 +144,7 @@ static const Tk_OptionSpec labelOptionSpecs[] = {
DEF_BUTTON_TEXT_VARIABLE, offsetof(TkButton, textVarNamePtr), TCL_INDEX_NONE,
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_INT, "-underline", "underline", "Underline",
- DEF_BUTTON_UNDERLINE, TCL_INDEX_NONE, offsetof(TkButton, underline), 0, 0, 0},
+ TK_OPTION_UNDERLINE_DEF(TkButton, underline), 0},
{TK_OPTION_STRING, "-width", "width", "Width",
DEF_BUTTON_WIDTH, offsetof(TkButton, widthPtr), TCL_INDEX_NONE, 0, 0, 0},
{TK_OPTION_PIXELS, "-wraplength", "wrapLength", "WrapLength",
@@ -245,7 +245,7 @@ static const Tk_OptionSpec buttonOptionSpecs[] = {
DEF_BUTTON_TEXT_VARIABLE, offsetof(TkButton, textVarNamePtr), TCL_INDEX_NONE,
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_INT, "-underline", "underline", "Underline",
- DEF_BUTTON_UNDERLINE, TCL_INDEX_NONE, offsetof(TkButton, underline), 0, 0, 0},
+ TK_OPTION_UNDERLINE_DEF(TkButton, underline), 0},
{TK_OPTION_STRING, "-width", "width", "Width",
DEF_BUTTON_WIDTH, offsetof(TkButton, widthPtr), TCL_INDEX_NONE, 0, 0, 0},
{TK_OPTION_PIXELS, "-wraplength", "wrapLength", "WrapLength",
@@ -355,7 +355,7 @@ static const Tk_OptionSpec checkbuttonOptionSpecs[] = {
{TK_OPTION_STRING, "-tristatevalue", "tristateValue", "TristateValue",
DEF_BUTTON_TRISTATE_VALUE, offsetof(TkButton, tristateValuePtr), TCL_INDEX_NONE, 0, 0, 0},
{TK_OPTION_INT, "-underline", "underline", "Underline",
- DEF_BUTTON_UNDERLINE, TCL_INDEX_NONE, offsetof(TkButton, underline), 0, 0, 0},
+ TK_OPTION_UNDERLINE_DEF(TkButton, underline), 0},
{TK_OPTION_STRING, "-variable", "variable", "Variable",
DEF_CHECKBUTTON_VARIABLE, offsetof(TkButton, selVarNamePtr), TCL_INDEX_NONE,
TK_OPTION_NULL_OK, 0, 0},
@@ -465,7 +465,7 @@ static const Tk_OptionSpec radiobuttonOptionSpecs[] = {
{TK_OPTION_STRING, "-tristatevalue", "tristateValue", "TristateValue",
DEF_BUTTON_TRISTATE_VALUE, offsetof(TkButton, tristateValuePtr), TCL_INDEX_NONE, 0, 0, 0},
{TK_OPTION_INT, "-underline", "underline", "Underline",
- DEF_BUTTON_UNDERLINE, TCL_INDEX_NONE, offsetof(TkButton, underline), 0, 0, 0},
+ TK_OPTION_UNDERLINE_DEF(TkButton, underline), 0},
{TK_OPTION_STRING, "-value", "value", "Value",
DEF_BUTTON_VALUE, offsetof(TkButton, onValuePtr), TCL_INDEX_NONE, 0, 0, 0},
{TK_OPTION_STRING, "-variable", "variable", "Variable",
diff --git a/generic/tkInt.h b/generic/tkInt.h
index 68838b7..cc29660 100644
--- a/generic/tkInt.h
+++ b/generic/tkInt.h
@@ -1378,6 +1378,7 @@ MODULE_SCOPE void TkRotatePoint(double originX, double originY,
MODULE_SCOPE int TkGetIntForIndex(Tcl_Obj *, TkSizeT, int lastOK, TkSizeT*);
#define TkNewIndexObj(value) Tcl_NewWideIntObj((Tcl_WideInt)(value + 1) - 1)
+#define TK_OPTION_UNDERLINE_DEF(type, field) "-1", TCL_INDEX_NONE, offsetof(type, field), 0, NULL
#ifdef _WIN32
#define TkParseColor XParseColor
diff --git a/generic/tkMenu.c b/generic/tkMenu.c
index a7e6363..da5815f 100644
--- a/generic/tkMenu.c
+++ b/generic/tkMenu.c
@@ -161,7 +161,7 @@ static const Tk_OptionSpec tkBasicMenuEntryConfigSpecs[] = {
TCL_INDEX_NONE, offsetof(TkMenuEntry, state), 0,
(ClientData) menuStateStrings, 0},
{TK_OPTION_INT, "-underline", NULL, NULL,
- DEF_MENU_ENTRY_UNDERLINE, TCL_INDEX_NONE, offsetof(TkMenuEntry, underline), 0, NULL, 0},
+ TK_OPTION_UNDERLINE_DEF(TkMenuEntry, underline), 0},
{TK_OPTION_END, NULL, NULL, NULL, 0, 0, 0, 0, NULL, 0}
};
diff --git a/generic/tkMenubutton.c b/generic/tkMenubutton.c
index dbf6208..ede28dd 100644
--- a/generic/tkMenubutton.c
+++ b/generic/tkMenubutton.c
@@ -145,8 +145,7 @@ static const Tk_OptionSpec optionSpecs[] = {
DEF_MENUBUTTON_TEXT_VARIABLE, TCL_INDEX_NONE,
offsetof(TkMenuButton, textVarName), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_INT, "-underline", "underline", "Underline",
- DEF_MENUBUTTON_UNDERLINE, TCL_INDEX_NONE, offsetof(TkMenuButton, underline),
- 0, 0, 0},
+ TK_OPTION_UNDERLINE_DEF(TkMenuButton, underline), 0},
{TK_OPTION_STRING, "-width", "width", "Width",
DEF_MENUBUTTON_WIDTH, TCL_INDEX_NONE, offsetof(TkMenuButton, widthString),
0, 0, 0},