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
->win
);
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);
81 WMGroupButtons(panel
->delaB
[0], panel
->delaB
[i
]);
84 WMSetButtonText(panel
->delaB
[i
], "....a");
87 WMSetButtonText(panel
->delaB
[i
], "...a");
90 WMSetButtonText(panel
->delaB
[i
], "..a");
93 WMSetButtonText(panel
->delaB
[i
], ".a");
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);
122 WMGroupButtons(panel
->rateB
[0], panel
->rateB
[i
]);
125 WMSetButtonText(panel
->rateB
[i
], "a....a");
128 WMSetButtonText(panel
->rateB
[i
], "a...a");
131 WMSetButtonText(panel
->rateB
[i
], "a..a");
134 WMSetButtonText(panel
->rateB
[i
], "a.a");
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
);
160 WMRealizeWidget(panel
->frame
);
161 WMMapSubwidgets(panel
->frame
);
167 InitKeyboardSettings(WMScreen
*scr
, WMWindow
*win
)
171 panel
= wmalloc(sizeof(_Panel
));
172 memset(panel
, 0, sizeof(_Panel
));
174 panel
->sectionName
= _("Keyboard Preferences");
176 panel
->description
= _("Not done");
180 panel
->callbacks
.createWidgets
= createPanel
;
182 AddSection(panel
, ICON_FILE
);