diff options
author | Kevin Walzer <kw@codebykevin.com> | 2015-02-12 16:01:25 (GMT) |
---|---|---|
committer | Kevin Walzer <kw@codebykevin.com> | 2015-02-12 16:01:25 (GMT) |
commit | 6add3bbaa483188be137880b35890c8d446da0d0 (patch) | |
tree | 88f5e06fa05255e2491ee42115c2da10e6758e6e | |
parent | 58069efb01b6488a3c1b972848496abdb99b65a7 (diff) | |
download | tk-6add3bbaa483188be137880b35890c8d446da0d0.zip tk-6add3bbaa483188be137880b35890c8d446da0d0.tar.gz tk-6add3bbaa483188be137880b35890c8d446da0d0.tar.bz2 |
Limit hard-coded padding in Cocoa buttons to radiobuttons indicatorOn
-rw-r--r-- | macosx/tkMacOSXButton.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/macosx/tkMacOSXButton.c b/macosx/tkMacOSXButton.c index 9c2196f..09027fe 100644 --- a/macosx/tkMacOSXButton.c +++ b/macosx/tkMacOSXButton.c @@ -378,19 +378,27 @@ TkpComputeButtonGeometry( width += 2 * butPtr->padX; height += 2 * butPtr->padY; - /* Need special handling for radiobuttons and checkbuttons: + /* Need special handling for radiobuttons and checkbuttons: the text and images is drawn right on top of the button unless we expand the width. This is not perfect; some radiobuttons may render on top anyway. */ switch (butPtr->type) { case TYPE_RADIO_BUTTON: - /*Pad radiobutton by 50 to ensure image does not draw right over - radiobutton on left.*/ + /*Pad radiobutton by 50 if indicatorOn to ensure image does not draw + right over radiobutton on left.*/ if (butPtr->image != None) { - width += 50; + if (butPtr->indicatorOn) { + width += 50; + } else { + width += 0; + } } else if (butPtr->bitmap != None) { - width +=50; + if (butPtr->indicatorOn) { + width += 50; + } else { + width += 0; + } } else { /*If just text, just add width of string.*/ width += txtWidth; @@ -408,7 +416,6 @@ TkpComputeButtonGeometry( } break; } - /* * Now figure out the size of the border decorations for the button. |