GameSidePanel < UIMiniWindowContainer
  image-source: /images/ui/2pixel_up_frame_borderimage
  image-border: 4
  width: 176
  layout:
    type: verticalBox
    //spacing: 1

SelectColumnButton < CheckBox
  visible: false
  opacity: 0.3
  $hover:
    opacity: 1

GameBottomPanel < UIWindow
  image-source: /images/ui/background_dark
  image-repeated: true
  draggable:false

  ResizeBorder
    id: bottomResizeBorder
    anchors.bottom: parent.bottom
    anchors.left: parent.left
    anchors.right: parent.right
    enabled: false
    height: 5
    margin-top: 5
    minimum: 170

  ResizeBorder
    id: rightResizeBorder
    anchors.right: parent.right
    anchors.top: parent.top
    anchors.bottom: parent.bottom
    enabled: false
    minimum: 300


GameMapPanel < UIGameMap
  padding: 4
  image-source: /images/ui/panel_map
  image-border: 4

  $on:
    padding: 0

UIWidget
  id: gameRootPanel
  anchors.fill: parent
  anchors.top: topMenu.bottom

  GameMapPanel
    id: gameMapPanel
    anchors.left: gameLeftActionPanel.right
    anchors.right: gameRightActionPanel.left
    anchors.top: gameTopPanel.bottom
    anchors.bottom: bottomSplitter.top
    focusable: false
    margin-top: 1
    margin-bottom: 1

    Button
      id: showTopMenuButton
      anchors.top: parent.top
      anchors.left: parent.left
      !text: tr('Show Top Menu')
      height: 32
      visible: false

// actionbar
  Panel
    id: gameLeftActionPanel
    phantom: true
    focusable: false
    anchors.top: gameTopPanel.bottom
    anchors.left: gameLeftExtraPanel.right
    anchors.bottom: bottomSplitter.top
    padding-top: 1
    margin-left: 1
    border-width-right: 1
    border-color-right: #292929
    width: 36
    image-source: /images/ui/actionbar/actionbar_background-light
    image-border: 1
    margin-bottom: 16
    padding-right: 3 
    layout:
      type: horizontalBox
      fit-children: true
      spacing: 2
  UIWidget
    id: lockLeftPanel
    size: 38 16
    anchors.top: gameLeftActionPanel.bottom
    anchors.left: gameLeftActionPanel.left
    border-width-right: 1
    border-color-right: #292929
    image-source: /images/ui/actionbar/actionbar_background-light
    Button
      id: leftLock
      size: 34 16
      anchors.top: parent.top
      anchors.right: parent.right
      margin-right: 1
      @onClick: modules.game_actionbar.changeLockStatus(self, "Left")
      $pressed:
        icon-offset: 1 1

  Panel
    id: gameRightActionPanel
    phantom: true
    focusable: false
    anchors.top: gameTopPanel.bottom
    anchors.right: gameRightExtraPanel.left
    anchors.bottom: bottomSplitter.top
    margin-right: 1
    margin-top: 1
    border-width-left: 1
    border-color-left: #747474
    width: 36
    image-source: /images/ui/actionbar/actionbar_background-light
    image-border: 1
    margin-bottom: 16
    padding-left: 3

    layout:
      type: horizontalBox
      fit-children: true
      spacing: 2
  UIWidget
    id: lockRightPanel
    size: 38 16
    anchors.top: gameRightActionPanel.bottom
    anchors.right: gameRightActionPanel.right
    border-width-left: 1
    border-color-left: #747474
    image-source: /images/ui/actionbar/actionbar_background-light

    Button
      id: rightLock
      size: 34 16
      anchors.top: parent.top
      anchors.right: parent.right
      margin-right: 1
      @onClick: modules.game_actionbar.changeLockStatus(self, "Right")
      $pressed:
        icon-offset: 1 1
  Panel
    id: gameBottomActionPanel
    phantom: true
    focusable: false
    margin-right: 12
    padding-bottom: 2
    anchors.left: bottomSplitter.left
    anchors.right: bottomSplitter.right
    anchors.top: gameBottomStatsBarPanel.bottom
    layout:
      type: verticalBox
      fit-children: true

  UIWidget
    id: lockPanel
    size: 12 79
    anchors.top: gameBottomActionPanel.top
    anchors.bottom: gameBottomActionPanel.bottom
    anchors.left: gameBottomActionPanel.right
    margin-left: 1
    border-width-top: 1
    border-color-top: #292929
    image-source: /images/ui/actionbar/background-dark

    Button
      id: bottomLock
      width: 12
      anchors.top: parent.top
      anchors.right: parent.right
      margin-top: 1
      margin-bottom: 1
      icon-source: /images/ui/actionbar/locked
      icon-offset: 0 0
      @onClick: modules.game_actionbar.changeLockStatus(self, "Bottom")
      $pressed:
        icon-offset: 1 1

  Panel
    id: gameBottomCooldownPanel
    phantom: true
    focusable: false
    anchors.left: bottomSplitter.left
    anchors.right: bottomSplitter.right
    anchors.top: gameBottomActionPanel.bottom
    layout:
      type: verticalBox
      fit-children: true
// end actionsbar
  GameBottomPanel
    id: gameBottomPanel
    anchors.left: gameBottomCooldownPanel.left
    anchors.right: gameBottomCooldownPanel.right
    anchors.top: gameBottomCooldownPanel.bottom
    anchors.bottom: parent.bottom

  GameSidePanel
    id: gameLeftPanel
    anchors.left: parent.left
    anchors.top: parent.top
    anchors.bottom: parent.bottom
    focusable: false
    visible: true
    on: true
    $!on:
      width: 0
      visible: false

  GameSidePanel
    id: gameLeftExtraPanel
    anchors.left: prev.right
    anchors.top: parent.top
    anchors.bottom: parent.bottom
    margin-left: 1
    focusable: false
    visible: true
    on: true
    $!on:
      width: 0
      visible: false

  GameSidePanel
    id: gameMainRightPanel
    anchors.right: parent.right
    anchors.top: parent.top
    &ignoreFillAll: true
    &onlyPhantomDrop: true
    height: 200
    focusable: false
    on: true

  GameSidePanel
    id: gameRightPanel
    anchors.right: parent.right
    anchors.top: gameMainRightPanel.bottom
    anchors.bottom: parent.bottom
    focusable: false
    on: true

  GameSidePanel
    id: gameRightExtraPanel
    anchors.right: prev.left
    anchors.top: parent.top
    anchors.bottom: parent.bottom
    margin-right: 1
    focusable: false
    visible: true
    on: true
    $!on:
      width: 0
      visible: false

  SelectColumnButton
    id: gameSelectLeftColumn
    anchors.right: gameLeftPanel.right
    anchors.bottom: gameLeftPanel.bottom

  SelectColumnButton
    id: gameSelectRightColumn
    anchors.right: gameRightPanel.right
    anchors.bottom: gameRightPanel.bottom

  SelectColumnButton
    id: gameSelectRightExtraColumn
    anchors.right: gameRightExtraPanel.right
    anchors.bottom: gameRightExtraPanel.bottom
    
  SelectColumnButton
    id: gameSelectLeftExtraColumn
    anchors.right: gameLeftExtraPanel.right
    anchors.bottom: gameLeftExtraPanel.bottom

  Splitter
    id: bottomSplitter
    anchors.left: gameLeftExtraPanel.right
    anchors.right: gameRightExtraPanel.left
    anchors.bottom: parent.bottom
    height: 6
    image-source: /images/ui/actionbar/splitterActBottom
    size: 300 6
    opacity: 100
    margin-right: 1
    relative-margin: bottom
    margin-bottom: 200
    @canUpdateMargin: |
      function(self, newMargin)
        local dontStretch = modules.client_options.getOption('dontStretchShrink')
        local actionBars = modules.game_actionbar.getActiveBottomBars()
        local maxHeight = 118 + (35 * actionBars)
        local result = math.max(math.min(newMargin, self:getParent():getHeight() - 150), maxHeight)
        if dontStretch then
          result = result > 650 and 650 or (result > 450 and 450 or 200)
        end
        return result
      end
    @onGeometryChange: |
      function(self)
        local actionBars = modules.game_actionbar.getActiveBottomBars()
        local maxHeight = 118 + (35 * actionBars)
        local parentHeight = self:getParent():getHeight()
        self:setMarginBottom(math.min(math.max(parentHeight - 150, maxHeight), self:getMarginBottom()))
      end

  UIWidget
    id: mouseGrabber
    focusable: false
    visible: false

  TopStatsBar
    id: gameTopPanel
    anchors.left: gameLeftExtraPanel.right
    anchors.right: gameRightExtraPanel.left
    anchors.top: parent.top
    focusable: false

  TopStatsBar
    id: gameBottomStatsBarPanel
    anchors.left: gameLeftExtraPanel.right
    anchors.right: gameRightExtraPanel.left
    anchors.top: bottomSplitter.bottom
    margin-left: 1
    margin-right: 1
    focusable: false

  Button
    id: leftIncreaseSidePanels
    anchors.left: gameLeftExtraPanel.right
    anchors.top: parent.top
    image-source: /images/ui/topstats_button_panel
    image-clip: 27 0 9 27
    size: 9 27
    @onClick: onIncreaseLeftPanels()

    $hover:
      image-clip: 27 0 9 27
    $disabled:
      image-clip: 36 0 9 27

  Button
    id: leftDecreaseSidePanels
    anchors.left: leftIncreaseSidePanels.left
    anchors.top: leftIncreaseSidePanels.bottom
    image-source: /images/ui/topstats_button_panel
    image-clip: 36 26 9 27
    size: 9 27
    @onClick: onDecreaseLeftPanels()

    $hover:
      image-clip: 36 26 9 27

    $disabled:
      image-clip: 27 27 9 27

  Button
    id: rightIncreaseSidePanels
    anchors.right: gameRightExtraPanel.left
    anchors.top: parent.top
    image-source: /images/ui/topstats_button_panel
    image-clip: 0 0 9 27
    size: 9 27
    @onClick: onIncreaseRightPanels()

    $hover:
      image-clip: 0 0 9 27

    $disabled:
      image-clip: 9 0 9 27

  Button
    id: rightDecreaseSidePanels
    anchors.right: rightIncreaseSidePanels.right
    anchors.top: rightIncreaseSidePanels.bottom
    image-source: /images/ui/topstats_button_panel
    image-clip: 9 27 9 27
    size: 9 27
    @onClick: onDecreaseRightPanels()

    $hover:
      image-clip: 9 27 9 27

    $disabled:
      image-clip: 0 27 9 27
