TradeWindow < MiniWindow
  !text: tr('Trade')
  height: 150

  UIItem
    id: tradeItem
    virtual: true
    size: 16 16
    anchors.top: parent.top
    anchors.left: parent.left
    margin-top: 4
    margin-left: 4

  MiniWindowContents
    padding: 6

    ScrollableFlatPanel
      id: ownTradeContainer
      anchors.top: parent.top
      anchors.bottom: acceptButton.top
      anchors.left: parent.left
      anchors.right: ownTradeScrollBar.left
      margin-top: 14
      margin-bottom: 4
      padding: 2
      layout:
        type: grid
        cell-size: 36 36
        flow: true
        cell-spacing: 0
      vertical-scrollbar: ownTradeScrollBar

    VerticalScrollBar
      id: ownTradeScrollBar
      anchors.top: parent.top
      anchors.bottom: acceptButton.top
      anchors.right: counterTradeContainer.left
      margin-top: 14
      margin-bottom: 4
      step: 14
      pixels-scroll: true
      $disabled:
        width: 0

    ScrollableFlatPanel
      id: counterTradeContainer
      anchors.top: parent.top
      anchors.bottom: acceptButton.top
      anchors.left: parent.horizontalCenter
      anchors.right: counterTradeScrollBar.left
      margin-top: 14
      margin-bottom: 4
      padding: 2
      layout:
        type: grid
        cell-size: 36 36
        flow: true
        cell-spacing: 0
      vertical-scrollbar: counterTradeScrollBar

    VerticalScrollBar
      id: counterTradeScrollBar
      anchors.top: parent.top
      anchors.bottom: acceptButton.top
      anchors.right: parent.right
      margin-top: 14
      margin-bottom: 4
      step: 14
      pixels-scroll: true
      $disabled:
        width: 0

    Label
      id: ownTradeLabel
      anchors.bottom: ownTradeContainer.top
      anchors.left: ownTradeContainer.left
      anchors.right: ownTradeContainer.right
      margin-bottom: 2

    Label
      id: counterTradeLabel
      anchors.bottom: counterTradeContainer.top
      anchors.left: counterTradeContainer.left
      anchors.right: counterTradeContainer.right
      margin-bottom: 2

    Button
      !text: tr('Accept')
      id: acceptButton
      anchors.bottom: parent.bottom
      anchors.left: parent.left
      anchors.right: parent.horizontalCenter
      margin-right: 2
      enabled: false
      @onClick: g_game.acceptTrade(); self:disable()

    Button
      !text: tr('Reject')
      id: rejectButton
      anchors.bottom: parent.bottom
      anchors.right: parent.right
      anchors.left: parent.horizontalCenter
      margin-left: 2
      @onClick: g_game.rejectTrade()