1 /* KeyboardSettings.c- keyboard options (equivalent to xset)
3 * WPrefs - Window Maker Preferences Program
5 * Copyright (c) 1998-2003 Alfredo K. Kojima
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 typedef struct _Panel
{
31 CallbackRec callbacks
;
48 #define ICON_FILE "keyboard"
50 static void createPanel(Panel
* p
)
52 _Panel
*panel
= (_Panel
*) p
;
53 WMScreen
*scr
= WMWidgetScreen(panel
->parent
);
58 color
= WMDarkGrayColor(scr
);
59 font
= WMSystemFontOfSize(scr
, 10);
61 panel
->box
= WMCreateBox(panel
->parent
);
62 WMSetViewExpandsToParent(WMWidgetView(panel
->box
), 2, 2, 2, 2);
64 /**************** Initial Key Repeat ***************/
65 panel
->delaF
= WMCreateFrame(panel
->box
);
66 WMResizeWidget(panel
->delaF
, 495, 60);
67 WMMoveWidget(panel
->delaF
, 15, 10);
68 WMSetFrameTitle(panel
->delaF
, _("Initial Key Repeat"));
70 for (i
= 0; i
< 4; i
++) {
71 panel
->delaB
[i
] = WMCreateButton(panel
->delaF
, WBTOnOff
);
72 WMResizeWidget(panel
->delaB
[i
], 60, 20);
73 WMMoveWidget(panel
->delaB
[i
], 70 + i
* 60, 25);
75 WMGroupButtons(panel
->delaB
[0], panel
->delaB
[i
]);
78 WMSetButtonText(panel
->delaB
[i
], "....a");
81 WMSetButtonText(panel
->delaB
[i
], "...a");
84 WMSetButtonText(panel
->delaB
[i
], "..a");
87 WMSetButtonText(panel
->delaB
[i
], ".a");
91 panel
->dmsT
= WMCreateTextField(panel
->delaF
);
92 WMResizeWidget(panel
->dmsT
, 50, 20);
93 WMMoveWidget(panel
->dmsT
, 345, 25);
94 /* WMSetTextFieldAlignment(panel->dmsT, WARight); */
96 panel
->dmsL
= WMCreateLabel(panel
->delaF
);
97 WMResizeWidget(panel
->dmsL
, 30, 16);
98 WMMoveWidget(panel
->dmsL
, 400, 30);
99 WMSetLabelTextColor(panel
->dmsL
, color
);
100 WMSetLabelFont(panel
->dmsL
, font
);
101 WMSetLabelText(panel
->dmsL
, "msec");
103 WMMapSubwidgets(panel
->delaF
);
105 /**************** Key Repeat Rate ***************/
106 panel
->rateF
= WMCreateFrame(panel
->box
);
107 WMResizeWidget(panel
->rateF
, 495, 60);
108 WMMoveWidget(panel
->rateF
, 15, 95);
109 WMSetFrameTitle(panel
->rateF
, _("Key Repeat Rate"));
111 for (i
= 0; i
< 4; i
++) {
112 panel
->rateB
[i
] = WMCreateButton(panel
->rateF
, WBTOnOff
);
113 WMResizeWidget(panel
->rateB
[i
], 60, 20);
114 WMMoveWidget(panel
->rateB
[i
], 70 + i
* 60, 25);
116 WMGroupButtons(panel
->rateB
[0], panel
->rateB
[i
]);
119 WMSetButtonText(panel
->rateB
[i
], "a....a");
122 WMSetButtonText(panel
->rateB
[i
], "a...a");
125 WMSetButtonText(panel
->rateB
[i
], "a..a");
128 WMSetButtonText(panel
->rateB
[i
], "a.a");
132 panel
->rmsT
= WMCreateTextField(panel
->rateF
);
133 WMResizeWidget(panel
->rmsT
, 50, 20);
134 WMMoveWidget(panel
->rmsT
, 345, 25);
135 /* WMSetTextFieldAlignment(panel->rmsT, WARight); */
137 panel
->rmsL
= WMCreateLabel(panel
->rateF
);
138 WMResizeWidget(panel
->rmsL
, 30, 16);
139 WMMoveWidget(panel
->rmsL
, 400, 30);
140 WMSetLabelTextColor(panel
->rmsL
, color
);
141 WMSetLabelFont(panel
->rmsL
, font
);
142 WMSetLabelText(panel
->rmsL
, "msec");
144 WMMapSubwidgets(panel
->rateF
);
146 panel
->testT
= WMCreateTextField(panel
->box
);
147 WMResizeWidget(panel
->testT
, 480, 20);
148 WMMoveWidget(panel
->testT
, 20, 180);
149 WMSetTextFieldText(panel
->testT
, _("Type here to test"));
151 WMReleaseColor(color
);
154 WMRealizeWidget(panel
->box
);
155 WMMapSubwidgets(panel
->box
);
158 Panel
*InitKeyboardSettings(WMScreen
* scr
, WMWidget
* parent
)
162 panel
= wmalloc(sizeof(_Panel
));
164 panel
->sectionName
= _("Keyboard Preferences");
166 panel
->description
= _("Not done");
168 panel
->parent
= parent
;
170 panel
->callbacks
.createWidgets
= createPanel
;
172 AddSection(panel
, ICON_FILE
);