1 /* KeyboardSettings.c- keyboard options (equivalent to xset)
3 * WPrefs - Window Maker Preferences Program
5 * Copyright (c) 1998 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
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
26 typedef struct _Panel
{
33 CallbackRec callbacks
;
51 #define ICON_FILE "keyboard"
57 _Panel
*panel
= (_Panel
*)p
;
58 WMScreen
*scr
= WMWidgetScreen(panel
->parent
);
63 color
= WMDarkGrayColor(scr
);
64 font
= WMSystemFontOfSize(scr
, 10);
66 panel
->box
= WMCreateBox(panel
->parent
);
67 WMSetViewExpandsToParent(WMWidgetView(panel
->box
), 2, 2, 0, 0);
69 /**************** Initial Key Repeat ***************/
70 panel
->delaF
= WMCreateFrame(panel
->box
);
71 WMResizeWidget(panel
->delaF
, 495, 60);
72 WMMoveWidget(panel
->delaF
, 15, 10);
73 WMSetFrameTitle(panel
->delaF
, _("Initial Key Repeat"));
75 for (i
= 0; i
< 4; i
++) {
76 panel
->delaB
[i
] = WMCreateButton(panel
->delaF
, WBTOnOff
);
77 WMResizeWidget(panel
->delaB
[i
], 60, 20);
78 WMMoveWidget(panel
->delaB
[i
], 70+i
*60, 25);
80 WMGroupButtons(panel
->delaB
[0], panel
->delaB
[i
]);
83 WMSetButtonText(panel
->delaB
[i
], "....a");
86 WMSetButtonText(panel
->delaB
[i
], "...a");
89 WMSetButtonText(panel
->delaB
[i
], "..a");
92 WMSetButtonText(panel
->delaB
[i
], ".a");
96 panel
->dmsT
= WMCreateTextField(panel
->delaF
);
97 WMResizeWidget(panel
->dmsT
, 50, 20);
98 WMMoveWidget(panel
->dmsT
, 345, 25);
99 /* WMSetTextFieldAlignment(panel->dmsT, WARight);*/
101 panel
->dmsL
= WMCreateLabel(panel
->delaF
);
102 WMResizeWidget(panel
->dmsL
, 30, 16);
103 WMMoveWidget(panel
->dmsL
, 400, 30);
104 WMSetLabelTextColor(panel
->dmsL
, color
);
105 WMSetLabelFont(panel
->dmsL
, font
);
106 WMSetLabelText(panel
->dmsL
, "msec");
108 WMMapSubwidgets(panel
->delaF
);
110 /**************** Key Repeat Rate ***************/
111 panel
->rateF
= WMCreateFrame(panel
->box
);
112 WMResizeWidget(panel
->rateF
, 495, 60);
113 WMMoveWidget(panel
->rateF
, 15, 95);
114 WMSetFrameTitle(panel
->rateF
, _("Key Repeat Rate"));
116 for (i
= 0; i
< 4; i
++) {
117 panel
->rateB
[i
] = WMCreateButton(panel
->rateF
, WBTOnOff
);
118 WMResizeWidget(panel
->rateB
[i
], 60, 20);
119 WMMoveWidget(panel
->rateB
[i
], 70+i
*60, 25);
121 WMGroupButtons(panel
->rateB
[0], panel
->rateB
[i
]);
124 WMSetButtonText(panel
->rateB
[i
], "a....a");
127 WMSetButtonText(panel
->rateB
[i
], "a...a");
130 WMSetButtonText(panel
->rateB
[i
], "a..a");
133 WMSetButtonText(panel
->rateB
[i
], "a.a");
137 panel
->rmsT
= WMCreateTextField(panel
->rateF
);
138 WMResizeWidget(panel
->rmsT
, 50, 20);
139 WMMoveWidget(panel
->rmsT
, 345, 25);
140 /* WMSetTextFieldAlignment(panel->rmsT, WARight);*/
142 panel
->rmsL
= WMCreateLabel(panel
->rateF
);
143 WMResizeWidget(panel
->rmsL
, 30, 16);
144 WMMoveWidget(panel
->rmsL
, 400, 30);
145 WMSetLabelTextColor(panel
->rmsL
, color
);
146 WMSetLabelFont(panel
->rmsL
, font
);
147 WMSetLabelText(panel
->rmsL
, "msec");
149 WMMapSubwidgets(panel
->rateF
);
151 panel
->testT
= WMCreateTextField(panel
->box
);
152 WMResizeWidget(panel
->testT
, 480, 20);
153 WMMoveWidget(panel
->testT
, 20, 180);
154 WMSetTextFieldText(panel
->testT
, _("Type here to test"));
156 WMReleaseColor(color
);
159 WMRealizeWidget(panel
->box
);
160 WMMapSubwidgets(panel
->box
);
166 InitKeyboardSettings(WMScreen
*scr
, WMWidget
*parent
)
170 panel
= wmalloc(sizeof(_Panel
));
171 memset(panel
, 0, sizeof(_Panel
));
173 panel
->sectionName
= _("Keyboard Preferences");
175 panel
->description
= _("Not done");
177 panel
->parent
= parent
;
179 panel
->callbacks
.createWidgets
= createPanel
;
181 AddSection(panel
, ICON_FILE
);