summaryrefslogtreecommitdiffstats
path: root/generic/ttk/ttkButton.c
diff options
context:
space:
mode:
authorpatthoyts <patthoyts@users.sourceforge.net>2016-09-21 23:41:44 (GMT)
committerpatthoyts <patthoyts@users.sourceforge.net>2016-09-21 23:41:44 (GMT)
commit17993a942afc2c375f311dd73083e4f1d3339dab (patch)
treea3025449e9f439f19f08e5cf7d37e80a3e60db0a /generic/ttk/ttkButton.c
parent713d51c8519164eee84302b30e4f36706e2e1952 (diff)
downloadtk-17993a942afc2c375f311dd73083e4f1d3339dab.zip
tk-17993a942afc2c375f311dd73083e4f1d3339dab.tar.gz
tk-17993a942afc2c375f311dd73083e4f1d3339dab.tar.bz2
[3126428] Repaint ttk labels and buttons when the image is changed.
In Tk the images associated with labels and buttons have their image changed callback set to cause the widget to be redrawn if the image is changed in any way. However, this has not been done for the ttk equivalent widgets.
Diffstat (limited to 'generic/ttk/ttkButton.c')
-rw-r--r--generic/ttk/ttkButton.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/generic/ttk/ttkButton.c b/generic/ttk/ttkButton.c
index bc44f25..c00754b 100644
--- a/generic/ttk/ttkButton.c
+++ b/generic/ttk/ttkButton.c
@@ -136,6 +136,15 @@ BaseCleanup(void *recordPtr)
TtkFreeImageSpec(basePtr->base.imageSpec);
}
+static void
+BaseImageChanged(
+ ClientData clientData, int x, int y, int width, int height,
+ int imageWidth, int imageHeight)
+{
+ Base *basePtr = (Base *)clientData;
+ TtkResizeWidget(&basePtr->core);
+}
+
static int BaseConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
{
Base *basePtr = recordPtr;
@@ -149,8 +158,8 @@ static int BaseConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
}
if (basePtr->base.imageObj) {
- imageSpec = TtkGetImageSpec(
- interp, basePtr->core.tkwin, basePtr->base.imageObj);
+ imageSpec = TtkGetImageSpecEx(
+ interp, basePtr->core.tkwin, basePtr->base.imageObj, BaseImageChanged, basePtr);
if (!imageSpec) {
goto error;
}