diff options
Diffstat (limited to 'generic/ttk/ttkPanedwindow.c')
-rw-r--r-- | generic/ttk/ttkPanedwindow.c | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/generic/ttk/ttkPanedwindow.c b/generic/ttk/ttkPanedwindow.c index ac8d9cc..e207a58 100644 --- a/generic/ttk/ttkPanedwindow.c +++ b/generic/ttk/ttkPanedwindow.c @@ -1,4 +1,4 @@ -/* $Id: ttkPanedwindow.c,v 1.3 2006/11/07 03:45:28 jenglish Exp $ +/* $Id: ttkPanedwindow.c,v 1.4 2006/11/24 18:04:14 jenglish Exp $ * * Copyright (c) 2005, Joe English. Freely redistributable. * @@ -447,29 +447,35 @@ static Ttk_Layout PanedGetLayout( { Paned *pw = recordPtr; Ttk_Layout panedLayout = TtkWidgetGetLayout(interp, themePtr, recordPtr); - int horizontal = pw->paned.orient == TTK_ORIENT_HORIZONTAL; - const char *layoutName = horizontal ? ".Vertical.Sash" : ".Horizontal.Sash"; - Ttk_Layout sashLayout = Ttk_CreateSublayout(interp, themePtr, panedLayout, - layoutName, pw->core.optionTable); - if (sashLayout) { - int sashWidth, sashHeight; + if (panedLayout) { + int horizontal = pw->paned.orient == TTK_ORIENT_HORIZONTAL; + const char *layoutName = + horizontal ? ".Vertical.Sash" : ".Horizontal.Sash"; + Ttk_Layout sashLayout = Ttk_CreateSublayout( + interp, themePtr, panedLayout, layoutName, pw->core.optionTable); - if (pw->paned.sashLayout) - Ttk_FreeLayout(pw->paned.sashLayout); - pw->paned.sashLayout = sashLayout; + if (sashLayout) { + int sashWidth, sashHeight; - Ttk_LayoutSize(sashLayout, 0, &sashWidth, &sashHeight); + Ttk_LayoutSize(sashLayout, 0, &sashWidth, &sashHeight); + pw->paned.sashThickness = horizontal ? sashWidth : sashHeight; - pw->paned.sashThickness = horizontal ? sashWidth : sashHeight; + if (pw->paned.sashLayout) + Ttk_FreeLayout(pw->paned.sashLayout); + pw->paned.sashLayout = sashLayout; + } else { + Ttk_FreeLayout(panedLayout); + return 0; + } + } - /* Sanity-check: - */ - if (pw->paned.sashThickness < MIN_SASH_THICKNESS) - pw->paned.sashThickness = MIN_SASH_THICKNESS; + /* Sanity-check: + */ + if (pw->paned.sashThickness < MIN_SASH_THICKNESS) + pw->paned.sashThickness = MIN_SASH_THICKNESS; - Ttk_ManagerSizeChanged(pw->paned.mgr); - } + Ttk_ManagerSizeChanged(pw->paned.mgr); return panedLayout; } |