1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
/* $Id: ttkSeparator.c,v 1.2 2006/11/03 03:06:22 das Exp $
*
* Copyright (c) 2004, Joe English
*
* Ttk widget set: separator and sizegrip widgets.
*/
#include <tk.h>
#include "ttkTheme.h"
#include "ttkWidget.h"
/* +++ Separator widget record:
*/
typedef struct
{
Tcl_Obj *orientObj;
int orient;
} SeparatorPart;
typedef struct
{
WidgetCore core;
SeparatorPart separator;
} Separator;
static Tk_OptionSpec SeparatorOptionSpecs[] =
{
{TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "horizontal",
Tk_Offset(Separator,separator.orientObj),
Tk_Offset(Separator,separator.orient),
0,(ClientData)ttkOrientStrings,STYLE_CHANGED },
WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs)
};
/*
* GetLayout hook --
* Choose layout based on -orient option.
*/
static Ttk_Layout SeparatorGetLayout(
Tcl_Interp *interp, Ttk_Theme theme, void *recordPtr)
{
Separator *sep = recordPtr;
return TtkWidgetGetOrientedLayout(
interp, theme, recordPtr, sep->separator.orientObj);
}
/*
* Widget commands:
*/
static WidgetCommandSpec SeparatorCommands[] =
{
{ "configure", TtkWidgetConfigureCommand },
{ "cget", TtkWidgetCgetCommand },
{ "identify", TtkWidgetIdentifyCommand },
{ "instate", TtkWidgetInstateCommand },
{ "state", TtkWidgetStateCommand },
{ NULL, NULL }
};
/*
* Widget specification:
*/
MODULE_SCOPE WidgetSpec ttkSeparatorWidgetSpec;
WidgetSpec ttkSeparatorWidgetSpec =
{
"TSeparator", /* className */
sizeof(Separator), /* recordSize */
SeparatorOptionSpecs, /* optionSpecs */
SeparatorCommands, /* subcommands */
TtkNullInitialize, /* initializeProc */
TtkNullCleanup, /* cleanupProc */
TtkCoreConfigure, /* configureProc */
TtkNullPostConfigure, /* postConfigureProc */
SeparatorGetLayout, /* getLayoutProc */
TtkWidgetSize, /* sizeProc */
TtkWidgetDoLayout, /* layoutProc */
TtkWidgetDisplay /* displayProc */
};
/* +++ Sizegrip widget:
* Has no options or methods other than the standard ones.
*/
static WidgetCommandSpec SizegripCommands[] =
{
{ "configure", TtkWidgetConfigureCommand },
{ "cget", TtkWidgetCgetCommand },
{ "identify", TtkWidgetIdentifyCommand },
{ "instate", TtkWidgetInstateCommand },
{ "state", TtkWidgetStateCommand },
{ NULL, NULL }
};
MODULE_SCOPE WidgetSpec ttkSizegripWidgetSpec;
WidgetSpec ttkSizegripWidgetSpec =
{
"TSizegrip", /* className */
sizeof(WidgetCore), /* recordSize */
ttkCoreOptionSpecs, /* optionSpecs */
SizegripCommands, /* subcommands */
TtkNullInitialize, /* initializeProc */
TtkNullCleanup, /* cleanupProc */
TtkCoreConfigure, /* configureProc */
TtkNullPostConfigure, /* postConfigureProc */
TtkWidgetGetLayout, /* getLayoutProc */
TtkWidgetSize, /* sizeProc */
TtkWidgetDoLayout, /* layoutProc */
TtkWidgetDisplay /* displayProc */
};
/*EOF*/
|