added balloon help
[wmaker-crm.git] / WPrefs.app / KeyboardSettings.c
blobf8ebbbf4f858d5f9fdd7ec1330edc21e9582d2ca
1 /* KeyboardSettings.c- keyboard options (equivalent to xset)
2 *
3 * WPrefs - Window Maker Preferences Program
4 *
5 * Copyright (c) 1998 Alfredo K. Kojima
6 *
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,
20 * USA.
24 #include "WPrefs.h"
26 typedef struct _Panel {
27 WMFrame *frame;
29 char *sectionName;
31 char *description;
33 CallbackRec callbacks;
35 WMWindow *win;
37 WMFrame *delaF;
38 WMButton *delaB[4];
39 WMLabel *dmsL;
40 WMTextField *dmsT;
42 WMFrame *rateF;
43 WMButton *rateB[4];
44 WMLabel *rmsL;
45 WMTextField *rmsT;
47 WMTextField *testT;
48 } _Panel;
51 #define ICON_FILE "keyboard"
54 static void
55 createPanel(Panel *p)
57 _Panel *panel = (_Panel*)p;
58 WMScreen *scr = WMWidgetScreen(panel->win);
59 int i;
60 WMColor *color;
61 WMFont *font;
63 color = WMDarkGrayColor(scr);
64 font = WMSystemFontOfSize(scr, 10);
66 panel->frame = WMCreateFrame(panel->win);
67 WMResizeWidget(panel->frame, FRAME_WIDTH, FRAME_HEIGHT);
68 WMMoveWidget(panel->frame, FRAME_LEFT, FRAME_TOP);
70 /**************** Initial Key Repeat ***************/
71 panel->delaF = WMCreateFrame(panel->frame);
72 WMResizeWidget(panel->delaF, 495, 60);
73 WMMoveWidget(panel->delaF, 15, 10);
74 WMSetFrameTitle(panel->delaF, _("Initial Key Repeat"));
76 for (i = 0; i < 4; i++) {
77 panel->delaB[i] = WMCreateButton(panel->delaF, WBTOnOff);
78 WMResizeWidget(panel->delaB[i], 60, 20);
79 WMMoveWidget(panel->delaB[i], 70+i*60, 25);
80 if (i>0)
81 WMGroupButtons(panel->delaB[0], panel->delaB[i]);
82 switch (i) {
83 case 0:
84 WMSetButtonText(panel->delaB[i], "....a");
85 break;
86 case 1:
87 WMSetButtonText(panel->delaB[i], "...a");
88 break;
89 case 2:
90 WMSetButtonText(panel->delaB[i], "..a");
91 break;
92 case 3:
93 WMSetButtonText(panel->delaB[i], ".a");
94 break;
97 panel->dmsT = WMCreateTextField(panel->delaF);
98 WMResizeWidget(panel->dmsT, 50, 20);
99 WMMoveWidget(panel->dmsT, 345, 25);
100 /* WMSetTextFieldAlignment(panel->dmsT, WARight);*/
102 panel->dmsL = WMCreateLabel(panel->delaF);
103 WMResizeWidget(panel->dmsL, 30, 16);
104 WMMoveWidget(panel->dmsL, 400, 30);
105 WMSetLabelTextColor(panel->dmsL, color);
106 WMSetLabelFont(panel->dmsL, font);
107 WMSetLabelText(panel->dmsL, "msec");
109 WMMapSubwidgets(panel->delaF);
111 /**************** Key Repeat Rate ***************/
112 panel->rateF = WMCreateFrame(panel->frame);
113 WMResizeWidget(panel->rateF, 495, 60);
114 WMMoveWidget(panel->rateF, 15, 95);
115 WMSetFrameTitle(panel->rateF, _("Key Repeat Rate"));
117 for (i = 0; i < 4; i++) {
118 panel->rateB[i] = WMCreateButton(panel->rateF, WBTOnOff);
119 WMResizeWidget(panel->rateB[i], 60, 20);
120 WMMoveWidget(panel->rateB[i], 70+i*60, 25);
121 if (i>0)
122 WMGroupButtons(panel->rateB[0], panel->rateB[i]);
123 switch (i) {
124 case 0:
125 WMSetButtonText(panel->rateB[i], "a....a");
126 break;
127 case 1:
128 WMSetButtonText(panel->rateB[i], "a...a");
129 break;
130 case 2:
131 WMSetButtonText(panel->rateB[i], "a..a");
132 break;
133 case 3:
134 WMSetButtonText(panel->rateB[i], "a.a");
135 break;
138 panel->rmsT = WMCreateTextField(panel->rateF);
139 WMResizeWidget(panel->rmsT, 50, 20);
140 WMMoveWidget(panel->rmsT, 345, 25);
141 /* WMSetTextFieldAlignment(panel->rmsT, WARight);*/
143 panel->rmsL = WMCreateLabel(panel->rateF);
144 WMResizeWidget(panel->rmsL, 30, 16);
145 WMMoveWidget(panel->rmsL, 400, 30);
146 WMSetLabelTextColor(panel->rmsL, color);
147 WMSetLabelFont(panel->rmsL, font);
148 WMSetLabelText(panel->rmsL, "msec");
150 WMMapSubwidgets(panel->rateF);
152 panel->testT = WMCreateTextField(panel->frame);
153 WMResizeWidget(panel->testT, 480, 20);
154 WMMoveWidget(panel->testT, 20, 180);
155 WMSetTextFieldText(panel->testT, _("Type here to test"));
157 WMReleaseColor(color);
158 WMReleaseFont(font);
160 WMRealizeWidget(panel->frame);
161 WMMapSubwidgets(panel->frame);
166 Panel*
167 InitKeyboardSettings(WMScreen *scr, WMWindow *win)
169 _Panel *panel;
171 panel = wmalloc(sizeof(_Panel));
172 memset(panel, 0, sizeof(_Panel));
174 panel->sectionName = _("Keyboard Preferences");
176 panel->description = _("Not done");
178 panel->win = win;
180 panel->callbacks.createWidgets = createPanel;
182 AddSection(panel, ICON_FILE);
184 return panel;