diff options
author | kevin_walzer <kevin_walzer@noemail.net> | 2015-04-09 02:00:59 (GMT) |
---|---|---|
committer | kevin_walzer <kevin_walzer@noemail.net> | 2015-04-09 02:00:59 (GMT) |
commit | 4c7a77d5a854ea472d9f78ddf5e5df5d8ea34537 (patch) | |
tree | 3d2c1b4ec2054fbe9fd8a6a5cd948ad5cc6d8c71 /macosx/tkMacOSXButton.c | |
parent | c2fcb222a8eeec4de0eca37c0a5be3fae93ef0af (diff) | |
download | tk-4c7a77d5a854ea472d9f78ddf5e5df5d8ea34537.zip tk-4c7a77d5a854ea472d9f78ddf5e5df5d8ea34537.tar.gz tk-4c7a77d5a854ea472d9f78ddf5e5df5d8ea34537.tar.bz2 |
Re-working of internal Cocoa widget drawing routines, especially when resizing; fix rendering of scrollbar when resized or clipped; cleanup of button metrics; thanks to Marc Culler for extensive patches
FossilOrigin-Name: 8bb4fbd09766144fc0da76b344e08c2293bc6674
Diffstat (limited to 'macosx/tkMacOSXButton.c')
-rw-r--r-- | macosx/tkMacOSXButton.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/macosx/tkMacOSXButton.c b/macosx/tkMacOSXButton.c index c1dec90..adb78c6 100644 --- a/macosx/tkMacOSXButton.c +++ b/macosx/tkMacOSXButton.c @@ -30,10 +30,10 @@ * Default insets for controls */ -#define DEF_INSET_LEFT 2 -#define DEF_INSET_RIGHT 2 -#define DEF_INSET_TOP 2 -#define DEF_INSET_BOTTOM 4 +#define DEF_INSET_LEFT 12 +#define DEF_INSET_RIGHT 12 +#define DEF_INSET_TOP 1 +#define DEF_INSET_BOTTOM 1 /* * Some defines used to control what type of control is drawn. @@ -318,8 +318,8 @@ TkpComputeButtonGeometry( Tcl_GetString(butPtr->textPtr), -1, butPtr->wrapLength, butPtr->justify, 0, &butPtr->textWidth, &butPtr->textHeight); - txtWidth = butPtr->textWidth; - txtHeight = butPtr->textHeight; + txtWidth = butPtr->textWidth + DEF_INSET_LEFT + DEF_INSET_RIGHT; + txtHeight = butPtr->textHeight + DEF_INSET_BOTTOM + DEF_INSET_TOP; charWidth = Tk_TextWidth(butPtr->tkfont, "0", 1); Tk_GetFontMetrics(butPtr->tkfont, &fm); haveText = (txtWidth != 0 && txtHeight != 0); @@ -647,7 +647,7 @@ DrawButtonImageAndText( butPtr->textHeight, &x, &y); x += butPtr->indicatorSpace; Tk_DrawTextLayout(butPtr->display, pixmap, dpPtr->gc, butPtr->textLayout, - x, y, 0, -1); + x, y - DEF_INSET_BOTTOM, 0, -1); } /* @@ -807,9 +807,12 @@ TkMacOSXDrawButton( hiinfo.animation.time.start = hiinfo.animation.time.current; } - HIThemeDrawButton(&cntrRect, &hiinfo, dc.context, kHIThemeOrientationNormal, &contHIRec); + HIThemeDrawButton(&cntrRect, &hiinfo, dc.context, kHIThemeOrientationNormal, + &contHIRec); + TkMacOSXRestoreDrawingContext(&dc); - ButtonContentDrawCB(&contHIRec, mbPtr->btnkind, &mbPtr->drawinfo, (MacButton *)mbPtr, 32, true); + ButtonContentDrawCB(&contHIRec, mbPtr->btnkind, &mbPtr->drawinfo, + (MacButton *)mbPtr, 32, true); } else { if (!TkMacOSXSetupDrawingContext(pixmap, dpPtr->gc, 1, &dc)) { |