// Drawing mixins

// Entries

@mixin entry($t) {
//
// Entries drawing function
//
// $t: entry type
//

  @if $t==normal {
  //
  // normal entry
  //
    color: $text_color;
    background-color: $entry_bg;
    border: 1px solid $entry_border;
  }

  @if $t==focus {
  //
  // focused entry
  //
    color: $fg_color;
    background-color: $entry_bg;
    border: 1px solid if($variant=='light', $selected_bg_color, $entry_border);

    @if $variant=='dark' {
      box-shadow: inset 0 1px $selected_bg_color,
                  inset 0 -1px $selected_bg_color,
                  inset 1px 0 $selected_bg_color,
                  inset -1px 0 $selected_bg_color;
    }
  }

  @if $t==insensitive {
  //
  // insensitive entry
  //
    color: $insensitive_fg_color;
    background-color: mix($entry_bg, $bg_color, 55%);
    border-color: 1px solid mix($entry_border, $bg_color, 55%);
  }
}

// Buttons

@mixin button($t) {
//
// Button drawing function
//

  @if $t==normal {
  //
  // normal button
  //
    color: $fg_color;
    background-color: $button_bg;
    border: 1px solid $button_border;
  }

  @else if $t==hover {
  //
  // hovered button
  //
    color: $fg_color;
    background-color: lighten($button_bg, 5%);
    border: 1px solid $button_border;
  }

  @else if $t==active {
  //
  // pushed button
  //
    color: $selected_fg_color;
    background-color: $selected_bg_color;
    border: 1px solid if($variant=='light', $selected_bg_color, $button_border);
  }

  @else if $t==insensitive {
  //
  // insensitive button
  //
    color: $insensitive_fg_color;
    border: 1px solid transparentize($button_border, 0.45);
    background-color: transparentize($button_bg, 0.45);
  }

  @if $t==header-normal {
  //
  // normal header-bar button
  //
    color: $header_fg;
    background-color: transparentize($header_bg, 1);
    border-color: transparentize($header_bg, 1);
  }

  @else if $t==header-hover {
  //
  // hovered header-bar button
  //
    color: $header_fg;
    border-color: $header_button_border;
    background-color: $header_button_bg;
  }

  @else if $t==header-active {
  //
  // pushed header-bar button
  //
    color: $selected_fg_color;
    border-color: if($variant=='light' and $darker=='false', $selected_bg_color, $header_button_border);
    background-color: $selected_bg_color;
  }

  @else if $t==header-insensitive {
  //
  // insensitive header-bar button
  //
    color: transparentize($header_fg, 0.45);
    background-color: transparentize($header_bg, 1);
    border-color: transparentize($header_bg, 1);

    > GtkLabel { color: inherit; }
  }

  @else if $t==header-insensitive-active {
  //
  // header-bar insensitive pushed button
  //
    color: transparentize($selected_fg_color, 0.25);
    border-color: transparentize($selected_bg_color, 0.35);
    background-color: transparentize($selected_bg_color, 0.35);
  }

  @else if $t==osd {
  //
  // normal osd button
  //
    color: $osd_fg_color;
    border-color: $osd_button_border;
    background-color: $osd_button_bg;
  }

  @else if $t==osd-hover {
  //
  // active osd button
  //
    color: $osd_fg_color;
    border-color: $osd_button_border;
    background-color: opacify(lighten($osd_button_bg, 7%), 0.1);
  }

  @else if $t==osd-active {
  //
  // active osd button
  //
    color: $selected_fg_color;
    border-color: $osd_button_border;
    background-color: $selected_bg_color;
  }

  @else if $t==osd-insensitive {
  //
  // insensitive osd button
  //
    color: $osd_insensitive_fg_color;
    border-color: $osd_button_border;
    background-color: transparentize($osd_button_bg, 0.15);
  }
}
