MiniPanel2 < Panel
  text-offset: 0 3
  text-align: top
  image-source: /images/ui/minipanel
  image-border: 2
  image-border-top: 19
  padding-left: 7
  padding-bottom: 7
  padding-top: 24
  padding-right: 7

TaskSelectionButton < Panel
  image-source: /images/ui/button
  image-color: #dfdfdf
  image-clip: 0 0 22 23
  image-border: 3
  border: 1 alpha
  focusable: true
  phantom: false

  $hover:
    border: 1 white

  $focus:
    border: 1 white
    image-color: #ffffff

  Panel
    id: progress
    image-source: /images/ui/panel_flat
    image-color: #00ff00
    margin-left: 1
    margin-top: 1
    anchors.top: parent.top
    anchors.left: parent.left
    size: 159 158

  UICreature
    id: creature
    anchors.centerIn: parent
    size: 90 90
    margin-bottom: 17
    phantom: true
    anchors.verticalCenter: prev.verticalCenter

  Label
    id: name
    anchors.bottom: creature.top
    anchors.left: parent.left
    anchors.right: parent.right
    margin-top: -7
    text-align: top
    text-wrap: true
    text-border: 5 black

  Label
    id: kills
    anchors.top: creature.bottom
    anchors.left: parent.left
    anchors.right: parent.right
    text-align: center
    margin-top: 5
    text-wrap: true

  Label
    id: reward
    anchors.top: prev.bottom
    anchors.left: parent.left
    anchors.right: parent.right
    text-align: center
    margin-top: 2
    text-wrap: true

  Label
    id: rewardTaskPoints
    anchors.top: prev.bottom
    anchors.left: parent.left
    anchors.right: parent.right
    text-align: center
    margin-top: 3
    text-wrap: true

MainWindow
  size: 549 509
  id: tasksWindow
  !text: tr('Tasks')

  @onEnter: modules.game_tasks.toggleWindow()
  @onEscape: modules.game_tasks.toggleWindow()

  MiniPanel2
    id: listSearch
    anchors.top: parent.top
    anchors.left: parent.left
    anchors.right: parent.right
    margin-left: 5
    height: 50
    text: Filter

    TextEdit
      id: search
      anchors.fill: parent
      placeholder: Search by name

  ScrollablePanel
    id: selectionList
    anchors.top: listSearch.bottom
    anchors.left: listSearch.left
    anchors.right: parent.right
    anchors.bottom: separator.top
    margin-top: 5
    margin-bottom: 5
    image-source: /images/ui/panel_flat
    image-border: 1
    padding: 4
    padding-right: 16
    vertical-scrollbar: selectionScroll
    layout:
      type: grid
      cell-size: 160 160
      cell-spacing: 2
      flow: true

  VerticalScrollBar
    id: selectionScroll
    anchors.top: prev.top
    anchors.right: prev.right
    anchors.bottom: prev.bottom
    step: 80
    pixel-scroll: true

  HorizontalSeparator
    id: separator
    anchors.bottom: parent.bottom
    anchors.left: parent.left
    anchors.right: parent.right
    margin-bottom: 30

  Label
    id: info
    anchors.top: separator.top
    anchors.left: parent.left
    width: 140
    height: 45
    text-align: center
    text-wrap: true

  Button
    id: toggleButton
    anchors.bottom: parent.bottom
    anchors.right: parent.right
    text: Close
    width: 65
    @onClick: modules.game_tasks.toggleWindow()

  Button
    id: finishButton
    anchors.bottom: parent.bottom
    anchors.right: toggleButton.left
    text: Finish
    width: 55
    margin-right: 5
    @onClick: modules.game_tasks.finish()

  Button
    id: startButton
    anchors.bottom: parent.bottom
    anchors.right: toggleButton.left
    text: Start
    width: 55
    margin-right: 5
    @onClick: modules.game_tasks.start()

  Button
    id: abortButton
    anchors.bottom: parent.bottom
    anchors.right: toggleButton.left
    text: Abort
    width: 55
    margin-right: 5
    @onClick: modules.game_tasks.abort()

  ResizeBorder
    anchors.right: parent.right
    anchors.top: parent.top
    anchors.bottom: parent.bottom
    enabled: true
    minimum: 190
