]> git.saurik.com Git - wxWidgets.git/blame - wxPython/wx/tools/XRCed/params.py
Allow AutoCompletion for items in collections too
[wxWidgets.git] / wxPython / wx / tools / XRCed / params.py
CommitLineData
d14a1e28
RD
1# Name: params.py
2# Purpose: Classes for parameter introduction
3# Author: Roman Rolinsky <rolinsky@mema.ucl.ac.be>
4# Created: 22.08.2001
5# RCS-ID: $Id$
6
7import string
8import os.path
9from globals import *
10from types import *
d14a1e28 11
b2371711 12genericStyles = [
306b6fe9 13 'wxSIMPLE_BORDER', 'wxSUNKEN_BORDER', 'wxDOUBLE_BORDER',
64bce500 14 'wxRAISED_BORDER', 'wxSTATIC_BORDER', 'wxNO_BORDER',
306b6fe9
RR
15 'wxCLIP_CHILDREN', 'wxTRANSPARENT_WINDOW', 'wxWANTS_CHARS',
16 'wxNO_FULL_REPAINT_ON_RESIZE', 'wxFULL_REPAINT_ON_RESIZE'
64bce500
RR
17 ]
18
19genericExStyles = [
20 'wxWS_EX_VALIDATE_RECURSIVELY',
b2371711 21 'wxWS_EX_BLOCK_EVENTS',
64bce500
RR
22 'wxWS_EX_TRANSIENT',
23 'wxFRAME_EX_CONTEXTHELP',
24 'wxWS_EX_PROCESS_IDLE',
25 'wxWS_EX_PROCESS_UI_UPDATES'
26 ]
d14a1e28
RD
27
28buttonSize = (35,-1) # in dialog units, transformed to pixels in panel ctor
29
30# Class that can properly disable children
29a41103 31class PPanel(wx.Panel):
d14a1e28 32 def __init__(self, parent, name):
29a41103 33 wx.Panel.__init__(self, parent, -1, name=name)
d14a1e28
RD
34 self.modified = self.freeze = False
35 def Enable(self, value):
36 # Something strange is going on with enable so we make sure...
37 for w in self.GetChildren():
38 w.Enable(value)
29a41103 39 #wx.Panel.Enable(self, value)
d14a1e28
RD
40 def SetModified(self):
41 self.modified = True
42 g.panel.SetModified(True)
43 # Common method to set modified state
44 def OnChange(self, evt):
45 if self.freeze: return
46 self.SetModified()
47 evt.Skip()
48
49class ParamBinaryOr(PPanel):
50 def __init__(self, parent, name):
51 PPanel.__init__(self, parent, name)
29a41103
RD
52 self.ID_TEXT_CTRL = wx.NewId()
53 self.ID_BUTTON_CHOICES = wx.NewId()
54 sizer = wx.BoxSizer()
55 self.text = wx.TextCtrl(self, self.ID_TEXT_CTRL, size=wx.Size(200,-1))
56 sizer.Add(self.text, 0, wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
57 self.button = wx.Button(self, self.ID_BUTTON_CHOICES, 'Edit...', size=buttonSize)
58 sizer.Add(self.button, 0, wx.ALIGN_CENTER_VERTICAL)
d14a1e28
RD
59 self.SetAutoLayout(True)
60 self.SetSizer(sizer)
61 sizer.Fit(self)
29a41103
RD
62 wx.EVT_BUTTON(self, self.ID_BUTTON_CHOICES, self.OnButtonChoices)
63 wx.EVT_TEXT(self, self.ID_TEXT_CTRL, self.OnChange)
d14a1e28
RD
64 def GetValue(self):
65 return self.text.GetValue()
66 def SetValue(self, value):
67 self.freeze = True
68 self.text.SetValue(value)
69 self.freeze = False
70 def OnButtonChoices(self, evt):
a4c013b2 71 dlg = g.frame.res.LoadDialog(self, 'DIALOG_CHOICES')
c032d94e
RR
72 if self.GetName() == 'flag': dlg.SetTitle('Sizer item flags')
73 elif self.GetName() == 'style': dlg.SetTitle('Window styles')
74 elif self.GetName() == 'exstyle': dlg.SetTitle('Extended window styles')
29a41103 75 listBox = xrc.XRCCTRL(dlg, 'CHECKLIST')
a4c013b2 76 listBox.InsertItems(self.values, 0)
d14a1e28
RD
77 value = map(string.strip, self.text.GetValue().split('|'))
78 if value == ['']: value = []
79 ignored = []
80 for i in value:
81 try:
82 listBox.Check(self.values.index(i))
83 except ValueError:
84 # Try to find equal
85 if self.equal.has_key(i):
86 listBox.Check(self.values.index(self.equal[i]))
87 else:
88 print 'WARNING: unknown flag: %s: ignored.' % i
89 ignored.append(i)
29a41103 90 if dlg.ShowModal() == wx.ID_OK:
d14a1e28 91 value = []
31f04352 92 for i in range(listBox.GetCount()):
d14a1e28
RD
93 if listBox.IsChecked(i):
94 value.append(self.values[i])
95 # Add ignored flags
96 value.extend(ignored)
97 if value:
98 self.SetValue(reduce(lambda a,b: a+'|'+b, value))
99 else:
100 self.SetValue('')
101 self.SetModified()
102 dlg.Destroy()
103
104class ParamFlag(ParamBinaryOr):
105 values = ['wxTOP', 'wxBOTTOM', 'wxLEFT', 'wxRIGHT', 'wxALL',
306b6fe9
RR
106 'wxEXPAND', 'wxGROW', 'wxSHAPED', 'wxSTRETCH_NOT',
107 'wxALIGN_CENTRE', 'wxALIGN_LEFT', 'wxALIGN_RIGHT',
108 'wxALIGN_TOP', 'wxALIGN_BOTTOM',
109 'wxALIGN_CENTRE_VERTICAL', 'wxALIGN_CENTRE_HORIZONTAL',
110 'wxADJUST_MINSIZE', 'wxFIXED_MINSIZE'
9abdd2cb 111 ]
d14a1e28
RD
112 equal = {'wxALIGN_CENTER': 'wxALIGN_CENTRE',
113 'wxALIGN_CENTER_VERTICAL': 'wxALIGN_CENTRE_VERTICAL',
306b6fe9
RR
114 'wxALIGN_CENTER_HORIZONTAL': 'wxALIGN_CENTRE_HORIZONTAL',
115 'wxUP': 'wxTOP', 'wxDOWN': 'wxBOTTOM', 'wxNORTH': 'wxTOP',
116 'wxSOUTH': 'wxBOTTOM', 'wxWEST': 'wxLEFT', 'wxEAST': 'wxRIGHT'}
d14a1e28
RD
117 def __init__(self, parent, name):
118 ParamBinaryOr.__init__(self, parent, name)
119
c032d94e 120class ParamNonGenericStyle(ParamBinaryOr):
d14a1e28 121 def __init__(self, parent, name):
c032d94e 122 self.values = g.currentXXX.winStyles
d14a1e28
RD
123 ParamBinaryOr.__init__(self, parent, name)
124
c032d94e
RR
125class ParamStyle(ParamBinaryOr):
126 equal = {'wxALIGN_CENTER': 'wxALIGN_CENTRE'}
d14a1e28 127 def __init__(self, parent, name):
d14a1e28 128 ParamBinaryOr.__init__(self, parent, name)
c032d94e
RR
129 self.valuesSpecific = g.currentXXX.winStyles
130 if self.valuesSpecific: # override if using specific styles
131 # Remove duplicates
132 self.valuesGeneric = [s for s in genericStyles
133 if s not in self.valuesSpecific]
29a41103 134 wx.EVT_BUTTON(self, self.ID_BUTTON_CHOICES, self.OnButtonChoicesBoth)
c032d94e
RR
135 else:
136 self.values = genericStyles
137 def OnButtonChoicesBoth(self, evt):
138 dlg = g.frame.res.LoadDialog(self, 'DIALOG_STYLES')
29a41103 139 listBoxSpecific = xrc.XRCCTRL(dlg, 'CHECKLIST_SPECIFIC')
c032d94e 140 listBoxSpecific.InsertItems(self.valuesSpecific, 0)
29a41103 141 listBoxGeneric = xrc.XRCCTRL(dlg, 'CHECKLIST_GENERIC')
c032d94e
RR
142 listBoxGeneric.InsertItems(self.valuesGeneric, 0)
143 value = map(string.strip, self.text.GetValue().split('|'))
144 if value == ['']: value = []
145 # Set specific styles
146 value2 = [] # collect generic and ignored here
147 for i in value:
148 try:
149 listBoxSpecific.Check(self.valuesSpecific.index(i))
150 except ValueError:
151 # Try to find equal
152 if self.equal.has_key(i):
153 listBoxSpecific.Check(self.valuesSpecific.index(self.equal[i]))
154 else:
155 value2.append(i)
156 ignored = []
157 # Set generic styles, collect non-standart values
158 for i in value2:
159 try:
160 listBoxGeneric.Check(self.valuesGeneric.index(i))
161 except ValueError:
162 # Try to find equal
163 if self.equal.has_key(i):
164 listBoxGeneric.Check(self.valuesGeneric.index(self.equal[i]))
165 else:
166 print 'WARNING: unknown flag: %s: ignored.' % i
167 ignored.append(i)
29a41103 168 if dlg.ShowModal() == wx.ID_OK:
c032d94e
RR
169 value = [self.valuesSpecific[i]
170 for i in range(listBoxSpecific.GetCount())
171 if listBoxSpecific.IsChecked(i)] + \
172 [self.valuesGeneric[i]
173 for i in range(listBoxGeneric.GetCount())
174 if listBoxGeneric.IsChecked(i)] + ignored
175 if value:
176 self.SetValue(reduce(lambda a,b: a+'|'+b, value))
177 else:
178 self.SetValue('')
179 self.SetModified()
180 dlg.Destroy()
d14a1e28
RD
181
182class ParamExStyle(ParamBinaryOr):
183 def __init__(self, parent, name):
184 if g.currentXXX:
64bce500 185 self.values = g.currentXXX.exStyles + genericExStyles
d14a1e28
RD
186 else:
187 self.values = []
188 ParamBinaryOr.__init__(self, parent, name)
189
190class ParamColour(PPanel):
191 def __init__(self, parent, name):
192 PPanel.__init__(self, parent, name)
29a41103
RD
193 self.ID_TEXT_CTRL = wx.NewId()
194 self.ID_BUTTON = wx.NewId()
195 sizer = wx.BoxSizer()
196 self.text = wx.TextCtrl(self, self.ID_TEXT_CTRL, size=(80,-1))
197 sizer.Add(self.text, 0, wx.ALIGN_CENTER_VERTICAL | wx.TOP | wx.BOTTOM, 2)
198 self.button = wx.Panel(self, self.ID_BUTTON, wx.DefaultPosition, wx.Size(20, 20))
199 sizer.Add(self.button, 0, wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 5)
d14a1e28
RD
200 self.SetAutoLayout(True)
201 self.SetSizer(sizer)
202 sizer.Fit(self)
203 self.textModified = False
29a41103
RD
204 wx.EVT_PAINT(self.button, self.OnPaintButton)
205 wx.EVT_TEXT(self, self.ID_TEXT_CTRL, self.OnChange)
206 wx.EVT_LEFT_DOWN(self.button, self.OnLeftDown)
d14a1e28
RD
207 def GetValue(self):
208 return self.text.GetValue()
209 def SetValue(self, value):
210 self.freeze = True
211 if not value: value = '#FFFFFF'
212 self.text.SetValue(str(value)) # update text ctrl
99328372 213 try:
29a41103 214 colour = wx.Colour(int(value[1:3], 16), int(value[3:5], 16), int(value[5:7], 16))
99328372
RR
215 self.button.SetBackgroundColour(colour)
216 except: # ignore errors
217 pass
d14a1e28
RD
218 self.button.Refresh()
219 self.freeze = False
220 def OnPaintButton(self, evt):
29a41103
RD
221 dc = wx.PaintDC(self.button)
222 dc.SetBrush(wx.TRANSPARENT_BRUSH)
223 if self.IsEnabled(): dc.SetPen(wx.BLACK_PEN)
224 else: dc.SetPen(wx.GREY_PEN)
d14a1e28 225 size = self.button.GetSize()
b09afc93 226 dc.DrawRectangle(0, 0, size.width, size.height)
d14a1e28 227 def OnLeftDown(self, evt):
29a41103 228 data = wx.ColourData()
d14a1e28 229 data.SetColour(self.GetValue())
29a41103
RD
230 dlg = wx.ColourDialog(self, data)
231 if dlg.ShowModal() == wx.ID_OK:
d14a1e28
RD
232 self.SetValue('#%02X%02X%02X' % dlg.GetColourData().GetColour().Get())
233 self.SetModified()
234 dlg.Destroy()
235
236################################################################################
237
f65bb0f8 238# Mapping from wx constants to XML strings
29a41103
RD
239fontFamiliesWx2Xml = {wx.DEFAULT: 'default', wx.DECORATIVE: 'decorative',
240 wx.ROMAN: 'roman', wx.SCRIPT: 'script', wx.SWISS: 'swiss',
241 wx.MODERN: 'modern'}
242fontStylesWx2Xml = {wx.NORMAL: 'normal', wx.SLANT: 'slant', wx.ITALIC: 'italic'}
243fontWeightsWx2Xml = {wx.NORMAL: 'normal', wx.LIGHT: 'light', wx.BOLD: 'bold'}
d14a1e28
RD
244def ReverseMap(m):
245 rm = {}
246 for k,v in m.items(): rm[v] = k
247 return rm
248fontFamiliesXml2wx = ReverseMap(fontFamiliesWx2Xml)
249fontStylesXml2wx = ReverseMap(fontStylesWx2Xml)
250fontWeightsXml2wx = ReverseMap(fontWeightsWx2Xml)
251
252class ParamFont(PPanel):
253 def __init__(self, parent, name):
254 PPanel.__init__(self, parent, name)
29a41103
RD
255 self.ID_TEXT_CTRL = wx.NewId()
256 self.ID_BUTTON_SELECT = wx.NewId()
257 sizer = wx.BoxSizer()
258 self.text = wx.TextCtrl(self, self.ID_TEXT_CTRL, size=(200,-1))
259 sizer.Add(self.text, 0, wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
260 self.button = wx.Button(self, self.ID_BUTTON_SELECT, 'Select...', size=buttonSize)
261 sizer.Add(self.button, 0, wx.ALIGN_CENTER_VERTICAL)
d14a1e28
RD
262 self.SetAutoLayout(True)
263 self.SetSizer(sizer)
264 sizer.Fit(self)
265 self.textModified = False
29a41103
RD
266 wx.EVT_BUTTON(self, self.ID_BUTTON_SELECT, self.OnButtonSelect)
267 wx.EVT_TEXT(self, self.ID_TEXT_CTRL, self.OnChange)
d14a1e28
RD
268 def OnChange(self, evt):
269 PPanel.OnChange(self, evt)
270 self.textModified = True
271 def _defaultValue(self):
306b6fe9 272 return [`g._sysFont.GetPointSize()`, 'default', 'normal', 'normal', '0', '', '']
d14a1e28
RD
273 def GetValue(self):
274 if self.textModified: # text has newer value
275 try:
276 return eval(self.text.GetValue())
277 except SyntaxError:
29a41103 278 wx.LogError('Syntax error in parameter value: ' + self.GetName())
d14a1e28
RD
279 return self._defaultValue()
280 return self.value
281 def SetValue(self, value):
282 self.freeze = True # disable other handlers
283 if not value: value = self._defaultValue()
284 self.value = value
285 self.text.SetValue(str(value)) # update text ctrl
286 self.freeze = False
287 def OnButtonSelect(self, evt):
288 if self.textModified: # text has newer value
289 try:
290 self.value = eval(self.text.GetValue())
291 except SyntaxError:
29a41103 292 wx.LogError('Syntax error in parameter value: ' + self.GetName())
d14a1e28
RD
293 self.value = self._defaultValue()
294 # Make initial font
295 # Default values
306b6fe9 296 size = g._sysFont.GetPointSize()
29a41103
RD
297 family = wx.DEFAULT
298 style = weight = wx.NORMAL
d14a1e28
RD
299 underlined = 0
300 face = ''
29a41103 301 enc = wx.FONTENCODING_DEFAULT
d14a1e28
RD
302 # Fall back to default if exceptions
303 error = False
304 try:
305 try: size = int(self.value[0])
29a41103 306 except ValueError: error = True; wx.LogError('Invalid size specification')
d14a1e28 307 try: family = fontFamiliesXml2wx[self.value[1]]
29a41103 308 except KeyError: error = True; wx.LogError('Invalid family specification')
d14a1e28 309 try: style = fontStylesXml2wx[self.value[2]]
29a41103 310 except KeyError: error = True; wx.LogError('Invalid style specification')
d14a1e28 311 try: weight = fontWeightsXml2wx[self.value[3]]
29a41103 312 except KeyError: error = True; wx.LogError('Invalid weight specification')
016f67ba 313 try: underlined = bool(self.value[4])
29a41103 314 except ValueError: error = True; wx.LogError('Invalid underlined flag specification')
d14a1e28 315 face = self.value[5]
d14a1e28
RD
316 except IndexError:
317 error = True
29a41103 318 mapper = wx.FontMapper()
016f67ba
RR
319 if not self.value[6]: enc = mapper.CharsetToEncoding(self.value[6])
320
29a41103
RD
321 if error: wx.LogError('Invalid font specification')
322 if enc == wx.FONTENCODING_DEFAULT: enc = wx.FONTENCODING_SYSTEM
323 font = wx.Font(size, family, style, weight, underlined, face, enc)
324 data = wx.FontData()
d14a1e28 325 data.SetInitialFont(font)
29a41103
RD
326 dlg = wx.FontDialog(self, data)
327 if dlg.ShowModal() == wx.ID_OK:
d14a1e28 328 font = dlg.GetFontData().GetChosenFont()
016f67ba 329 print font.GetEncoding()
29a41103 330 if font.GetEncoding() == wx.FONTENCODING_SYSTEM:
016f67ba
RR
331 encName = ''
332 else:
29a41103 333 encName = wx.FontMapper.GetEncodingName(font.GetEncoding()).encode()
d14a1e28
RD
334 value = [str(font.GetPointSize()),
335 fontFamiliesWx2Xml.get(font.GetFamily(), "default"),
336 fontStylesWx2Xml.get(font.GetStyle(), "normal"),
337 fontWeightsWx2Xml.get(font.GetWeight(), "normal"),
0d9b8891 338 str(int(font.GetUnderlined())),
d14a1e28 339 font.GetFaceName().encode(),
016f67ba 340 encName
d14a1e28 341 ]
d14a1e28
RD
342 self.SetValue(value)
343 self.SetModified()
344 self.textModified = False
345 dlg.Destroy()
346
347################################################################################
348
349class ParamInt(PPanel):
350 def __init__(self, parent, name):
351 PPanel.__init__(self, parent, name)
29a41103
RD
352 self.ID_SPIN_CTRL = wx.NewId()
353 sizer = wx.BoxSizer()
354 self.spin = wx.SpinCtrl(self, self.ID_SPIN_CTRL, size=(60,-1))
c032d94e
RR
355 self.spin.SetRange(-2147483648, 2147483647) # min/max integers
356 sizer.Add(self.spin)
357 self.SetAutoLayout(True)
358 self.SetSizer(sizer)
359 sizer.Fit(self)
29a41103 360 wx.EVT_SPINCTRL(self, self.ID_SPIN_CTRL, self.OnChange)
c032d94e
RR
361 def GetValue(self):
362 return str(self.spin.GetValue())
363 def SetValue(self, value):
364 self.freeze = True
365 if not value: value = 0
366 self.spin.SetValue(int(value))
367 self.freeze = False
368
369# Non-negative number
370class ParamIntNN(PPanel):
371 def __init__(self, parent, name):
372 PPanel.__init__(self, parent, name)
29a41103
RD
373 self.ID_SPIN_CTRL = wx.NewId()
374 sizer = wx.BoxSizer()
375 self.spin = wx.SpinCtrl(self, self.ID_SPIN_CTRL, size=(60,-1))
c032d94e 376 self.spin.SetRange(0, 10000) # min/max integers
d14a1e28
RD
377 sizer.Add(self.spin)
378 self.SetAutoLayout(True)
379 self.SetSizer(sizer)
380 sizer.Fit(self)
29a41103 381 wx.EVT_SPINCTRL(self, self.ID_SPIN_CTRL, self.OnChange)
d14a1e28
RD
382 def GetValue(self):
383 return str(self.spin.GetValue())
384 def SetValue(self, value):
385 self.freeze = True
386 if not value: value = 0
387 self.spin.SetValue(int(value))
388 self.freeze = False
389
390# Same as int but allows dialog units (XXXd)
391class ParamUnit(PPanel):
392 def __init__(self, parent, name):
393 PPanel.__init__(self, parent, name)
29a41103
RD
394 self.ID_TEXT_CTRL = wx.NewId()
395 self.ID_SPIN_BUTTON = wx.NewId()
396 sizer = wx.BoxSizer(wx.HORIZONTAL)
397 self.spin = wx.SpinButton(self, self.ID_SPIN_BUTTON, style = wx.SP_VERTICAL, size=(-1,1))
c032d94e 398 textW = 60 - self.spin.GetSize()[0]
29a41103 399 self.text = wx.TextCtrl(self, self.ID_TEXT_CTRL, size=(textW,-1))
d14a1e28 400 self.spin.SetRange(-10000, 10000)
29a41103
RD
401 sizer.Add(self.text, 0, wx.EXPAND)
402 sizer.Add(self.spin, 0, wx.EXPAND)
c032d94e 403 #sizer.SetMinSize((50,-1))
d14a1e28
RD
404 self.SetAutoLayout(True)
405 self.SetSizer(sizer)
406 sizer.Fit(self)
29a41103
RD
407 wx.EVT_SPIN_UP(self, self.ID_SPIN_BUTTON, self.OnSpinUp)
408 wx.EVT_SPIN_DOWN(self, self.ID_SPIN_BUTTON, self.OnSpinDown)
d14a1e28
RD
409 def GetValue(self):
410 return self.text.GetValue()
411 def SetValue(self, value):
412 self.freeze = True
413 if not value: value = '0'
414 self.text.SetValue(value)
415 self.freeze = False
416 def Change(self, x):
417 # Check if we are working with dialog units
418 value = self.text.GetValue()
419 units = ''
420 if value[-1].upper() == 'D':
421 units = value[-1]
422 value = value[:-1]
423 try:
424 intValue = int(value) + x
425 self.spin.SetValue(intValue)
426 self.text.SetValue(str(intValue) + units)
427 self.SetModified()
428 except:
29a41103 429 # !!! Strange, if I use wx.LogWarning, event is re-generated
d14a1e28
RD
430 print 'incorrect unit format'
431 def OnSpinUp(self, evt):
432 self.Change(1)
433 def OnSpinDown(self, evt):
434 self.Change(-1)
435
d14a1e28
RD
436class ParamMultilineText(PPanel):
437 def __init__(self, parent, name, textWidth=-1):
438 PPanel.__init__(self, parent, name)
29a41103
RD
439 self.ID_TEXT_CTRL = wx.NewId()
440 self.ID_BUTTON_EDIT = wx.NewId()
441 sizer = wx.BoxSizer()
442 self.text = wx.TextCtrl(self, self.ID_TEXT_CTRL, size=wx.Size(200,-1))
443 sizer.Add(self.text, 0, wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
444 self.button = wx.Button(self, self.ID_BUTTON_EDIT, 'Edit...', size=buttonSize)
445 sizer.Add(self.button, 0, wx.ALIGN_CENTER_VERTICAL)
d14a1e28
RD
446 self.SetAutoLayout(True)
447 self.SetSizer(sizer)
448 sizer.Fit(self)
29a41103
RD
449 wx.EVT_BUTTON(self, self.ID_BUTTON_EDIT, self.OnButtonEdit)
450 wx.EVT_TEXT(self, self.ID_TEXT_CTRL, self.OnChange)
d14a1e28
RD
451 def GetValue(self):
452 return self.text.GetValue()
453 def SetValue(self, value):
454 self.freeze = True # disable other handlers
455 self.text.SetValue(value)
456 self.freeze = False # disable other handlers
457 def OnButtonEdit(self, evt):
a4c013b2 458 dlg = g.frame.res.LoadDialog(self, 'DIALOG_TEXT')
29a41103 459 textCtrl = xrc.XRCCTRL(dlg, 'TEXT')
a4c013b2 460 textCtrl.SetValue(self.text.GetValue())
29a41103 461 if dlg.ShowModal() == wx.ID_OK:
a4c013b2 462 self.text.SetValue(textCtrl.GetValue())
d14a1e28
RD
463 self.SetModified()
464 dlg.Destroy()
465
466class ParamText(PPanel):
467 def __init__(self, parent, name, textWidth=-1):
468 PPanel.__init__(self, parent, name)
29a41103 469 self.ID_TEXT_CTRL = wx.NewId()
d14a1e28 470 # We use sizer even here to have the same size of text control
29a41103
RD
471 sizer = wx.BoxSizer()
472 self.text = wx.TextCtrl(self, self.ID_TEXT_CTRL, size=wx.Size(textWidth,-1))
d14a1e28
RD
473 if textWidth == -1: option = 1
474 else: option = 0
29a41103 475 sizer.Add(self.text, option, wx.ALIGN_CENTER_VERTICAL | wx.TOP | wx.BOTTOM, 2)
d14a1e28
RD
476 self.SetAutoLayout(True)
477 self.SetSizer(sizer)
478 sizer.Fit(self)
29a41103 479 wx.EVT_TEXT(self, self.ID_TEXT_CTRL, self.OnChange)
d14a1e28
RD
480 def GetValue(self):
481 return self.text.GetValue()
482 def SetValue(self, value):
483 self.freeze = True # disable other handlers
484 self.text.SetValue(value)
485 self.freeze = False # disable other handlers
486
487class ParamAccel(ParamText):
488 def __init__(self, parent, name):
489 ParamText.__init__(self, parent, name, 100)
490
491class ParamPosSize(ParamText):
492 def __init__(self, parent, name):
493 ParamText.__init__(self, parent, name, 80)
494
495class ParamLabel(ParamText):
496 def __init__(self, parent, name):
497 ParamText.__init__(self, parent, name, 200)
498
499class ParamEncoding(ParamText):
500 def __init__(self, parent, name):
501 ParamText.__init__(self, parent, name, 100)
502
29a41103 503class ContentDialog(wx.Dialog):
d14a1e28
RD
504 def __init__(self, parent, value):
505 # Load from resource
29a41103 506 pre = wx.PreDialog()
d14a1e28 507 g.frame.res.LoadOnDialog(pre, parent, 'DIALOG_CONTENT')
29a41103
RD
508 self.PostCreate(pre)
509 self.list = xrc.XRCCTRL(self, 'LIST')
d14a1e28
RD
510 # Set list items
511 for v in value:
512 self.list.Append(v)
513 self.SetAutoLayout(True)
514 self.GetSizer().Fit(self)
515 # Callbacks
29a41103
RD
516 self.ID_BUTTON_APPEND = xrc.XRCID('BUTTON_APPEND')
517 self.ID_BUTTON_REMOVE = xrc.XRCID('BUTTON_REMOVE')
518 self.ID_BUTTON_UP = xrc.XRCID('BUTTON_UP')
519 self.ID_BUTTON_DOWN = xrc.XRCID('BUTTON_DOWN')
520 wx.EVT_BUTTON(self, self.ID_BUTTON_UP, self.OnButtonUp)
521 wx.EVT_BUTTON(self, self.ID_BUTTON_DOWN, self.OnButtonDown)
522 wx.EVT_BUTTON(self, self.ID_BUTTON_APPEND, self.OnButtonAppend)
523 wx.EVT_BUTTON(self, self.ID_BUTTON_REMOVE, self.OnButtonRemove)
524 wx.EVT_UPDATE_UI(self, self.ID_BUTTON_UP, self.OnUpdateUI)
525 wx.EVT_UPDATE_UI(self, self.ID_BUTTON_DOWN, self.OnUpdateUI)
526 wx.EVT_UPDATE_UI(self, self.ID_BUTTON_REMOVE, self.OnUpdateUI)
d14a1e28
RD
527 def OnButtonUp(self, evt):
528 i = self.list.GetSelection()
529 str = self.list.GetString(i)
530 self.list.Delete(i)
531 self.list.InsertItems([str], i-1)
532 self.list.SetSelection(i-1)
533 def OnButtonDown(self, evt):
534 i = self.list.GetSelection()
535 str = self.list.GetString(i)
536 self.list.Delete(i)
537 self.list.InsertItems([str], i+1)
538 self.list.SetSelection(i+1)
539 def OnButtonAppend(self, evt):
29a41103 540 str = wx.GetTextFromUser('Enter new item:', 'Append', '', self)
d14a1e28
RD
541 self.list.Append(str)
542 def OnButtonRemove(self, evt):
543 self.list.Delete(self.list.GetSelection())
544 def OnUpdateUI(self, evt):
545 if evt.GetId() == self.ID_BUTTON_REMOVE:
546 evt.Enable(self.list.GetSelection() != -1)
547 elif evt.GetId() == self.ID_BUTTON_UP:
548 evt.Enable(self.list.GetSelection() > 0)
549 elif evt.GetId() == self.ID_BUTTON_DOWN:
550 evt.Enable(self.list.GetSelection() != -1 and \
31f04352 551 self.list.GetSelection() < self.list.GetCount() - 1)
d14a1e28 552
29a41103 553class ContentCheckListDialog(wx.Dialog):
d14a1e28 554 def __init__(self, parent, value):
29a41103 555 pre = wx.PreDialog()
c032d94e 556 g.frame.res.LoadOnDialog(pre, parent, 'DIALOG_CONTENT_CHECKLIST')
29a41103
RD
557 self.PostCreate(pre)
558 self.list = xrc.XRCCTRL(self, 'CHECKLIST')
d14a1e28
RD
559 # Set list items
560 i = 0
561 for v,ch in value:
562 self.list.Append(v)
563 self.list.Check(i, ch)
564 i += 1
565 self.SetAutoLayout(True)
566 self.GetSizer().Fit(self)
567 # Callbacks
29a41103
RD
568 self.ID_BUTTON_APPEND = xrc.XRCID('BUTTON_APPEND')
569 self.ID_BUTTON_REMOVE = xrc.XRCID('BUTTON_REMOVE')
570 self.ID_BUTTON_UP = xrc.XRCID('BUTTON_UP')
571 self.ID_BUTTON_DOWN = xrc.XRCID('BUTTON_DOWN')
572 wx.EVT_CHECKLISTBOX(self, self.list.GetId(), self.OnCheck)
573 wx.EVT_BUTTON(self, self.ID_BUTTON_UP, self.OnButtonUp)
574 wx.EVT_BUTTON(self, self.ID_BUTTON_DOWN, self.OnButtonDown)
575 wx.EVT_BUTTON(self, self.ID_BUTTON_APPEND, self.OnButtonAppend)
576 wx.EVT_BUTTON(self, self.ID_BUTTON_REMOVE, self.OnButtonRemove)
577 wx.EVT_UPDATE_UI(self, self.ID_BUTTON_UP, self.OnUpdateUI)
578 wx.EVT_UPDATE_UI(self, self.ID_BUTTON_DOWN, self.OnUpdateUI)
579 wx.EVT_UPDATE_UI(self, self.ID_BUTTON_REMOVE, self.OnUpdateUI)
d14a1e28
RD
580 def OnCheck(self, evt):
581 # !!! Wrong wxGTK (wxMSW?) behavior: toggling selection if checking
582 self.list.Deselect(evt.GetSelection())
583 def OnButtonUp(self, evt):
584 i = self.list.GetSelection()
585 str, ch = self.list.GetString(i), self.list.IsChecked(i)
586 self.list.Delete(i)
587 self.list.InsertItems([str], i-1)
588 self.list.Check(i-1, ch)
589 self.list.SetSelection(i-1)
590 def OnButtonDown(self, evt):
591 i = self.list.GetSelection()
592 str, ch = self.list.GetString(i), self.list.IsChecked(i)
593 self.list.Delete(i)
594 self.list.InsertItems([str], i+1)
595 self.list.Check(i+1, ch)
596 self.list.SetSelection(i+1)
597 def OnButtonAppend(self, evt):
29a41103 598 str = wx.GetTextFromUser('Enter new item:', 'Append', '', self)
d14a1e28
RD
599 self.list.Append(str)
600 def OnButtonRemove(self, evt):
601 self.list.Delete(self.list.GetSelection())
602 def OnUpdateUI(self, evt):
603 if evt.GetId() == self.ID_BUTTON_REMOVE:
604 evt.Enable(self.list.GetSelection() != -1)
605 elif evt.GetId() == self.ID_BUTTON_UP:
606 evt.Enable(self.list.GetSelection() > 0)
607 elif evt.GetId() == self.ID_BUTTON_DOWN:
608 evt.Enable(self.list.GetSelection() != -1 and \
31f04352 609 self.list.GetSelection() < self.list.GetCount() - 1)
d14a1e28
RD
610
611class ParamContent(PPanel):
612 def __init__(self, parent, name):
613 PPanel.__init__(self, parent, name)
29a41103
RD
614 self.ID_TEXT_CTRL = wx.NewId()
615 self.ID_BUTTON_EDIT = wx.NewId()
616 sizer = wx.BoxSizer()
617 self.text = wx.TextCtrl(self, self.ID_TEXT_CTRL, size=wx.Size(200,-1))
618 sizer.Add(self.text, 0, wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
619 self.button = wx.Button(self, self.ID_BUTTON_EDIT, 'Edit...', size=buttonSize)
620 sizer.Add(self.button, 0, wx.ALIGN_CENTER_VERTICAL)
d14a1e28
RD
621 self.SetAutoLayout(True)
622 self.SetSizer(sizer)
623 sizer.Fit(self)
624 self.textModified = False
29a41103
RD
625 wx.EVT_BUTTON(self, self.ID_BUTTON_EDIT, self.OnButtonEdit)
626 wx.EVT_TEXT(self, self.ID_TEXT_CTRL, self.OnChange)
d14a1e28
RD
627 def OnChange(self, evt):
628 PPanel.OnChange(self, evt)
629 self.textModified = True
630 def GetValue(self):
631 if self.textModified: # text has newer value
632 try:
e484fddf 633 return self.text.GetValue().split('|')
d14a1e28 634 except SyntaxError:
29a41103 635 wx.LogError('Syntax error in parameter value: ' + self.GetName())
d14a1e28
RD
636 return []
637 return self.value
638 def SetValue(self, value):
639 self.freeze = True
640 if not value: value = []
641 self.value = value
96bfe7fe
RR
642 if value:
643 repr_ = reduce(lambda a,b: '%s|%s' % (a,b), value)
644 else:
645 repr_ = ''
e484fddf 646 self.text.SetValue(repr_) # update text ctrl
d14a1e28
RD
647 self.freeze = False
648 def OnButtonEdit(self, evt):
649 if self.textModified: # text has newer value
e484fddf 650 self.value = self.GetValue()
d14a1e28 651 dlg = ContentDialog(self, self.value)
29a41103 652 if dlg.ShowModal() == wx.ID_OK:
d14a1e28 653 value = []
31f04352 654 for i in range(dlg.list.GetCount()):
d14a1e28 655 value.append(dlg.list.GetString(i))
d14a1e28
RD
656 self.SetValue(value)
657 self.SetModified()
658 self.textModified = False
659 dlg.Destroy()
660
661# CheckList content
662class ParamContentCheckList(ParamContent):
663 def __init__(self, parent, name):
664 ParamContent.__init__(self, parent, name)
665 def OnButtonEdit(self, evt):
666 if self.textModified: # text has newer value
e484fddf 667 self.value = self.GetValue()
d14a1e28 668 dlg = ContentCheckListDialog(self, self.value)
29a41103 669 if dlg.ShowModal() == wx.ID_OK:
d14a1e28 670 value = []
31f04352 671 for i in range(dlg.list.GetCount()):
efa5f709 672 value.append((dlg.list.GetString(i), int(dlg.list.IsChecked(i))))
d14a1e28
RD
673 self.SetValue(value)
674 self.SetModified()
675 self.textModified = False
676 dlg.Destroy()
677
29a41103 678class IntListDialog(wx.Dialog):
d14a1e28 679 def __init__(self, parent, value):
29a41103 680 pre = wx.PreDialog()
d14a1e28 681 g.frame.res.LoadOnDialog(pre, parent, 'DIALOG_INTLIST')
29a41103
RD
682 self.PostCreate(pre)
683 self.list = xrc.XRCCTRL(self, 'LIST')
d14a1e28
RD
684 # Set list items
685 value.sort()
686 for v in value:
687 if type(v) != IntType:
29a41103 688 wx.LogError('Invalid item type')
d14a1e28
RD
689 else:
690 self.list.Append(str(v))
691 self.SetAutoLayout(True)
692 self.GetSizer().Fit(self)
693 # Callbacks
29a41103
RD
694 self.spinCtrl = xrc.XRCCTRL(self, 'SPIN')
695 wx.EVT_BUTTON(self, xrc.XRCID('BUTTON_ADD'), self.OnButtonAdd)
696 self.ID_BUTTON_REMOVE = xrc.XRCID('BUTTON_REMOVE')
697 wx.EVT_BUTTON(self, self.ID_BUTTON_REMOVE, self.OnButtonRemove)
698 wx.EVT_BUTTON(self, xrc.XRCID('BUTTON_CLEAR'), self.OnButtonClear)
699 wx.EVT_UPDATE_UI(self, self.ID_BUTTON_REMOVE, self.OnUpdateUI)
c032d94e 700 def OnButtonAdd(self, evt):
d14a1e28
RD
701 # Check that it's unique
702 try:
c032d94e 703 v = self.spinCtrl.GetValue()
d14a1e28
RD
704 s = str(v) # to be sure
705 i = self.list.FindString(s)
706 if i == -1: # ignore non-unique
707 # Find place to insert
708 found = False
31f04352 709 for i in range(self.list.GetCount()):
d14a1e28
RD
710 if int(self.list.GetString(i)) > v:
711 found = True
712 break
713 if found: self.list.InsertItems([s], i)
714 else: self.list.Append(s)
715 except ValueError:
29a41103 716 wx.LogError('List item is not an int!')
d14a1e28
RD
717 def OnButtonRemove(self, evt):
718 self.list.Delete(self.list.GetSelection())
c032d94e
RR
719 def OnButtonClear(self, evt):
720 self.list.Clear()
d14a1e28
RD
721 def OnUpdateUI(self, evt):
722 if evt.GetId() == self.ID_BUTTON_REMOVE:
723 evt.Enable(self.list.GetSelection() != -1)
724
725# For growable list
726class ParamIntList(ParamContent):
727 def __init__(self, parent, name):
728 ParamContent.__init__(self, parent, name)
729 def OnButtonEdit(self, evt):
730 if self.textModified: # text has newer value
731 try:
732 self.value = eval(self.text.GetValue())
733 except SyntaxError:
29a41103 734 wx.LogError('Syntax error in parameter value: ' + self.GetName())
d14a1e28
RD
735 self.value = []
736 dlg = IntListDialog(self, self.value)
29a41103 737 if dlg.ShowModal() == wx.ID_OK:
d14a1e28 738 value = []
31f04352 739 for i in range(dlg.list.GetCount()):
d14a1e28 740 value.append(int(dlg.list.GetString(i)))
d14a1e28
RD
741 self.SetValue(value)
742 self.SetModified()
743 self.textModified = False
744 dlg.Destroy()
745
746# Boxless radiobox
747class RadioBox(PPanel):
748 def __init__(self, parent, id, choices,
29a41103 749 pos=wx.DefaultPosition, name='radiobox'):
d14a1e28 750 PPanel.__init__(self, parent, name)
d14a1e28 751 self.choices = choices
29a41103 752 topSizer = wx.BoxSizer()
d14a1e28 753 for i in choices:
29a41103
RD
754 button = wx.RadioButton(self, -1, i, size=(-1,buttonSize[1]), name=i)
755 topSizer.Add(button, 0, wx.RIGHT, 5)
756 wx.EVT_RADIOBUTTON(self, button.GetId(), self.OnRadioChoice)
d14a1e28
RD
757 self.SetAutoLayout(True)
758 self.SetSizer(topSizer)
759 topSizer.Fit(self)
760 def SetStringSelection(self, value):
761 self.freeze = True
762 for i in self.choices:
763 self.FindWindowByName(i).SetValue(i == value)
764 self.value = value
765 self.freeze = False
766 def OnRadioChoice(self, evt):
767 if self.freeze: return
768 if evt.GetSelection():
769 self.value = evt.GetEventObject().GetName()
770 self.SetModified()
771 def GetStringSelection(self):
772 return self.value
773
774class ParamBool(RadioBox):
775 values = {'yes': '1', 'no': '0'}
776 seulav = {'1': 'yes', '0': 'no'}
777 def __init__(self, parent, name):
a4c013b2 778 RadioBox.__init__(self, parent, -1, choices=self.values.keys(), name=name)
d14a1e28
RD
779 def GetValue(self):
780 return self.values[self.GetStringSelection()]
781 def SetValue(self, value):
782 if not value: value = '1'
783 self.SetStringSelection(self.seulav[value])
784
785class ParamOrient(RadioBox):
786 values = {'horizontal': 'wxHORIZONTAL', 'vertical': 'wxVERTICAL'}
787 seulav = {'wxHORIZONTAL': 'horizontal', 'wxVERTICAL': 'vertical'}
788 def __init__(self, parent, name):
a4c013b2 789 RadioBox.__init__(self, parent, -1, choices=self.values.keys(), name=name)
d14a1e28
RD
790 def GetValue(self):
791 return self.values[self.GetStringSelection()]
792 def SetValue(self, value):
793 if not value: value = 'wxHORIZONTAL'
794 self.SetStringSelection(self.seulav[value])
795
68ae5821
RD
796class ParamOrientation(RadioBox):
797 values = {'horizontal': 'horizontal', 'vertical': 'vertical'}
798 seulav = {'horizontal': 'horizontal', 'vertical': 'vertical'}
799 def __init__(self, parent, name):
800 RadioBox.__init__(self, parent, -1, choices=self.values.keys(), name=name)
801 def GetValue(self):
802 return self.values[self.GetStringSelection()]
803 def SetValue(self, value):
804 if not value: value = 'vertical'
805 self.SetStringSelection(self.seulav[value])
806
d14a1e28
RD
807class ParamFile(PPanel):
808 def __init__(self, parent, name):
809 PPanel.__init__(self, parent, name)
29a41103
RD
810 self.ID_TEXT_CTRL = wx.NewId()
811 self.ID_BUTTON_BROWSE = wx.NewId()
812 sizer = wx.BoxSizer()
813 self.text = wx.TextCtrl(self, self.ID_TEXT_CTRL, size=wx.Size(200,-1))
814 sizer.Add(self.text, 0, wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
815 self.button = wx.Button(self, self.ID_BUTTON_BROWSE, 'Browse...',size=buttonSize)
816 sizer.Add(self.button, 0, wx.ALIGN_CENTER_VERTICAL)
d14a1e28
RD
817 self.SetAutoLayout(True)
818 self.SetSizer(sizer)
819 sizer.Fit(self)
820 self.textModified = False
29a41103
RD
821 wx.EVT_BUTTON(self, self.ID_BUTTON_BROWSE, self.OnButtonBrowse)
822 wx.EVT_TEXT(self, self.ID_TEXT_CTRL, self.OnChange)
d14a1e28
RD
823 def OnChange(self, evt):
824 PPanel.OnChange(self, evt)
825 self.textModified = True
826 def GetValue(self):
827 if self.textModified: # text has newer value
828 return self.text.GetValue()
829 return self.value
830 def SetValue(self, value):
831 self.freeze = True
832 self.value = value
833 self.text.SetValue(value) # update text ctrl
834 self.freeze = False
835 def OnButtonBrowse(self, evt):
836 if self.textModified: # text has newer value
837 self.value = self.text.GetValue()
29a41103 838 dlg = wx.FileDialog(self,
d14a1e28
RD
839 defaultDir = os.path.abspath(os.path.dirname(self.value)),
840 defaultFile = os.path.basename(self.value))
29a41103 841 if dlg.ShowModal() == wx.ID_OK:
d14a1e28
RD
842 # Get common part of selected path and current
843 if g.frame.dataFile:
844 curpath = os.path.abspath(g.frame.dataFile)
845 else:
846 curpath = os.path.join(os.getcwd(), '')
847 common = os.path.commonprefix([curpath, dlg.GetPath()])
848 self.SetValue(dlg.GetPath()[len(common):])
849 self.SetModified()
850 self.textModified = False
851 dlg.Destroy()
852
853class ParamBitmap(PPanel):
854 def __init__(self, parent, name):
29a41103 855 pre = wx.PrePanel()
d14a1e28 856 g.frame.res.LoadOnPanel(pre, parent, 'PANEL_BITMAP')
29a41103 857 self.PostCreate(pre)
d14a1e28 858 self.modified = self.freeze = False
29a41103
RD
859 self.radio_std = xrc.XRCCTRL(self, 'RADIO_STD')
860 self.radio_file = xrc.XRCCTRL(self, 'RADIO_FILE')
861 self.combo = xrc.XRCCTRL(self, 'COMBO_STD')
862 self.text = xrc.XRCCTRL(self, 'TEXT_FILE')
863 self.button = xrc.XRCCTRL(self, 'BUTTON_BROWSE')
d14a1e28
RD
864 self.textModified = False
865 self.SetAutoLayout(True)
866 self.GetSizer().SetMinSize((260, -1))
867 self.GetSizer().Fit(self)
29a41103
RD
868 wx.EVT_RADIOBUTTON(self, xrc.XRCID('RADIO_STD'), self.OnRadioStd)
869 wx.EVT_RADIOBUTTON(self, xrc.XRCID('RADIO_FILE'), self.OnRadioFile)
870 wx.EVT_BUTTON(self, xrc.XRCID('BUTTON_BROWSE'), self.OnButtonBrowse)
871 wx.EVT_COMBOBOX(self, xrc.XRCID('COMBO_STD'), self.OnCombo)
872 wx.EVT_TEXT(self, xrc.XRCID('COMBO_STD'), self.OnChange)
873 wx.EVT_TEXT(self, xrc.XRCID('TEXT_FILE'), self.OnChange)
d14a1e28
RD
874 def OnRadioStd(self, evt):
875 self.SetModified()
876 self.SetValue(['wxART_MISSING_IMAGE',''])
877 def OnRadioFile(self, evt):
878 self.SetModified()
879 self.SetValue(['',''])
880 def updateRadios(self):
881 if self.value[0]:
882 self.radio_std.SetValue(True)
883 self.radio_file.SetValue(False)
884 self.text.Enable(False)
885 self.button.Enable(False)
886 self.combo.Enable(True)
887 else:
888 self.radio_std.SetValue(False)
889 self.radio_file.SetValue(True)
890 self.text.Enable(True)
891 self.button.Enable(True)
892 self.combo.Enable(False)
893 def OnChange(self, evt):
894 PPanel.OnChange(self, evt)
895 self.textModified = True
896 def OnCombo(self, evt):
897 PPanel.OnChange(self, evt)
898 self.value[0] = self.combo.GetValue()
899 def GetValue(self):
900 if self.textModified: # text has newer value
901 return [self.combo.GetValue(), self.text.GetValue()]
902 return self.value
903 def SetValue(self, value):
904 self.freeze = True
905 if not value:
906 self.value = ['', '']
907 else:
908 self.value = value
909 self.combo.SetValue(self.value[0])
910 self.text.SetValue(self.value[1]) # update text ctrl
911 self.updateRadios()
912 self.freeze = False
913 def OnButtonBrowse(self, evt):
914 if self.textModified: # text has newer value
915 self.value[1] = self.text.GetValue()
29a41103 916 dlg = wx.FileDialog(self,
d14a1e28
RD
917 defaultDir = os.path.abspath(os.path.dirname(self.value[1])),
918 defaultFile = os.path.basename(self.value[1]))
29a41103 919 if dlg.ShowModal() == wx.ID_OK:
d14a1e28
RD
920 # Get common part of selected path and current
921 if g.frame.dataFile:
922 curpath = os.path.abspath(g.frame.dataFile)
923 else:
924 curpath = os.path.join(os.getcwd(), '')
925 common = os.path.commonprefix([curpath, dlg.GetPath()])
926 self.SetValue(['', dlg.GetPath()[len(common):]])
927 self.SetModified()
928 self.textModified = False
929 dlg.Destroy()
930
931paramDict = {
932 'flag': ParamFlag,
933 'style': ParamStyle, 'exstyle': ParamExStyle,
934 'pos': ParamPosSize, 'size': ParamPosSize,
80389ff7 935 'cellpos': ParamPosSize, 'cellspan': ParamPosSize,
c032d94e 936 'border': ParamUnit, 'cols': ParamIntNN, 'rows': ParamIntNN,
d14a1e28
RD
937 'vgap': ParamUnit, 'hgap': ParamUnit,
938 'checkable': ParamBool, 'checked': ParamBool, 'radio': ParamBool,
939 'accel': ParamAccel,
940 'label': ParamMultilineText, 'title': ParamText, 'value': ParamText,
c032d94e 941 'content': ParamContent, 'selection': ParamIntNN,
d14a1e28
RD
942 'min': ParamInt, 'max': ParamInt,
943 'fg': ParamColour, 'bg': ParamColour, 'font': ParamFont,
944 'enabled': ParamBool, 'focused': ParamBool, 'hidden': ParamBool,
945 'tooltip': ParamText, 'bitmap': ParamBitmap, 'icon': ParamBitmap,
306b6fe9 946 'encoding': ParamEncoding, 'borders': ParamUnit
d14a1e28 947 }