Exemple #1
0
/*------------------------------------------------------------------------
 * +++ Layout management hooks.
 */
static Ttk_Layout PanedGetLayout(
    Tcl_Interp *interp, Ttk_Theme themePtr, void *recordPtr)
{
    Paned *pw = recordPtr;
    Ttk_Layout panedLayout = TtkWidgetGetLayout(interp, themePtr, recordPtr);

    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 (sashLayout) {
            int sashWidth, sashHeight;

            Ttk_LayoutSize(sashLayout, 0, &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;
        }
    }

    return panedLayout;
}
Exemple #2
0
static Ttk_Layout LabelframeGetLayout(
    Tcl_Interp *interp, Ttk_Theme theme, void *recordPtr)
{
    Labelframe *lf = recordPtr;
    Ttk_Layout frameLayout = TtkWidgetGetLayout(interp, theme, recordPtr);
    Ttk_Layout labelLayout;

    if (!frameLayout) {
	return NULL;
    }

    labelLayout = Ttk_CreateSublayout(
	interp, theme, frameLayout, ".Label", lf->core.optionTable);

    if (labelLayout) {
	if (lf->label.labelLayout) {
	    Ttk_FreeLayout(lf->label.labelLayout);
	}
	Ttk_RebindSublayout(labelLayout, recordPtr);
	lf->label.labelLayout = labelLayout;
    }

    return frameLayout;
}