diff options
Diffstat (limited to 'generic/ttk/ttkFrame.c')
-rw-r--r-- | generic/ttk/ttkFrame.c | 63 |
1 files changed, 32 insertions, 31 deletions
diff --git a/generic/ttk/ttkFrame.c b/generic/ttk/ttkFrame.c index 0570502..cd877f3 100644 --- a/generic/ttk/ttkFrame.c +++ b/generic/ttk/ttkFrame.c @@ -1,11 +1,11 @@ /* - * Copyright (c) 2004, Joe English + * Copyright © 2004 Joe English * * ttk::frame and ttk::labelframe widgets. */ #include "tkInt.h" -#include "ttkTheme.h" +#include "ttkThemeInt.h" #include "ttkWidget.h" #include "ttkManager.h" @@ -26,21 +26,21 @@ typedef struct { FramePart frame; } Frame; -static Tk_OptionSpec FrameOptionSpecs[] = { +static const Tk_OptionSpec FrameOptionSpecs[] = { {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", NULL, - Tk_Offset(Frame,frame.borderWidthObj), -1, + offsetof(Frame,frame.borderWidthObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_STRING, "-padding", "padding", "Pad", NULL, - Tk_Offset(Frame,frame.paddingObj), -1, + offsetof(Frame,frame.paddingObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", NULL, - Tk_Offset(Frame,frame.reliefObj), -1, + offsetof(Frame,frame.reliefObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,0 }, {TK_OPTION_PIXELS, "-width", "width", "Width", "0", - Tk_Offset(Frame,frame.widthObj), -1, + offsetof(Frame,frame.widthObj), TCL_INDEX_NONE, 0,0,GEOMETRY_CHANGED }, {TK_OPTION_PIXELS, "-height", "height", "Height", "0", - Tk_Offset(Frame,frame.heightObj), -1, + offsetof(Frame,frame.heightObj), TCL_INDEX_NONE, 0,0,GEOMETRY_CHANGED }, WIDGET_TAKEFOCUS_FALSE, @@ -48,11 +48,12 @@ static Tk_OptionSpec FrameOptionSpecs[] = { }; static const Ttk_Ensemble FrameCommands[] = { - { "configure", TtkWidgetConfigureCommand,0 }, { "cget", TtkWidgetCgetCommand,0 }, + { "configure", TtkWidgetConfigureCommand,0 }, + { "identify", TtkWidgetIdentifyCommand,0 }, { "instate", TtkWidgetInstateCommand,0 }, { "state", TtkWidgetStateCommand,0 }, - { "identify", TtkWidgetIdentifyCommand,0 }, + { "style", TtkWidgetStyleCommand,0 }, { 0,0,0 } }; @@ -90,8 +91,8 @@ static Ttk_Padding FrameMargins(Frame *framePtr) */ static int FrameSize( void *recordPtr, - TCL_UNUSED(int *), - TCL_UNUSED(int *)) + TCL_UNUSED(int *), /* widthPtr */ + TCL_UNUSED(int *)) /* heightPtr */ { Frame *framePtr = (Frame *)recordPtr; Ttk_SetMargins(framePtr->core.tkwin, FrameMargins(framePtr)); @@ -148,7 +149,7 @@ static int FrameConfigure(Tcl_Interp *interp, void *recordPtr, int mask) return TtkCoreConfigure(interp, recordPtr, mask); } -static WidgetSpec FrameWidgetSpec = { +static const WidgetSpec FrameWidgetSpec = { "TFrame", /* className */ sizeof(Frame), /* recordSize */ FrameOptionSpecs, /* optionSpecs */ @@ -234,7 +235,7 @@ static Ttk_Side LabelAnchorSide(Ttk_PositionSpec flags) typedef struct { Tcl_Obj *labelAnchorObj; Tcl_Obj *textObj; - Tcl_Obj *underlineObj; + Tcl_Obj *underlineObj; Tk_Window labelWidget; Ttk_Manager *mgr; @@ -250,18 +251,17 @@ typedef struct { #define LABELWIDGET_CHANGED 0x100 -static Tk_OptionSpec LabelframeOptionSpecs[] = { +static const Tk_OptionSpec LabelframeOptionSpecs[] = { {TK_OPTION_STRING, "-labelanchor", "labelAnchor", "LabelAnchor", - "nw", Tk_Offset(Labelframe, label.labelAnchorObj),-1, + "nw", offsetof(Labelframe, label.labelAnchorObj),TCL_INDEX_NONE, 0,0,GEOMETRY_CHANGED}, {TK_OPTION_STRING, "-text", "text", "Text", "", - Tk_Offset(Labelframe,label.textObj), -1, + offsetof(Labelframe,label.textObj), TCL_INDEX_NONE, 0,0,GEOMETRY_CHANGED }, - {TK_OPTION_INT, "-underline", "underline", "Underline", - "-1", Tk_Offset(Labelframe,label.underlineObj), -1, - 0,0,0 }, + {TK_OPTION_INDEX, "-underline", "underline", "Underline", + TTK_OPTION_UNDERLINE_DEF(Labelframe, label.underlineObj), 0}, {TK_OPTION_WINDOW, "-labelwidget", "labelWidget", "LabelWidget", NULL, - -1, Tk_Offset(Labelframe,label.labelWidget), + TCL_INDEX_NONE, offsetof(Labelframe,label.labelWidget), TK_OPTION_NULL_OK,0,LABELWIDGET_CHANGED|GEOMETRY_CHANGED }, WIDGET_INHERIT_OPTIONS(FrameOptionSpecs) @@ -298,7 +298,8 @@ static void LabelframeStyleOptions(Labelframe *lf, LabelframeStyle *style) TtkGetLabelAnchorFromObj(NULL, objPtr, &style->labelAnchor); } if ((objPtr = Ttk_QueryOption(layout,"-labelmargins", 0)) != NULL) { - Ttk_GetBorderFromObj(NULL, objPtr, &style->labelMargins); + Ttk_GetPaddingFromObj(NULL, lf->core.tkwin, objPtr, + &style->labelMargins); } else { if (style->labelAnchor & (TTK_PACK_TOP|TTK_PACK_BOTTOM)) { style->labelMargins = @@ -342,8 +343,8 @@ LabelframeLabelSize(Labelframe *lframePtr, int *widthPtr, int *heightPtr) */ static int LabelframeSize( void *recordPtr, - TCL_UNUSED(int *), - TCL_UNUSED(int *)) + TCL_UNUSED(int *), /* widthPtr */ + TCL_UNUSED(int *)) /* heightPtr */ { Labelframe *lframePtr = (Labelframe *)recordPtr; WidgetCore *corePtr = &lframePtr->core; @@ -494,10 +495,10 @@ static void LabelframePlaceContent(void *recordPtr) } static int LabelRequest( - TCL_UNUSED(void *), - TCL_UNUSED(int), - TCL_UNUSED(int), - TCL_UNUSED(int)) + TCL_UNUSED(void *), /* managerData */ + TCL_UNUSED(Tcl_Size), /* index */ + TCL_UNUSED(int), /* width */ + TCL_UNUSED(int)) /* height */ { return 1; } @@ -511,14 +512,14 @@ static int LabelRequest( */ static void LabelRemoved( void *managerData, - TCL_UNUSED(int)) + TCL_UNUSED(Tcl_Size)) /* index */ { Labelframe *lframe = (Labelframe *)managerData; lframe->label.labelWidget = 0; } -static Ttk_ManagerSpec LabelframeManagerSpec = { +static const Ttk_ManagerSpec LabelframeManagerSpec = { { "labelframe", Ttk_GeometryRequestProc, Ttk_LostContentProc }, LabelframeSize, LabelframePlaceContent, @@ -626,7 +627,7 @@ static int LabelframeConfigure(Tcl_Interp *interp,void *recordPtr,int mask) return TCL_OK; } -static WidgetSpec LabelframeWidgetSpec = { +static const WidgetSpec LabelframeWidgetSpec = { "TLabelframe", /* className */ sizeof(Labelframe), /* recordSize */ LabelframeOptionSpecs, /* optionSpecs */ |