|
|
@ -1416,7 +1416,8 @@ function CycleHotkeyLabel:init()
|
|
|
|
{key=self.key, key_sep=': ', text=self.label, width=self.label_width,
|
|
|
|
{key=self.key, key_sep=': ', text=self.label, width=self.label_width,
|
|
|
|
on_activate=self:callback('cycle')},
|
|
|
|
on_activate=self:callback('cycle')},
|
|
|
|
' ',
|
|
|
|
' ',
|
|
|
|
{text=self:callback('getOptionLabel')},
|
|
|
|
{text=self:callback('getOptionLabel'),
|
|
|
|
|
|
|
|
pen=self:callback('getOptionPen')},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
@ -1433,22 +1434,25 @@ function CycleHotkeyLabel:cycle()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function CycleHotkeyLabel:getOptionLabel(option_idx)
|
|
|
|
local function cyclehotkeylabel_getOptionElem(self, option_idx, key)
|
|
|
|
option_idx = option_idx or self.option_idx
|
|
|
|
option_idx = option_idx or self.option_idx
|
|
|
|
local option = self.options[option_idx]
|
|
|
|
local option = self.options[option_idx]
|
|
|
|
if type(option) == 'table' then
|
|
|
|
if type(option) == 'table' then
|
|
|
|
return option.label
|
|
|
|
return option[key]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return option
|
|
|
|
return option
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function CycleHotkeyLabel:getOptionLabel(option_idx)
|
|
|
|
|
|
|
|
return cyclehotkeylabel_getOptionElem(self, option_idx, 'label')
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function CycleHotkeyLabel:getOptionValue(option_idx)
|
|
|
|
function CycleHotkeyLabel:getOptionValue(option_idx)
|
|
|
|
option_idx = option_idx or self.option_idx
|
|
|
|
return cyclehotkeylabel_getOptionElem(self, option_idx, 'value')
|
|
|
|
local option = self.options[option_idx]
|
|
|
|
|
|
|
|
if type(option) == 'table' then
|
|
|
|
|
|
|
|
return option.value
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return option
|
|
|
|
|
|
|
|
|
|
|
|
function CycleHotkeyLabel:getOptionPen(option_idx)
|
|
|
|
|
|
|
|
return cyclehotkeylabel_getOptionElem(self, option_idx, 'pen')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function CycleHotkeyLabel:onInput(keys)
|
|
|
|
function CycleHotkeyLabel:onInput(keys)
|
|
|
@ -1466,7 +1470,7 @@ end
|
|
|
|
|
|
|
|
|
|
|
|
ToggleHotkeyLabel = defclass(ToggleHotkeyLabel, CycleHotkeyLabel)
|
|
|
|
ToggleHotkeyLabel = defclass(ToggleHotkeyLabel, CycleHotkeyLabel)
|
|
|
|
ToggleHotkeyLabel.ATTRS{
|
|
|
|
ToggleHotkeyLabel.ATTRS{
|
|
|
|
options={{label='On', value=true},
|
|
|
|
options={{label='On', value=true, pen=COLOR_GREEN},
|
|
|
|
{label='Off', value=false}},
|
|
|
|
{label='Off', value=false}},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|