Improve dockapp recognition
[wmaker-crm.git] / WPrefs.app / KeyboardSettings.c
blob0f67aa77decf33503d73b629bcfb53eb9f129d30
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
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.
23 #include "WPrefs.h"
25 typedef struct _Panel {
26 WMBox *box;
28 char *sectionName;
30 char *description;
32 CallbackRec callbacks;
34 WMWidget *parent;
36 WMFrame *delaF;
37 WMButton *delaB[4];
38 WMLabel *dmsL;
39 WMTextField *dmsT;
41 WMFrame *rateF;
42 WMButton *rateB[4];
43 WMLabel *rmsL;
44 WMTextField *rmsT;
46 WMTextField *testT;
47 } _Panel;
49 #define ICON_FILE "keyboard"
51 static void createPanel(Panel * p)
53 _Panel *panel = (_Panel *) p;
54 WMScreen *scr = WMWidgetScreen(panel->parent);
55 int i;
56 WMColor *color;
57 WMFont *font;
59 color = WMDarkGrayColor(scr);
60 font = WMSystemFontOfSize(scr, 10);
62 panel->box = WMCreateBox(panel->parent);
63 WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
65 /**************** Initial Key Repeat ***************/
66 panel->delaF = WMCreateFrame(panel->box);
67 WMResizeWidget(panel->delaF, 495, 60);
68 WMMoveWidget(panel->delaF, 15, 10);
69 WMSetFrameTitle(panel->delaF, _("Initial Key Repeat"));
71 for (i = 0; i < 4; i++) {
72 panel->delaB[i] = WMCreateButton(panel->delaF, WBTOnOff);
73 WMResizeWidget(panel->delaB[i], 60, 20);
74 WMMoveWidget(panel->delaB[i], 70 + i * 60, 25);
75 if (i > 0)
76 WMGroupButtons(panel->delaB[0], panel->delaB[i]);
77 switch (i) {
78 case 0:
79 WMSetButtonText(panel->delaB[i], "....a");
80 break;
81 case 1:
82 WMSetButtonText(panel->delaB[i], "...a");
83 break;
84 case 2:
85 WMSetButtonText(panel->delaB[i], "..a");
86 break;
87 case 3:
88 WMSetButtonText(panel->delaB[i], ".a");
89 break;
92 panel->dmsT = WMCreateTextField(panel->delaF);
93 WMResizeWidget(panel->dmsT, 50, 20);
94 WMMoveWidget(panel->dmsT, 345, 25);
95 /* WMSetTextFieldAlignment(panel->dmsT, WARight); */
97 panel->dmsL = WMCreateLabel(panel->delaF);
98 WMResizeWidget(panel->dmsL, 30, 16);
99 WMMoveWidget(panel->dmsL, 400, 30);
100 WMSetLabelTextColor(panel->dmsL, color);
101 WMSetLabelFont(panel->dmsL, font);
102 WMSetLabelText(panel->dmsL, "msec");
104 WMMapSubwidgets(panel->delaF);
106 /**************** Key Repeat Rate ***************/
107 panel->rateF = WMCreateFrame(panel->box);
108 WMResizeWidget(panel->rateF, 495, 60);
109 WMMoveWidget(panel->rateF, 15, 95);
110 WMSetFrameTitle(panel->rateF, _("Key Repeat Rate"));
112 for (i = 0; i < 4; i++) {
113 panel->rateB[i] = WMCreateButton(panel->rateF, WBTOnOff);
114 WMResizeWidget(panel->rateB[i], 60, 20);
115 WMMoveWidget(panel->rateB[i], 70 + i * 60, 25);
116 if (i > 0)
117 WMGroupButtons(panel->rateB[0], panel->rateB[i]);
118 switch (i) {
119 case 0:
120 WMSetButtonText(panel->rateB[i], "a....a");
121 break;
122 case 1:
123 WMSetButtonText(panel->rateB[i], "a...a");
124 break;
125 case 2:
126 WMSetButtonText(panel->rateB[i], "a..a");
127 break;
128 case 3:
129 WMSetButtonText(panel->rateB[i], "a.a");
130 break;
133 panel->rmsT = WMCreateTextField(panel->rateF);
134 WMResizeWidget(panel->rmsT, 50, 20);
135 WMMoveWidget(panel->rmsT, 345, 25);
136 /* WMSetTextFieldAlignment(panel->rmsT, WARight); */
138 panel->rmsL = WMCreateLabel(panel->rateF);
139 WMResizeWidget(panel->rmsL, 30, 16);
140 WMMoveWidget(panel->rmsL, 400, 30);
141 WMSetLabelTextColor(panel->rmsL, color);
142 WMSetLabelFont(panel->rmsL, font);
143 WMSetLabelText(panel->rmsL, "msec");
145 WMMapSubwidgets(panel->rateF);
147 panel->testT = WMCreateTextField(panel->box);
148 WMResizeWidget(panel->testT, 480, 20);
149 WMMoveWidget(panel->testT, 20, 180);
150 WMSetTextFieldText(panel->testT, _("Type here to test"));
152 WMReleaseColor(color);
153 WMReleaseFont(font);
155 WMRealizeWidget(panel->box);
156 WMMapSubwidgets(panel->box);
159 Panel *InitKeyboardSettings(WMScreen * scr, WMWidget * parent)
161 _Panel *panel;
163 panel = wmalloc(sizeof(_Panel));
164 memset(panel, 0, sizeof(_Panel));
166 panel->sectionName = _("Keyboard Preferences");
168 panel->description = _("Not done");
170 panel->parent = parent;
172 panel->callbacks.createWidgets = createPanel;
174 AddSection(panel, ICON_FILE);
176 return panel;