]> git.saurik.com Git - wxWidgets.git/blame - wxPython/wx/tools/XRCed/params.py
Build fix for motif.
[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
e484fddf
RR
642 repr_ = reduce(lambda a,b: '%s|%s' % (a,b), value)
643 self.text.SetValue(repr_) # update text ctrl
d14a1e28
RD
644 self.freeze = False
645 def OnButtonEdit(self, evt):
646 if self.textModified: # text has newer value
e484fddf 647 self.value = self.GetValue()
d14a1e28 648 dlg = ContentDialog(self, self.value)
29a41103 649 if dlg.ShowModal() == wx.ID_OK:
d14a1e28 650 value = []
31f04352 651 for i in range(dlg.list.GetCount()):
d14a1e28 652 value.append(dlg.list.GetString(i))
d14a1e28
RD
653 self.SetValue(value)
654 self.SetModified()
655 self.textModified = False
656 dlg.Destroy()
657
658# CheckList content
659class ParamContentCheckList(ParamContent):
660 def __init__(self, parent, name):
661 ParamContent.__init__(self, parent, name)
662 def OnButtonEdit(self, evt):
663 if self.textModified: # text has newer value
e484fddf 664 self.value = self.GetValue()
d14a1e28 665 dlg = ContentCheckListDialog(self, self.value)
29a41103 666 if dlg.ShowModal() == wx.ID_OK:
d14a1e28 667 value = []
31f04352 668 for i in range(dlg.list.GetCount()):
efa5f709 669 value.append((dlg.list.GetString(i), int(dlg.list.IsChecked(i))))
d14a1e28
RD
670 self.SetValue(value)
671 self.SetModified()
672 self.textModified = False
673 dlg.Destroy()
674
29a41103 675class IntListDialog(wx.Dialog):
d14a1e28 676 def __init__(self, parent, value):
29a41103 677 pre = wx.PreDialog()
d14a1e28 678 g.frame.res.LoadOnDialog(pre, parent, 'DIALOG_INTLIST')
29a41103
RD
679 self.PostCreate(pre)
680 self.list = xrc.XRCCTRL(self, 'LIST')
d14a1e28
RD
681 # Set list items
682 value.sort()
683 for v in value:
684 if type(v) != IntType:
29a41103 685 wx.LogError('Invalid item type')
d14a1e28
RD
686 else:
687 self.list.Append(str(v))
688 self.SetAutoLayout(True)
689 self.GetSizer().Fit(self)
690 # Callbacks
29a41103
RD
691 self.spinCtrl = xrc.XRCCTRL(self, 'SPIN')
692 wx.EVT_BUTTON(self, xrc.XRCID('BUTTON_ADD'), self.OnButtonAdd)
693 self.ID_BUTTON_REMOVE = xrc.XRCID('BUTTON_REMOVE')
694 wx.EVT_BUTTON(self, self.ID_BUTTON_REMOVE, self.OnButtonRemove)
695 wx.EVT_BUTTON(self, xrc.XRCID('BUTTON_CLEAR'), self.OnButtonClear)
696 wx.EVT_UPDATE_UI(self, self.ID_BUTTON_REMOVE, self.OnUpdateUI)
c032d94e 697 def OnButtonAdd(self, evt):
d14a1e28
RD
698 # Check that it's unique
699 try:
c032d94e 700 v = self.spinCtrl.GetValue()
d14a1e28
RD
701 s = str(v) # to be sure
702 i = self.list.FindString(s)
703 if i == -1: # ignore non-unique
704 # Find place to insert
705 found = False
31f04352 706 for i in range(self.list.GetCount()):
d14a1e28
RD
707 if int(self.list.GetString(i)) > v:
708 found = True
709 break
710 if found: self.list.InsertItems([s], i)
711 else: self.list.Append(s)
712 except ValueError:
29a41103 713 wx.LogError('List item is not an int!')
d14a1e28
RD
714 def OnButtonRemove(self, evt):
715 self.list.Delete(self.list.GetSelection())
c032d94e
RR
716 def OnButtonClear(self, evt):
717 self.list.Clear()
d14a1e28
RD
718 def OnUpdateUI(self, evt):
719 if evt.GetId() == self.ID_BUTTON_REMOVE:
720 evt.Enable(self.list.GetSelection() != -1)
721
722# For growable list
723class ParamIntList(ParamContent):
724 def __init__(self, parent, name):
725 ParamContent.__init__(self, parent, name)
726 def OnButtonEdit(self, evt):
727 if self.textModified: # text has newer value
728 try:
729 self.value = eval(self.text.GetValue())
730 except SyntaxError:
29a41103 731 wx.LogError('Syntax error in parameter value: ' + self.GetName())
d14a1e28
RD
732 self.value = []
733 dlg = IntListDialog(self, self.value)
29a41103 734 if dlg.ShowModal() == wx.ID_OK:
d14a1e28 735 value = []
31f04352 736 for i in range(dlg.list.GetCount()):
d14a1e28 737 value.append(int(dlg.list.GetString(i)))
d14a1e28
RD
738 self.SetValue(value)
739 self.SetModified()
740 self.textModified = False
741 dlg.Destroy()
742
743# Boxless radiobox
744class RadioBox(PPanel):
745 def __init__(self, parent, id, choices,
29a41103 746 pos=wx.DefaultPosition, name='radiobox'):
d14a1e28 747 PPanel.__init__(self, parent, name)
d14a1e28 748 self.choices = choices
29a41103 749 topSizer = wx.BoxSizer()
d14a1e28 750 for i in choices:
29a41103
RD
751 button = wx.RadioButton(self, -1, i, size=(-1,buttonSize[1]), name=i)
752 topSizer.Add(button, 0, wx.RIGHT, 5)
753 wx.EVT_RADIOBUTTON(self, button.GetId(), self.OnRadioChoice)
d14a1e28
RD
754 self.SetAutoLayout(True)
755 self.SetSizer(topSizer)
756 topSizer.Fit(self)
757 def SetStringSelection(self, value):
758 self.freeze = True
759 for i in self.choices:
760 self.FindWindowByName(i).SetValue(i == value)
761 self.value = value
762 self.freeze = False
763 def OnRadioChoice(self, evt):
764 if self.freeze: return
765 if evt.GetSelection():
766 self.value = evt.GetEventObject().GetName()
767 self.SetModified()
768 def GetStringSelection(self):
769 return self.value
770
771class ParamBool(RadioBox):
772 values = {'yes': '1', 'no': '0'}
773 seulav = {'1': 'yes', '0': 'no'}
774 def __init__(self, parent, name):
a4c013b2 775 RadioBox.__init__(self, parent, -1, choices=self.values.keys(), name=name)
d14a1e28
RD
776 def GetValue(self):
777 return self.values[self.GetStringSelection()]
778 def SetValue(self, value):
779 if not value: value = '1'
780 self.SetStringSelection(self.seulav[value])
781
782class ParamOrient(RadioBox):
783 values = {'horizontal': 'wxHORIZONTAL', 'vertical': 'wxVERTICAL'}
784 seulav = {'wxHORIZONTAL': 'horizontal', 'wxVERTICAL': 'vertical'}
785 def __init__(self, parent, name):
a4c013b2 786 RadioBox.__init__(self, parent, -1, choices=self.values.keys(), name=name)
d14a1e28
RD
787 def GetValue(self):
788 return self.values[self.GetStringSelection()]
789 def SetValue(self, value):
790 if not value: value = 'wxHORIZONTAL'
791 self.SetStringSelection(self.seulav[value])
792
68ae5821
RD
793class ParamOrientation(RadioBox):
794 values = {'horizontal': 'horizontal', 'vertical': 'vertical'}
795 seulav = {'horizontal': 'horizontal', 'vertical': 'vertical'}
796 def __init__(self, parent, name):
797 RadioBox.__init__(self, parent, -1, choices=self.values.keys(), name=name)
798 def GetValue(self):
799 return self.values[self.GetStringSelection()]
800 def SetValue(self, value):
801 if not value: value = 'vertical'
802 self.SetStringSelection(self.seulav[value])
803
d14a1e28
RD
804class ParamFile(PPanel):
805 def __init__(self, parent, name):
806 PPanel.__init__(self, parent, name)
29a41103
RD
807 self.ID_TEXT_CTRL = wx.NewId()
808 self.ID_BUTTON_BROWSE = wx.NewId()
809 sizer = wx.BoxSizer()
810 self.text = wx.TextCtrl(self, self.ID_TEXT_CTRL, size=wx.Size(200,-1))
811 sizer.Add(self.text, 0, wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
812 self.button = wx.Button(self, self.ID_BUTTON_BROWSE, 'Browse...',size=buttonSize)
813 sizer.Add(self.button, 0, wx.ALIGN_CENTER_VERTICAL)
d14a1e28
RD
814 self.SetAutoLayout(True)
815 self.SetSizer(sizer)
816 sizer.Fit(self)
817 self.textModified = False
29a41103
RD
818 wx.EVT_BUTTON(self, self.ID_BUTTON_BROWSE, self.OnButtonBrowse)
819 wx.EVT_TEXT(self, self.ID_TEXT_CTRL, self.OnChange)
d14a1e28
RD
820 def OnChange(self, evt):
821 PPanel.OnChange(self, evt)
822 self.textModified = True
823 def GetValue(self):
824 if self.textModified: # text has newer value
825 return self.text.GetValue()
826 return self.value
827 def SetValue(self, value):
828 self.freeze = True
829 self.value = value
830 self.text.SetValue(value) # update text ctrl
831 self.freeze = False
832 def OnButtonBrowse(self, evt):
833 if self.textModified: # text has newer value
834 self.value = self.text.GetValue()
29a41103 835 dlg = wx.FileDialog(self,
d14a1e28
RD
836 defaultDir = os.path.abspath(os.path.dirname(self.value)),
837 defaultFile = os.path.basename(self.value))
29a41103 838 if dlg.ShowModal() == wx.ID_OK:
d14a1e28
RD
839 # Get common part of selected path and current
840 if g.frame.dataFile:
841 curpath = os.path.abspath(g.frame.dataFile)
842 else:
843 curpath = os.path.join(os.getcwd(), '')
844 common = os.path.commonprefix([curpath, dlg.GetPath()])
845 self.SetValue(dlg.GetPath()[len(common):])
846 self.SetModified()
847 self.textModified = False
848 dlg.Destroy()
849
850class ParamBitmap(PPanel):
851 def __init__(self, parent, name):
29a41103 852 pre = wx.PrePanel()
d14a1e28 853 g.frame.res.LoadOnPanel(pre, parent, 'PANEL_BITMAP')
29a41103 854 self.PostCreate(pre)
d14a1e28 855 self.modified = self.freeze = False
29a41103
RD
856 self.radio_std = xrc.XRCCTRL(self, 'RADIO_STD')
857 self.radio_file = xrc.XRCCTRL(self, 'RADIO_FILE')
858 self.combo = xrc.XRCCTRL(self, 'COMBO_STD')
859 self.text = xrc.XRCCTRL(self, 'TEXT_FILE')
860 self.button = xrc.XRCCTRL(self, 'BUTTON_BROWSE')
d14a1e28
RD
861 self.textModified = False
862 self.SetAutoLayout(True)
863 self.GetSizer().SetMinSize((260, -1))
864 self.GetSizer().Fit(self)
29a41103
RD
865 wx.EVT_RADIOBUTTON(self, xrc.XRCID('RADIO_STD'), self.OnRadioStd)
866 wx.EVT_RADIOBUTTON(self, xrc.XRCID('RADIO_FILE'), self.OnRadioFile)
867 wx.EVT_BUTTON(self, xrc.XRCID('BUTTON_BROWSE'), self.OnButtonBrowse)
868 wx.EVT_COMBOBOX(self, xrc.XRCID('COMBO_STD'), self.OnCombo)
869 wx.EVT_TEXT(self, xrc.XRCID('COMBO_STD'), self.OnChange)
870 wx.EVT_TEXT(self, xrc.XRCID('TEXT_FILE'), self.OnChange)
d14a1e28
RD
871 def OnRadioStd(self, evt):
872 self.SetModified()
873 self.SetValue(['wxART_MISSING_IMAGE',''])
874 def OnRadioFile(self, evt):
875 self.SetModified()
876 self.SetValue(['',''])
877 def updateRadios(self):
878 if self.value[0]:
879 self.radio_std.SetValue(True)
880 self.radio_file.SetValue(False)
881 self.text.Enable(False)
882 self.button.Enable(False)
883 self.combo.Enable(True)
884 else:
885 self.radio_std.SetValue(False)
886 self.radio_file.SetValue(True)
887 self.text.Enable(True)
888 self.button.Enable(True)
889 self.combo.Enable(False)
890 def OnChange(self, evt):
891 PPanel.OnChange(self, evt)
892 self.textModified = True
893 def OnCombo(self, evt):
894 PPanel.OnChange(self, evt)
895 self.value[0] = self.combo.GetValue()
896 def GetValue(self):
897 if self.textModified: # text has newer value
898 return [self.combo.GetValue(), self.text.GetValue()]
899 return self.value
900 def SetValue(self, value):
901 self.freeze = True
902 if not value:
903 self.value = ['', '']
904 else:
905 self.value = value
906 self.combo.SetValue(self.value[0])
907 self.text.SetValue(self.value[1]) # update text ctrl
908 self.updateRadios()
909 self.freeze = False
910 def OnButtonBrowse(self, evt):
911 if self.textModified: # text has newer value
912 self.value[1] = self.text.GetValue()
29a41103 913 dlg = wx.FileDialog(self,
d14a1e28
RD
914 defaultDir = os.path.abspath(os.path.dirname(self.value[1])),
915 defaultFile = os.path.basename(self.value[1]))
29a41103 916 if dlg.ShowModal() == wx.ID_OK:
d14a1e28
RD
917 # Get common part of selected path and current
918 if g.frame.dataFile:
919 curpath = os.path.abspath(g.frame.dataFile)
920 else:
921 curpath = os.path.join(os.getcwd(), '')
922 common = os.path.commonprefix([curpath, dlg.GetPath()])
923 self.SetValue(['', dlg.GetPath()[len(common):]])
924 self.SetModified()
925 self.textModified = False
926 dlg.Destroy()
927
928paramDict = {
929 'flag': ParamFlag,
930 'style': ParamStyle, 'exstyle': ParamExStyle,
931 'pos': ParamPosSize, 'size': ParamPosSize,
80389ff7 932 'cellpos': ParamPosSize, 'cellspan': ParamPosSize,
c032d94e 933 'border': ParamUnit, 'cols': ParamIntNN, 'rows': ParamIntNN,
d14a1e28
RD
934 'vgap': ParamUnit, 'hgap': ParamUnit,
935 'checkable': ParamBool, 'checked': ParamBool, 'radio': ParamBool,
936 'accel': ParamAccel,
937 'label': ParamMultilineText, 'title': ParamText, 'value': ParamText,
c032d94e 938 'content': ParamContent, 'selection': ParamIntNN,
d14a1e28
RD
939 'min': ParamInt, 'max': ParamInt,
940 'fg': ParamColour, 'bg': ParamColour, 'font': ParamFont,
941 'enabled': ParamBool, 'focused': ParamBool, 'hidden': ParamBool,
942 'tooltip': ParamText, 'bitmap': ParamBitmap, 'icon': ParamBitmap,
306b6fe9 943 'encoding': ParamEncoding, 'borders': ParamUnit
d14a1e28 944 }