/********************************************************
+*   (c) Mojang. All rights reserved                       *
+*   (c) Microsoft. All rights reserved.                   *
+*********************************************************/

{
  "namespace": "common_dialogs",

  "standard_title_label": {
    "type": "label",
    "size": [ "default", 10 ],
    "color": "$title_text_color",
    "text": "$text_name",
    "layer": 4,
    "shadow": false,
    "property_bag": {
      "#tts_dialog_title": "$text_name"
    },
    "bindings": [
      {
        "binding_type": "$title_text_binding_type",
        "binding_condition": "$title_binding_condition",
        "binding_name": "$text_name",
        "binding_name_override": "$text_name"
      },
      {
        "binding_type": "global",
        "binding_condition": "once",
        "binding_name": "#tts_dialog_title"
      }
    ]
  },

  "title_label": {
    "type": "panel",
    "anchor_from": "top_middle",
    "anchor_to": "top_middle",
    "$title_size|default": [ "100%c", 10 ],
    "size": "$title_size",
    "$title_offset|default": [ 0, 9 ],
    "offset": "$title_offset",
    "$use_custom_title_control|default": false,
    "$custom_title_label|default": "common.empty_panel",
    "$title_binding_condition|default": "none",
    "$title_text_binding_type|default": "none",
    "controls": [
      {
        "common_dialogs_0@standard_title_label": {
          "ignored": "$use_custom_title_control"
        }
      },
      {
        "common_dialogs_1@$custom_title_label": {
          "ignored": "(not $use_custom_title_control)"
        }
      }
    ]
  },

  /////////////////////////////////
  //
  //  DIALOG WINDOWS
  //
  /////////////////////////////////

  "main_panel_three_buttons": {
    "type": "panel",
    "anchor_from": "center",
    "anchor_to": "center",
    "$text_name|default": "",
    "$top_button_panel|default": "common.empty_panel",
    "$middle_button_panel|default": "common.empty_panel",
    "$bottom_button_panel|default": "common.empty_panel",
    "controls": [
      {
        "common_panel@common.common_panel": { "$dialog_background": "dialog_background_hollow_6" }
      },
      {
        "title_label@common_dialogs.title_label": {}
      },
      {
        "panel_indent": {
          "type": "panel",
          // Fit to the hole in dialog_background_hollow_1 exactly
          "size": [ "100% - 16px", "100% - 131px" ],
          "offset": [ 0, 23 ],
          "anchor_from": "top_middle",
          "anchor_to": "top_middle",
          "controls": [
            { "inside_header_panel@$child_control": {} }
          ]
        }
      },
      {
        "top_button_panel@$top_button_panel": {
          "size": [ "100% - 14px", 30 ],
          "offset": [ 0, -71 ],
          "anchor_from": "bottom_middle",
          "anchor_to": "bottom_middle"
        }
      },
      {
        "middle_button_panel@$middle_button_panel": {
          "size": [ "100% - 14px", 30 ],
          "offset": [ 0, -39 ],
          "anchor_from": "bottom_middle",
          "anchor_to": "bottom_middle"
        }
      },
      {
        "bottom_button_panel@$bottom_button_panel": {
          "size": [ "100% - 14px", 30 ],
          "offset": [ 0, -7 ],
          "anchor_from": "bottom_middle",
          "anchor_to": "bottom_middle"
        }
      }
    ]
  },

  "main_panel_two_buttons": {
    "type": "panel",
    "anchor_from": "center",
    "anchor_to": "center",
    "$text_name|default": "",
    "$top_button_panel|default": "common.empty_panel",
    "$bottom_button_panel|default": "common.empty_panel",
    "controls": [
      {
        "common_panel@common.common_panel": { "$dialog_background": "dialog_background_hollow_1" }
      },
      {
        "title_label@common_dialogs.title_label": {}
      },
      {
        "panel_indent": {
          "type": "panel",
          // Fit to the hole in dialog_background_hollow_1 exactly
          "size": [ "100% - 16px", "100% - 99px" ],
          "offset": [ 0, 23 ],
          "anchor_from": "top_middle",
          "anchor_to": "top_middle",
          "controls": [
            { "inside_header_panel@$child_control": {} }
          ]
        }
      },
      {
        "top_button_panel@$top_button_panel": {
          "size": [ "100% - 14px", 30 ],
          "offset": [ 0, -39 ],
          "anchor_from": "bottom_middle",
          "anchor_to": "bottom_middle"
        }
      },
      {
        "bottom_button_panel@$bottom_button_panel": {
          "size": [ "100% - 14px", 30 ],
          "offset": [ 0, -7 ],
          "anchor_from": "bottom_middle",
          "anchor_to": "bottom_middle"
        }
      }
    ]
  },

  "main_panel_one_button": {
    "type": "panel",
    "anchor_from": "center",
    "anchor_to": "center",
    "$text_name|default": "",
    "$button_panel|default": "common.empty_panel",
    "controls": [
      {
        "common_panel@common.common_panel": { "$dialog_background": "dialog_background_hollow_2" }
      },
      {
        "title_label@common_dialogs.title_label": {}
      },
      {
        "panel_indent": {
          "type": "panel",
          "size": [ "100% - 16px", "100% - 65px" ],
          "offset": [ 0, 23 ],
          "anchor_from": "top_middle",
          "anchor_to": "top_middle",
          "controls": [
            { "inside_header_panel@$child_control": {} }
          ]
        }
      },
      {
        "bottom_button_panel@$button_panel": {
          "size": [ "100% - 14px", 30 ],
          "offset": [ 0, -7 ],
          "anchor_from": "bottom_middle",
          "anchor_to": "bottom_middle"
        }
      }
    ]
  },

  "main_panel_no_buttons": {
    "type": "panel",
    "anchor_from": "center",
    "anchor_to": "center",
    "$text_name|default": "",
    "$panel_indent_size|default": [ "100% - 16px", "100% - 31px" ],
    "$custom_background|default": "dialog_background_hollow_3",
    "controls": [
      {
        "common_panel@common.common_panel": { "$dialog_background": "$custom_background" }
      },
      {
        "title_label@common_dialogs.title_label": {}
      },
      {
        "panel_indent": {
          "type": "panel",
          "size": "$panel_indent_size",
          "offset": [ 0, 23 ],
          "anchor_from": "top_middle",
          "anchor_to": "top_middle",
          "controls": [
            { "inside_header_panel@$child_control": {} }
          ]
        }
      }
    ]
  },

  "main_panel_no_title_no_buttons": {
    "type": "panel",
    "anchor_from": "center",
    "anchor_to": "center",
    "controls": [
      {
        "common_panel@common.common_panel": { "$dialog_background": "dialog_background_hollow_4" }
      },
      {
        "panel_indent": {
          "type": "panel",
          "size": [ "100% - 16px", "100% - 16px" ],
          "offset": [ 0, 8 ],
          "anchor_from": "top_middle",
          "anchor_to": "top_middle",
          "controls": [
            { "inside_header_panel@$child_control": {} }
          ]
        }
      }
    ]
  },

  "main_panel_small_title_one_button": {
    "type": "panel",
    "anchor_from": "center",
    "anchor_to": "center",
    "$text_name|default": "",
    "$button_panel|default": "common.empty_panel",
    "$show_close_button": false,
    "$button_panel_size|default": [ "100% - 14px", 30 ],
    "$main_panel_size|default": [ "100% - 16px", "100% - 59px" ],
    "controls": [
      {
        "common_panel@common.common_panel": { "$dialog_background": "dialog_background_hollow_5" }
      },
      {
        "title_label@common_dialogs.title_label": {
          "$title_offset": [ 0, 5 ]
        }
      },
      {
        "panel_indent": {
          "type": "panel",
          "size": "$main_panel_size",
          "offset": [ 0, 17 ],
          "anchor_from": "top_middle",
          "anchor_to": "top_middle",
          "controls": [
            { "inside_header_panel@$child_control": {} }
          ]
        }
      },
      {
        "bottom_button_panel@$button_panel": {
          "size": "$button_panel_size",
          "offset": [ 0, -7 ],
          "anchor_from": "bottom_middle",
          "anchor_to": "bottom_middle"
        }
      }
    ]
  },

  "main_panel": {
    "type": "panel",
    "anchor_from": "center",
    "anchor_to": "center",
    "controls": [
      { "modal_background_image@modal.modal_background_image": { "layer": 1 } },
      {
        "panel_indent": {
          "type": "panel",
          "size": [ "100% - 14px", "100% - 14px" ],
          "controls": [
            { "inside_header_panel@$child_control": {} }
          ]
        }
      }
    ]
  },


  /////////////////////////////////
  //
  //  FORM FITTING DIALOG WINDOWS
  //
  /////////////////////////////////


  "form_fitting_main_panel_no_buttons": {
    "type": "panel",
    "size": [ "100%", "100%c" ],
    "anchor_from": "center",
    "anchor_to": "center",
    "$text_name|default": "",
    "$show_close_button|default": true,
    "$use_compact_close_button|default": false,
    "$close_button_offset|default": [ 0, 0 ],
    "$custom_background": "common_dialogs.dialog_background_hollow_3",
    "controls": [
      { "common_panel@common_dialogs.common_panel": { "$dialog_background": "$custom_background" } }
    ]
  },

  "common_panel": {
    "type": "panel",
    "size": [ "100%", "100%c" ],
    "$dialog_background|default": "common.dialog_background_opaque",
    "controls": [
      {
        "bg_image@$dialog_background": {
          "layer": 1
        }
      }
    ]
  },

  "dialog_background_common": {
    "type": "image",
    "texture": "textures/ui/dialog_background_hollow_4",
    "layer": 1
  },

  "dialog_background_thin": {
    "type": "image",
    "texture": "textures/ui/thin_dialog",
    "layer": 1
  },

  "flat_solid_background": {
    "type": "image",
    "texture": "textures/ui/White",
    "color": "$0_color_format",
    "layer": 1
  },

  "dialog_background_hollow_common@common_dialogs.dialog_background_common": {
    "layer": 2,
    "$fill_alpha|default": 0.8,
    "$dialog_background_texture|default": "textures/ui/control",
    "variables": [
      {
        "requires": "$is_holographic",
        "$fill_alpha": 1.0
      }
    ],
    "controls": [
      {
        "control": {
          "type": "image",
          "texture": "$dialog_background_texture",
          "layer": 1,
          "$common_background_size|default": [ "100% - 16px", "100%c - 27px" ],
          "$close_button_offset|default": [ 6, -21 ],
          "size": "$common_background_size",
          "offset": [ 0, 7 ],
          "alpha": "$fill_alpha",
          "variables": [
            {
              "requires": "($show_close_button and $use_compact_close_button)",
              "$common_background_size": [ "100% - 16px", "100%c - 19px" ],
              "$close_button_offset": [ 6, -13 ]
            },
            {
              "requires": "(not $show_close_button)",
              "$common_background_size": [ "100% - 16px", "100%c - 6px" ]
            }
          ],
          "controls": [
            {
              "inside_header_panel@$child_control": {
              }
            },
            {
              "close_button_holder@common_dialogs.common_close_button_holder": {}
            },
            {
              "title_label@common_dialogs.title_label": {
                "anchor_from": "top_middle",
                "anchor_to": "top_middle",
                "offset": [ 0, -15 ]
              }
            }
          ]
        }
      }
    ]
  },

  "common_close_button_holder": {
    "type": "stack_panel",
    "visible": "$show_close_button",
    "anchor_from": "top_right",
    "anchor_to": "top_right",
    "size": [ "100%c", "100%c" ],
    "$close_button_offset|default": [ 0, 0 ],
    "offset": "$close_button_offset",
    "controls": [
      {
        "close@common.close_button": {
          "layer": 2,
          "ignored": "$use_compact_close_button"
        }
      },
      {
        "compact_close@common.compact_close_button": {
          "ignored": "(not $use_compact_close_button)",
          "layer": 2,
          "visible": "$use_compact_close_button"
        }
      }
    ]
  },

  "dialog_background_opaque@common_dialogs.dialog_background_common": {
    "size": [ "100%", "100%c" ],
    "texture": "textures/ui/dialog_background_opaque"
  },

  "dialog_background_opaque_with_child@common_dialogs.dialog_background_hollow_common": {
    // +31 same as hollow_3 to fit
    "size": [ "100%", "100%c + 31px" ],
    "texture": "textures/ui/dialog_background_opaque",
    // This isn't a hollow panel so we don't want to fill the hollow hole with the background color, so make it invisible
    "$fill_alpha": 0.0
  },

  "dialog_background_hollow_1@common_dialogs.dialog_background_hollow_common": {
    "size": [ "100%", "100%c" ],
    "texture": "textures/ui/dialog_background_hollow_1"
  },

  "dialog_background_hollow_2@common_dialogs.dialog_background_hollow_common": {
    "size": [ "100%", "100%c" ],
    "texture": "textures/ui/dialog_background_hollow_2"
  },

  "dialog_background_hollow_3@common_dialogs.dialog_background_hollow_common": {
    "size": [ "100%", "100%c + 31px" ],
    "texture": "textures/ui/dialog_background_hollow_3"
  },

  "dialog_background_hollow_4@common_dialogs.dialog_background_hollow_common": {
    "size": [ "100%", "100%c" ],
    "texture": "textures/ui/dialog_background_hollow_4"
  },

  "dialog_background_hollow_6@common_dialogs.dialog_background_hollow_common:": {
    "size": [ "100%", "100%c" ],
    "texture": "dialog_background_hollow_6"
  },

  "full_screen_background": {
    "type": "panel",
    "$fill_alpha|default": 0.8,
    "variables": [
      {
        "requires": "$is_holographic",
        "$fill_alpha": 1.0
      },
      {
        "requires": "$is_full_screen_layout",
        "$screen_background_control|default": "common_dialogs.background_image"
      },
      {
        "requires": "(not $is_full_screen_layout)",
        "$screen_background_control|default": "common.empty_panel"
      }
    ],
    "controls": [
      {
        "background@$screen_background_control": {
          "layer": 1,
          "size": [ "100%", "100%" ],
          "alpha": "$fill_alpha"
        }
      }
    ]
  },

  "background_image": {
    "type": "image",
    "texture": "textures/ui/control"
  }
}
