summaryrefslogtreecommitdiffstats
path: root/generic/ttk/ttkInit.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/ttk/ttkInit.c')
-rw-r--r--generic/ttk/ttkInit.c45
1 files changed, 24 insertions, 21 deletions
diff --git a/generic/ttk/ttkInit.c b/generic/ttk/ttkInit.c
index 5995409..360760a 100644
--- a/generic/ttk/ttkInit.c
+++ b/generic/ttk/ttkInit.c
@@ -19,15 +19,11 @@ const char *const ttkDefaultStrings[] = {
int Ttk_GetButtonDefaultStateFromObj(
Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_ButtonDefaultState *statePtr)
{
- int value;
- int result;
-
- *statePtr = TTK_BUTTON_DEFAULT_DISABLED;
- result = Tcl_GetIndexFromObjStruct(interp, objPtr, ttkDefaultStrings,
- sizeof(char *), "default state", 0, &value);
- if (result == TCL_OK) {
- *statePtr = (Ttk_ButtonDefaultState)value;
- }
+ int state = (int)TTK_BUTTON_DEFAULT_DISABLED;
+ int result = Tcl_GetIndexFromObjStruct(interp, objPtr, ttkDefaultStrings,
+ sizeof(char *), "default state", 0, &state);
+
+ *statePtr = (Ttk_ButtonDefaultState)state;
return result;
}
@@ -41,17 +37,13 @@ const char *const ttkCompoundStrings[] = {
};
int Ttk_GetCompoundFromObj(
- Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_Compound *statePtr)
+ Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_Compound *compoundPtr)
{
- int value;
- int result;
-
- *statePtr = TTK_COMPOUND_NONE;
- result = Tcl_GetIndexFromObjStruct(interp, objPtr, ttkCompoundStrings,
- sizeof(char *), "compound layout", 0, &value);
- if (result == TCL_OK) {
- *statePtr = (Ttk_Compound)value;
- }
+ int compound = (int)TTK_COMPOUND_NONE;
+ int result = Tcl_GetIndexFromObjStruct(interp, objPtr, ttkCompoundStrings,
+ sizeof(char *), "compound layout", 0, &compound);
+
+ *compoundPtr = (Ttk_Compound)compound;
return result;
}
@@ -71,6 +63,17 @@ int Ttk_GetOrientFromObj(
sizeof(char *), "orientation", 0, resultPtr);
}
+int TtkGetOrientFromObj(
+ Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_Orient *resultPtr)
+{
+ int orient = (int)TTK_ORIENT_HORIZONTAL;
+ int result = Tcl_GetIndexFromObjStruct(interp, objPtr, ttkOrientStrings,
+ sizeof(char *), "orientation", 0, &orient);
+
+ *resultPtr = (Ttk_Orient)orient;
+ return result;
+}
+
/*
* Recognized values for the -state compatibility option.
* Other options are accepted and interpreted as synonyms for "normal".
@@ -162,7 +165,7 @@ int TtkEnumerateOptions(
if (specPtr->type == TK_OPTION_END && specPtr->clientData != NULL) {
/* Chain to next option spec array: */
- specPtr = specPtr->clientData;
+ specPtr = (const Tk_OptionSpec *)specPtr->clientData;
}
}
Tcl_SetObjResult(interp, result);
@@ -288,7 +291,7 @@ Ttk_Init(Tcl_Interp *interp)
Ttk_PlatformInit(interp);
- Tcl_PkgProvideEx(interp, "Ttk", TTK_PATCH_LEVEL, (ClientData)&ttkStubs);
+ Tcl_PkgProvideEx(interp, "Ttk", TTK_PATCH_LEVEL, (void *)&ttkStubs);
return TCL_OK;
}