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
{
31 CallbackRec callbacks
;
49 #define ICON_FILE "keyboard"
55 _Panel
*panel
= (_Panel
*)p
;
56 WMScreen
*scr
= WMWidgetScreen(panel
->win
);
61 color
= WMDarkGrayColor(scr
);
62 font
= WMSystemFontOfSize(scr
, 10);
64 panel
->frame
= WMCreateFrame(panel
->win
);
65 WMResizeWidget(panel
->frame
, FRAME_WIDTH
, FRAME_HEIGHT
);
66 WMMoveWidget(panel
->frame
, FRAME_LEFT
, FRAME_TOP
);
68 /**************** Initial Key Repeat ***************/
69 panel
->delaF
= WMCreateFrame(panel
->frame
);
70 WMResizeWidget(panel
->delaF
, 495, 60);
71 WMMoveWidget(panel
->delaF
, 15, 10);
72 WMSetFrameTitle(panel
->delaF
, _("Initial Key Repeat"));
74 for (i
= 0; i
< 4; i
++) {
75 panel
->delaB
[i
] = WMCreateButton(panel
->delaF
, WBTOnOff
);
76 WMResizeWidget(panel
->delaB
[i
], 60, 20);
77 WMMoveWidget(panel
->delaB
[i
], 70+i
*60, 25);
79 WMGroupButtons(panel
->delaB
[0], panel
->delaB
[i
]);
82 WMSetButtonText(panel
->delaB
[i
], "....a");
85 WMSetButtonText(panel
->delaB
[i
], "...a");
88 WMSetButtonText(panel
->delaB
[i
], "..a");
91 WMSetButtonText(panel
->delaB
[i
], ".a");
95 panel
->dmsT
= WMCreateTextField(panel
->delaF
);
96 WMResizeWidget(panel
->dmsT
, 50, 20);
97 WMMoveWidget(panel
->dmsT
, 345, 25);
98 /* WMSetTextFieldAlignment(panel->dmsT, WARight);*/
100 panel
->dmsL
= WMCreateLabel(panel
->delaF
);
101 WMResizeWidget(panel
->dmsL
, 30, 16);
102 WMMoveWidget(panel
->dmsL
, 400, 30);
103 WMSetLabelTextColor(panel
->dmsL
, color
);
104 WMSetLabelFont(panel
->dmsL
, font
);
105 WMSetLabelText(panel
->dmsL
, "msec");
107 WMMapSubwidgets(panel
->delaF
);
109 /**************** Key Repeat Rate ***************/
110 panel
->rateF
= WMCreateFrame(panel
->frame
);
111 WMResizeWidget(panel
->rateF
, 495, 60);
112 WMMoveWidget(panel
->rateF
, 15, 95);
113 WMSetFrameTitle(panel
->rateF
, _("Key Repeat Rate"));
115 for (i
= 0; i
< 4; i
++) {
116 panel
->rateB
[i
] = WMCreateButton(panel
->rateF
, WBTOnOff
);
117 WMResizeWidget(panel
->rateB
[i
], 60, 20);
118 WMMoveWidget(panel
->rateB
[i
], 70+i
*60, 25);
120 WMGroupButtons(panel
->rateB
[0], panel
->rateB
[i
]);
123 WMSetButtonText(panel
->rateB
[i
], "a....a");
126 WMSetButtonText(panel
->rateB
[i
], "a...a");
129 WMSetButtonText(panel
->rateB
[i
], "a..a");
132 WMSetButtonText(panel
->rateB
[i
], "a.a");
136 panel
->rmsT
= WMCreateTextField(panel
->rateF
);
137 WMResizeWidget(panel
->rmsT
, 50, 20);
138 WMMoveWidget(panel
->rmsT
, 345, 25);
139 /* WMSetTextFieldAlignment(panel->rmsT, WARight);*/
141 panel
->rmsL
= WMCreateLabel(panel
->rateF
);
142 WMResizeWidget(panel
->rmsL
, 30, 16);
143 WMMoveWidget(panel
->rmsL
, 400, 30);
144 WMSetLabelTextColor(panel
->rmsL
, color
);
145 WMSetLabelFont(panel
->rmsL
, font
);
146 WMSetLabelText(panel
->rmsL
, "msec");
148 WMMapSubwidgets(panel
->rateF
);
150 panel
->testT
= WMCreateTextField(panel
->frame
);
151 WMResizeWidget(panel
->testT
, 480, 20);
152 WMMoveWidget(panel
->testT
, 20, 180);
153 WMSetTextFieldText(panel
->testT
, _("Type here to test"));
155 WMReleaseColor(color
);
158 WMRealizeWidget(panel
->frame
);
159 WMMapSubwidgets(panel
->frame
);
165 InitKeyboardSettings(WMScreen
*scr
, WMWindow
*win
)
169 panel
= wmalloc(sizeof(_Panel
));
170 memset(panel
, 0, sizeof(_Panel
));
172 panel
->sectionName
= _("Keyboard Preferences");
176 panel
->callbacks
.createWidgets
= createPanel
;
178 AddSection(panel
, ICON_FILE
);