OptionContainer < FlatPanel
  height: 22
  padding: 3

OptionCheckBox < OptionContainer
  @onTextChange: addEvent(function() self.checkBox:setText(self:getText()) self:setText("", true) end)
  @onCheckChange: addEvent(function() if self:isChecked() ~= self.checkBox:isChecked() then self.checkBox:setChecked(self:isChecked()) end end)
  
  CheckBox
    id: checkBox
    anchors.left: parent.left
    anchors.verticalCenter: parent.verticalCenter
    text-horizontal-auto-resize: true
    color: #c0c0c0
    @onCheckChange: self:getParent():setChecked(self:isChecked()) modules.client_options.presetOption(self, self:getParent():getId(), self:isChecked())

OptionSimpleCheckBox < CheckBox
  text-horizontal-auto-resize: true
  font: verdana-11px-monochrome
  color: #c0c0c0
  @onCheckChange: modules.client_options.presetOption(self, self:getId(), self:isChecked())

OptionScrollbar < HorizontalScrollBar
  step: 1
  @onValueChange: modules.client_options.presetOption(self, self:getId(), self:getValue())

OptionPanel < Panel
  layout:
    type: verticalBox
    spacing: 5

MainWindow
  id: optionsWindow
  !text: tr('Options')
  size: 685 530
  $mobile:
    size: 685 530

  @onEnter: modules.client_options.hide()
  @onEscape: modules.client_options.hide()

  OptionsTabBarVertical
    id: optionsTabBar
    anchors.top: parent.top
    anchors.left: parent.left
    height: 440

  OptionsTabContent
  
  HorizontalSeparator
    id: separator
    anchors.top: optionsTabContent.bottom
    anchors.left: parent.left
    anchors.right: parent.right
    margin-top: 12

  SmallButton
    !text: tr('Cancel')
    anchors.top: separator.bottom
    anchors.right: parent.right
    width: 45
    margin-top: 12
    @onClick: modules.client_options.cancelButton()

  SmallButton
    !text: tr('Apply')
    anchors.top: separator.bottom
    anchors.right: prev.left
    width: 45
    margin-top: 12
    margin-right: 5
    @onClick: modules.client_options.applyButton()

  SmallButton
    !text: tr('Ok')
    anchors.top: separator.bottom
    anchors.right: prev.left
    width: 45
    margin-top: 12
    margin-right: 5
    @onClick: modules.client_options.okButton()
