summaryrefslogtreecommitdiffstats
path: root/generic/ttk
diff options
context:
space:
mode:
Diffstat (limited to 'generic/ttk')
-rw-r--r--generic/ttk/ttkButton.c27
-rw-r--r--generic/ttk/ttkEntry.c7
-rw-r--r--generic/ttk/ttkFrame.c5
-rw-r--r--generic/ttk/ttkNotebook.c3
-rw-r--r--generic/ttk/ttkPanedwindow.c3
-rw-r--r--generic/ttk/ttkProgress.c3
-rw-r--r--generic/ttk/ttkScale.c11
-rw-r--r--generic/ttk/ttkScrollbar.c3
-rw-r--r--generic/ttk/ttkSeparator.c6
-rw-r--r--generic/ttk/ttkSquare.c3
-rw-r--r--generic/ttk/ttkTheme.c36
-rw-r--r--generic/ttk/ttkTreeview.c3
-rw-r--r--generic/ttk/ttkWidget.c22
-rw-r--r--generic/ttk/ttkWidget.h6
14 files changed, 101 insertions, 37 deletions
diff --git a/generic/ttk/ttkButton.c b/generic/ttk/ttkButton.c
index e179a7f..0b3d0b1 100644
--- a/generic/ttk/ttkButton.c
+++ b/generic/ttk/ttkButton.c
@@ -273,11 +273,12 @@ static const Tk_OptionSpec LabelOptionSpecs[] =
};
static const Ttk_Ensemble LabelCommands[] = {
- { "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 }
};
@@ -378,12 +379,13 @@ ButtonInvokeCommand(
}
static const Ttk_Ensemble ButtonCommands[] = {
- { "configure", TtkWidgetConfigureCommand,0 },
{ "cget", TtkWidgetCgetCommand,0 },
- { "invoke", ButtonInvokeCommand,0 },
+ { "configure", TtkWidgetConfigureCommand,0 },
+ { "identify", TtkWidgetIdentifyCommand,0 },
{ "instate", TtkWidgetInstateCommand,0 },
+ { "invoke", ButtonInvokeCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
- { "identify", TtkWidgetIdentifyCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
{ 0,0,0 }
};
@@ -585,12 +587,13 @@ CheckbuttonInvokeCommand(
}
static const Ttk_Ensemble CheckbuttonCommands[] = {
- { "configure", TtkWidgetConfigureCommand,0 },
{ "cget", TtkWidgetCgetCommand,0 },
- { "invoke", CheckbuttonInvokeCommand,0 },
+ { "configure", TtkWidgetConfigureCommand,0 },
+ { "identify", TtkWidgetIdentifyCommand,0 },
{ "instate", TtkWidgetInstateCommand,0 },
+ { "invoke", CheckbuttonInvokeCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
- { "identify", TtkWidgetIdentifyCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
/* MISSING: select, deselect, toggle */
{ 0,0,0 }
};
@@ -761,12 +764,13 @@ RadiobuttonInvokeCommand(
}
static const Ttk_Ensemble RadiobuttonCommands[] = {
- { "configure", TtkWidgetConfigureCommand,0 },
{ "cget", TtkWidgetCgetCommand,0 },
- { "invoke", RadiobuttonInvokeCommand,0 },
+ { "configure", TtkWidgetConfigureCommand,0 },
+ { "identify", TtkWidgetIdentifyCommand,0 },
{ "instate", TtkWidgetInstateCommand,0 },
+ { "invoke", RadiobuttonInvokeCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
- { "identify", TtkWidgetIdentifyCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
/* MISSING: select, deselect */
{ 0,0,0 }
};
@@ -835,6 +839,7 @@ static const Ttk_Ensemble MenubuttonCommands[] = {
{ "instate", TtkWidgetInstateCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
{ "identify", TtkWidgetIdentifyCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
{ 0,0,0 }
};
diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c
index 946b7fc..65b0935 100644
--- a/generic/ttk/ttkEntry.c
+++ b/generic/ttk/ttkEntry.c
@@ -1745,6 +1745,7 @@ static const Ttk_Ensemble EntryCommands[] = {
{ "instate", TtkWidgetInstateCommand,0 },
{ "selection", 0,EntrySelectionCommands },
{ "state", TtkWidgetStateCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
{ "validate", EntryValidateCommand,0 },
{ "xview", EntryXViewCommand,0 },
{ 0,0,0 }
@@ -1913,8 +1914,9 @@ static const Ttk_Ensemble ComboboxCommands[] = {
{ "insert", EntryInsertCommand,0 },
{ "instate", TtkWidgetInstateCommand,0 },
{ "selection", 0,EntrySelectionCommands },
- { "state", TtkWidgetStateCommand,0 },
{ "set", EntrySetCommand,0 },
+ { "state", TtkWidgetStateCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
{ "validate", EntryValidateCommand,0 },
{ "xview", EntryXViewCommand,0 },
{ 0,0,0 }
@@ -2025,8 +2027,9 @@ static const Ttk_Ensemble SpinboxCommands[] = {
{ "insert", EntryInsertCommand,0 },
{ "instate", TtkWidgetInstateCommand,0 },
{ "selection", 0,EntrySelectionCommands },
- { "state", TtkWidgetStateCommand,0 },
{ "set", EntrySetCommand,0 },
+ { "state", TtkWidgetStateCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
{ "validate", EntryValidateCommand,0 },
{ "xview", EntryXViewCommand,0 },
{ 0,0,0 }
diff --git a/generic/ttk/ttkFrame.c b/generic/ttk/ttkFrame.c
index d7563a0..8ae249b 100644
--- a/generic/ttk/ttkFrame.c
+++ b/generic/ttk/ttkFrame.c
@@ -48,11 +48,12 @@ static const 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 }
};
diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c
index 26eab6b..5de4e22 100644
--- a/generic/ttk/ttkNotebook.c
+++ b/generic/ttk/ttkNotebook.c
@@ -1242,8 +1242,8 @@ static int NotebookTabCommand(
*/
static const Ttk_Ensemble NotebookCommands[] = {
{ "add", NotebookAddCommand,0 },
- { "configure", TtkWidgetConfigureCommand,0 },
{ "cget", TtkWidgetCgetCommand,0 },
+ { "configure", TtkWidgetConfigureCommand,0 },
{ "forget", NotebookForgetCommand,0 },
{ "hide", NotebookHideCommand,0 },
{ "identify", NotebookIdentifyCommand,0 },
@@ -1252,6 +1252,7 @@ static const Ttk_Ensemble NotebookCommands[] = {
{ "instate", TtkWidgetInstateCommand,0 },
{ "select", NotebookSelectCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
{ "tab", NotebookTabCommand,0 },
{ "tabs", NotebookTabsCommand,0 },
{ 0,0,0 }
diff --git a/generic/ttk/ttkPanedwindow.c b/generic/ttk/ttkPanedwindow.c
index ae7bf11..97a1b6c 100644
--- a/generic/ttk/ttkPanedwindow.c
+++ b/generic/ttk/ttkPanedwindow.c
@@ -882,8 +882,8 @@ static int PanedSashposCommand(
static const Ttk_Ensemble PanedCommands[] = {
{ "add", PanedAddCommand,0 },
- { "configure", TtkWidgetConfigureCommand,0 },
{ "cget", TtkWidgetCgetCommand,0 },
+ { "configure", TtkWidgetConfigureCommand,0 },
{ "forget", PanedForgetCommand,0 },
{ "identify", PanedIdentifyCommand,0 },
{ "insert", PanedInsertCommand,0 },
@@ -892,6 +892,7 @@ static const Ttk_Ensemble PanedCommands[] = {
{ "panes", PanedPanesCommand,0 },
{ "sashpos", PanedSashposCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
{ 0,0,0 }
};
diff --git a/generic/ttk/ttkProgress.c b/generic/ttk/ttkProgress.c
index 97109dc..9095c89 100644
--- a/generic/ttk/ttkProgress.c
+++ b/generic/ttk/ttkProgress.c
@@ -518,14 +518,15 @@ static int ProgressbarStopCommand(
}
static const Ttk_Ensemble ProgressbarCommands[] = {
- { "configure", TtkWidgetConfigureCommand,0 },
{ "cget", TtkWidgetCgetCommand,0 },
+ { "configure", TtkWidgetConfigureCommand,0 },
{ "identify", TtkWidgetIdentifyCommand,0 },
{ "instate", TtkWidgetInstateCommand,0 },
{ "start", ProgressbarStartCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
{ "step", ProgressbarStepCommand,0 },
{ "stop", ProgressbarStopCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
{ 0,0,0 }
};
diff --git a/generic/ttk/ttkScale.c b/generic/ttk/ttkScale.c
index 8c2999f..2913ace 100644
--- a/generic/ttk/ttkScale.c
+++ b/generic/ttk/ttkScale.c
@@ -483,14 +483,15 @@ ValueToPoint(Scale *scalePtr, double value)
}
static const Ttk_Ensemble ScaleCommands[] = {
- { "configure", TtkWidgetConfigureCommand,0 },
{ "cget", TtkWidgetCgetCommand,0 },
- { "state", TtkWidgetStateCommand,0 },
- { "instate", TtkWidgetInstateCommand,0 },
+ { "configure", TtkWidgetConfigureCommand,0 },
+ { "coords", ScaleCoordsCommand,0 },
+ { "get", ScaleGetCommand,0 },
{ "identify", TtkWidgetIdentifyCommand,0 },
+ { "instate", TtkWidgetInstateCommand,0 },
{ "set", ScaleSetCommand,0 },
- { "get", ScaleGetCommand,0 },
- { "coords", ScaleCoordsCommand,0 },
+ { "state", TtkWidgetStateCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
{ 0,0,0 }
};
diff --git a/generic/ttk/ttkScrollbar.c b/generic/ttk/ttkScrollbar.c
index 4670832..a16186d 100644
--- a/generic/ttk/ttkScrollbar.c
+++ b/generic/ttk/ttkScrollbar.c
@@ -282,8 +282,8 @@ ScrollbarFractionCommand(
}
static const Ttk_Ensemble ScrollbarCommands[] = {
- { "configure", TtkWidgetConfigureCommand,0 },
{ "cget", TtkWidgetCgetCommand,0 },
+ { "configure", TtkWidgetConfigureCommand,0 },
{ "delta", ScrollbarDeltaCommand,0 },
{ "fraction", ScrollbarFractionCommand,0 },
{ "get", ScrollbarGetCommand,0 },
@@ -291,6 +291,7 @@ static const Ttk_Ensemble ScrollbarCommands[] = {
{ "instate", TtkWidgetInstateCommand,0 },
{ "set", ScrollbarSetCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
{ 0,0,0 }
};
diff --git a/generic/ttk/ttkSeparator.c b/generic/ttk/ttkSeparator.c
index e86ee5c..85fdd02 100644
--- a/generic/ttk/ttkSeparator.c
+++ b/generic/ttk/ttkSeparator.c
@@ -48,11 +48,12 @@ static Ttk_Layout SeparatorGetLayout(
* Widget commands:
*/
static const Ttk_Ensemble SeparatorCommands[] = {
- { "configure", TtkWidgetConfigureCommand,0 },
{ "cget", TtkWidgetCgetCommand,0 },
+ { "configure", TtkWidgetConfigureCommand,0 },
{ "identify", TtkWidgetIdentifyCommand,0 },
{ "instate", TtkWidgetInstateCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
{ 0,0,0 }
};
@@ -89,11 +90,12 @@ static const Tk_OptionSpec SizegripOptionSpecs[] = {
};
static const Ttk_Ensemble SizegripCommands[] = {
- { "configure", TtkWidgetConfigureCommand,0 },
{ "cget", TtkWidgetCgetCommand,0 },
+ { "configure", TtkWidgetConfigureCommand,0 },
{ "identify", TtkWidgetIdentifyCommand,0 },
{ "instate", TtkWidgetInstateCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
{ 0,0,0 }
};
diff --git a/generic/ttk/ttkSquare.c b/generic/ttk/ttkSquare.c
index ba5df57..be5512e 100644
--- a/generic/ttk/ttkSquare.c
+++ b/generic/ttk/ttkSquare.c
@@ -129,11 +129,12 @@ SquareDoLayout(void *clientData)
*/
static const Ttk_Ensemble SquareCommands[] = {
- { "configure", TtkWidgetConfigureCommand,0 },
{ "cget", TtkWidgetCgetCommand,0 },
+ { "configure", TtkWidgetConfigureCommand,0 },
{ "identify", TtkWidgetIdentifyCommand,0 },
{ "instate", TtkWidgetInstateCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
{ 0,0,0 }
};
diff --git a/generic/ttk/ttkTheme.c b/generic/ttk/ttkTheme.c
index eaea800..cdabe32 100644
--- a/generic/ttk/ttkTheme.c
+++ b/generic/ttk/ttkTheme.c
@@ -95,7 +95,7 @@ Tcl_Obj *Ttk_StyleMap(Ttk_Style style, const char *optionName, Ttk_State state)
/*
* Ttk_StyleDefault --
- * Look up default resource setting the in the specified style.
+ * Look up default resource setting in the specified style.
*/
Tcl_Obj *Ttk_StyleDefault(Ttk_Style style, const char *optionName)
{
@@ -1262,10 +1262,10 @@ usage:
styleName = Tcl_GetString(objv[2]);
stylePtr = Ttk_GetStyle(theme, styleName);
- if (objc == 3) { /* style default $styleName */
+ if (objc == 3) { /* style configure $styleName */
Tcl_SetObjResult(interp, HashTableToDict(&stylePtr->defaultsTable));
return TCL_OK;
- } else if (objc == 4) { /* style default $styleName -option */
+ } else if (objc == 4) { /* style configure $styleName -option */
const char *optionName = Tcl_GetString(objv[3]);
Tcl_HashEntry *entryPtr =
Tcl_FindHashEntry(&stylePtr->defaultsTable, optionName);
@@ -1315,9 +1315,7 @@ static int StyleLookupCmd(
}
style = Ttk_GetStyle(theme, Tcl_GetString(objv[2]));
- if (!style) {
- return TCL_ERROR;
- }
+
optionName = Tcl_GetString(objv[3]);
if (objc >= 5) {
@@ -1612,6 +1610,31 @@ static int StyleLayoutCmd(
return TCL_OK;
}
+/* + style theme styles ?$theme? --
+ * Return list of styles available in $theme.
+ * Use the current theme if $theme is omitted.
+ */
+static int StyleThemeStylesCmd(
+ TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Ttk_Theme themePtr;
+
+ if (objc < 3 || objc > 4) {
+ Tcl_WrongNumArgs(interp, 3, objv, "?theme?");
+ return TCL_ERROR;
+ }
+
+ if (objc == 3) {
+ themePtr = Ttk_GetCurrentTheme(interp);
+ } else {
+ themePtr = Ttk_GetTheme(interp, Tcl_GetString(objv[3]));
+ }
+ if (!themePtr)
+ return TCL_ERROR;
+
+ return TtkEnumerateHashTable(interp, &themePtr->styleTable);
+}
+
/* + style theme use $theme --
* Sets the current theme to $theme
*/
@@ -1651,6 +1674,7 @@ static const Ttk_Ensemble StyleThemeEnsemble[] = {
{ "create", StyleThemeCreateCmd, 0 },
{ "names", StyleThemeNamesCmd, 0 },
{ "settings", StyleThemeSettingsCmd, 0 },
+ { "styles", StyleThemeStylesCmd, 0 },
{ "use", StyleThemeUseCmd, 0 },
{ NULL, 0, 0 }
};
diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c
index 4ea4c17..06bd2b8 100644
--- a/generic/ttk/ttkTreeview.c
+++ b/generic/ttk/ttkTreeview.c
@@ -3295,8 +3295,8 @@ static const Ttk_Ensemble TreeviewCommands[] = {
{ "heading", TreeviewHeadingCommand,0 },
{ "identify", TreeviewIdentifyCommand,0 },
{ "index", TreeviewIndexCommand,0 },
- { "instate", TtkWidgetInstateCommand,0 },
{ "insert", TreeviewInsertCommand,0 },
+ { "instate", TtkWidgetInstateCommand,0 },
{ "item", TreeviewItemCommand,0 },
{ "move", TreeviewMoveCommand,0 },
{ "next", TreeviewNextCommand,0 },
@@ -3306,6 +3306,7 @@ static const Ttk_Ensemble TreeviewCommands[] = {
{ "selection" , TreeviewSelectionCommand,0 },
{ "set", TreeviewSetCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
{ "tag", 0,TreeviewTagCommands },
{ "xview", TreeviewXViewCommand,0 },
{ "yview", TreeviewYViewCommand,0 },
diff --git a/generic/ttk/ttkWidget.c b/generic/ttk/ttkWidget.c
index 6726e17..1a5b158 100644
--- a/generic/ttk/ttkWidget.c
+++ b/generic/ttk/ttkWidget.c
@@ -5,7 +5,7 @@
*/
#include "tkInt.h"
-#include "ttkTheme.h"
+#include "ttkThemeInt.h"
#include "ttkWidget.h"
#ifdef MAC_OSX_TK
@@ -797,4 +797,24 @@ int TtkWidgetIdentifyCommand(
return TCL_OK;
}
+/* $w style
+ * Return the style currently applied to the widget.
+ */
+
+int TtkWidgetStyleCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ WidgetCore *corePtr = (WidgetCore *)recordPtr;
+
+ if (objc != 2) {
+ Tcl_WrongNumArgs(interp, 2, objv, "");
+ return TCL_ERROR;
+ }
+
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
+ Ttk_StyleName(Ttk_LayoutStyle(corePtr->layout)), -1));
+
+ return TCL_OK;
+}
+
/*EOF*/
diff --git a/generic/ttk/ttkWidget.h b/generic/ttk/ttkWidget.h
index 2eeab4e..9321cb0 100644
--- a/generic/ttk/ttkWidget.h
+++ b/generic/ttk/ttkWidget.h
@@ -89,15 +89,17 @@ MODULE_SCOPE int TtkCoreConfigure(Tcl_Interp*, void *, int mask);
/* Common widget commands:
*/
+MODULE_SCOPE int TtkWidgetCgetCommand(
+ void *,Tcl_Interp *, int, Tcl_Obj*const[]);
MODULE_SCOPE int TtkWidgetConfigureCommand(
void *,Tcl_Interp *, int, Tcl_Obj*const[]);
-MODULE_SCOPE int TtkWidgetCgetCommand(
+MODULE_SCOPE int TtkWidgetIdentifyCommand(
void *,Tcl_Interp *, int, Tcl_Obj*const[]);
MODULE_SCOPE int TtkWidgetInstateCommand(
void *,Tcl_Interp *, int, Tcl_Obj*const[]);
MODULE_SCOPE int TtkWidgetStateCommand(
void *,Tcl_Interp *, int, Tcl_Obj*const[]);
-MODULE_SCOPE int TtkWidgetIdentifyCommand(
+MODULE_SCOPE int TtkWidgetStyleCommand(
void *,Tcl_Interp *, int, Tcl_Obj*const[]);
/* Widget constructor: