/*
 * Copyright (c) 2008-2016 Haulmont.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

@mixin cuba-table-presentations {

  .c-table-prefs-icon {
    @include valo-button-style;

    position: absolute;
    z-index: 2;
    top: round($v-unit-size/2) - round($v-unit-size/4);
    right: round($v-unit-size/2) - round($v-unit-size/4);
    height: round($v-unit-size/2);
    line-height: round($v-unit-size/2);
    width: round($v-unit-size/2);
    padding: 0;
    border-radius: 50%;
    cursor: pointer;
    text-align: center;

    @include opacity(0);
    @if $v-animations-enabled {
      @include transition(opacity 200ms 1s);
    }

    &:after {
      content: "";
      position: absolute;
      $v-button-border-width: first-number($v-border);
      top: -$v-button-border-width;
      right: -$v-button-border-width;
      bottom: -$v-button-border-width;
      left: -$v-button-border-width;
      border-radius: inherit;
    }
    &:active:after {
      @include valo-button-active-style;
    }
    &:before {
      font-family: FontAwesome;
      content: "\f0ce";
    }
  }

  .v-table-header-wrap:hover .c-table-prefs-icon {
    @include opacity(1);
    @include transition-delay(100ms);
  }

  .v-ios.v-touch & .c-table-prefs-icon,
  .v-android.v-touch & .c-table-prefs-icon {
    @include opacity(1);
    @include transition(none);
  }

  .collapsing-allowed .c-table-prefs-icon {
    right: 2 * round($v-unit-size/2);
  }

  .c-table-prefs-editor {
    @include valo-selection-overlay-style;

    z-index: 19000 !important;  // do not hide parts of popup menu
    padding: 0 round($v-unit-size/3) round($v-unit-size/3);
  }

  .c-table-prefs-title {
    border-bottom: valo-border();
    border-bottom-style: dotted;
    line-height: $v-unit-size;
  }

  .c-table-prefs-list.v-menubar {
    border: 0;
    height: auto;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
  }

  $menuitem-padding: 4px;

  .c-table-prefs-list.v-menubar .v-menubar-menuitem {
    display: block;
    border-right: transparent;
    text-align: left;
    padding-left: $v-font-size + 2 * $menuitem-padding;
  }

  .c-table-prefs-list.v-menubar .c-table-prefs-menuitem-current {
    font-weight: bold;
  }

  .c-table-prefs-list.v-menubar .c-table-prefs-menuitem-default:before {
    font-family: "FontAwesome";
    content: "\f006";
    padding-left: $menuitem-padding;
  }

  .c-table-prefs-list.v-menubar .c-table-prefs-menuitem-current:before {
    font-family: "FontAwesome";
    content: "\f00c";
    padding-left: $menuitem-padding;
    font-weight: normal;
  }
}