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,
25 typedef struct _Panel
{
32 CallbackRec callbacks
;
49 #define ICON_FILE "keyboard"
51 static void createPanel(Panel
* p
)
53 _Panel
*panel
= (_Panel
*) p
;
54 WMScreen
*scr
= WMWidgetScreen(panel
->parent
);
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);
76 WMGroupButtons(panel
->delaB
[0], panel
->delaB
[i
]);
79 WMSetButtonText(panel
->delaB
[i
], "....a");
82 WMSetButtonText(panel
->delaB
[i
], "...a");
85 WMSetButtonText(panel
->delaB
[i
], "..a");
88 WMSetButtonText(panel
->delaB
[i
], ".a");
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);
117 WMGroupButtons(panel
->rateB
[0], panel
->rateB
[i
]);
120 WMSetButtonText(panel
->rateB
[i
], "a....a");
123 WMSetButtonText(panel
->rateB
[i
], "a...a");
126 WMSetButtonText(panel
->rateB
[i
], "a..a");
129 WMSetButtonText(panel
->rateB
[i
], "a.a");
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
);
155 WMRealizeWidget(panel
->box
);
156 WMMapSubwidgets(panel
->box
);
159 Panel
*InitKeyboardSettings(WMScreen
* scr
, WMWidget
* parent
)
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
);