%% The LaTeX package tcolorbox - version 1.30 (2012/04/20)
%% tcbskins.code.tex: Code for colorboxes with different skins
%%
%% -------------------------------------------------------------------------------------------
%% Copyright (c) 2006-2012 by Prof. Dr. Dr. Thomas F. Sturm <thomas dot sturm at unibw dot de>
%% -------------------------------------------------------------------------------------------
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status `author-maintained'.
%%
%% This work consists of all files listed in README
%%
\makeatletter
\def\tcblibrary@skins@loaded{}

\RequirePackage{tikz}[2010/10/13]

\def\tcb@creategeonodes@true{%
  \begin{scope}[every node/.style={line width=0mm,inner sep=0mm,draw=none,fill=none,rectangle}]
    \node[name=frame,at={(0,0)},above right,minimum width=\kvtcb@width,minimum height=\tcb@height]{};
    \node[name=interior,at={({\kvtcb@boxrule},{\kvtcb@boxrule})},above right,minimum width=\kvtcb@width-\kvtcb@boxrule*2,minimum height=\tcb@innerheight]{};
    \iftcb@lowerspace%
    \node[name=segmentation,at={({\kvtcb@boxrule},{\kvtcb@boxrule+\kvtcb@boxsep*2+\kvtcb@bottom+\tcb@height@lower})},above right,
       minimum width=\kvtcb@width-\kvtcb@boxrule*2,minimum height=\kvtcb@middle*2]{};
    \fi%
  \end{scope}%
}

% fill frame
\def\tcb@drawframe@path{%
  \path[fill=\kvtcb@colframe,rounded corners=\kvtcb@arc+\kvtcb@boxrule,frame@style]
  (frame.south west) rectangle (frame.north east);%
}

% fill inner box with title
\def\tcb@drawwithtitle@path{%
  \path[fill=\kvtcb@colback,interior@style] (interior.north west)
    --(interior.north east)[rounded corners=\kvtcb@arc]
    --(interior.south east)--(interior.south west)[sharp corners]
    -- cycle;%
}

% fill inner box without title
\def\tcb@drawwithouttitle@path{%
  \path[fill=\kvtcb@colback,rounded corners=\kvtcb@arc,interior@style]
  (interior.south west) rectangle (interior.north east);%
}

% draw segmentation line
\def\tcb@drawlower@path{%
  \path[draw=\kvtcb@colframe,dashed,segmentation@style]
  (segmentation.west)--(segmentation.east);%
}

\def\tcb@drawframe@freelance{\tcb@frame@code}
\def\tcb@drawwithtitle@freelance{\tcb@interiortitled@code}
\def\tcb@drawwithouttitle@freelance{\tcb@interior@code}
\def\tcb@drawlower@freelance{\tcb@segmentation@code}

\tcbset{%
  frame style/.code={\tikzset{frame@style/.style={#1}}},%
  frame code/.code={\def\tcb@frame@code{#1}},%
  frame code/.default=\tcb@drawframe@standard,%
  interior style/.code={\tikzset{interior@style/.style={#1}}},%
  interior titled code/.code={\def\tcb@interiortitled@code{#1}},%
  interior titled code/.default=\tcb@drawwithtitle@standard,%
  interior code/.code={\def\tcb@interior@code{#1}},%
  interior code/.default=\tcb@drawwithouttitle@standard,%
  segmentation style/.code={\tikzset{segmentation@style/.style={#1}}},%
  segmentation code/.code={\def\tcb@segmentation@code{#1}},%
  segmentation code/.default=\tcb@drawlower@standard,%
  colbacklower/.store in=\kvtcb@colbacklower,%
}

\tcbset{%
  frame style=,%
  interior style=,%
  segmentation style=,%
  frame code,%
  interior titled code,%
  interior code,%
  segmentation code,%
  colbacklower=black!15!white,
}

\tcbset{skin@enhanced/.style={%
  graphical environment=tikzpicture,geometry nodes,
  frame engine=path,interior titled engine=path,
  interior engine=path,segmentation engine=path
}}

\tcbset{skin@freelance/.style={%
  graphical environment=tikzpicture,geometry nodes,
  frame engine=freelance,interior titled engine=freelance,
  interior engine=freelance,segmentation engine=freelance
}}

\tcbset{skin@bicolor/.style={%
  graphical environment=tikzpicture,geometry nodes,
  frame engine=path,interior titled engine=freelance,
  interior engine=freelance,segmentation engine=freelance,
  interior style=,
  interior titled code={%
    \iftcb@lowerspace%
    \path[fill=\kvtcb@colback,interior@style]
      (segmentation.west) rectangle (interior.north east);%
    \else%
    \path[fill=\kvtcb@colback,interior@style]
      (interior.north west)--(interior.north east)[rounded corners=\kvtcb@arc]
      --(interior.south east)--(interior.south west)[sharp corners]
      -- cycle;%
    \fi},
  interior code={%
    \iftcb@lowerspace%
    \path[fill=\kvtcb@colback,interior@style]
      (segmentation.east)--(segmentation.west)[rounded corners=\kvtcb@arc]
      -- (interior.north west)--(interior.north east)[sharp corners]
      -- cycle;%
    \else%
    \path[fill=\kvtcb@colback,rounded corners=\kvtcb@arc,interior@style]
      (interior.south west) rectangle (interior.north east);%
    \fi},
  segmentation code={%
    \path[fill=\kvtcb@colbacklower,segmentation@style]
    ([yshift=0.1mm]segmentation.west)--([yshift=0.1mm]segmentation.east)[rounded corners=\kvtcb@arc]
      --(interior.south east)--(interior.south west)[sharp corners]
      -- cycle;}%
}}

\tcbset{skin@beamer/.style={%
  graphical environment=tikzpicture,geometry nodes,
  frame engine=path,interior titled engine=freelance,
  interior engine=freelance,segmentation engine=freelance,
  boxrule=0mm,arc=2mm,frame style={fill=\kvtcb@colframe,drop shadow},
  fonttitle=\bfseries,interior style=,
  interior titled code={%
    \iftcb@lowerspace%
    \path[top color=\kvtcb@colback,bottom color=\kvtcb@colback!85!black,interior@style]
      (segmentation.west) rectangle (interior.north east);%
    \else%
    \path[top color=\kvtcb@colback,bottom color=\kvtcb@colback!85!black,interior@style]
      (interior.north west)--(interior.north east)[rounded corners=\kvtcb@arc]
      --(interior.south east)--(interior.south west)[sharp corners]
      -- cycle;%
    \fi%
    \path[top color=\kvtcb@colframe,bottom color=\kvtcb@colback]
      ([yshift=-0.5mm]interior.north west) rectangle
      ([yshift=0.5mm]interior.north east);},
  interior code={%
    \iftcb@lowerspace%
    \path[top color=\kvtcb@colback,bottom color=\kvtcb@colback!85!black,interior@style]
      (segmentation.east)--(segmentation.west)[rounded corners=\kvtcb@arc]
      -- (interior.north west)--(interior.north east)[sharp corners]
      -- cycle;%
    \else%
    \path[top color=\kvtcb@colback,bottom color=\kvtcb@colback!85!black,rounded corners=\kvtcb@arc,interior@style]
      (interior.south west) rectangle (interior.north east);%
    \fi},
  segmentation code={%
    \path[top color=\kvtcb@colback,bottom color=\kvtcb@colback!85!black,interior@style]
      (segmentation.west)--(segmentation.east)[rounded corners=\kvtcb@arc]
      --(interior.south east)--(interior.south west)[sharp corners]
      -- cycle;}%
}}

\tcbset{skin@widget/.style={%
  graphical environment=tikzpicture,geometry nodes,
  frame engine=path,interior titled engine=freelance,
  interior engine=freelance,segmentation engine=freelance,
  arc=0.5mm,frame style={fill=\kvtcb@colframe},
  interior style=,segmentation style=,fonttitle=\bfseries,
  interior titled code={%
    \path[fill=\kvtcb@colback,rounded corners=\kvtcb@arc,interior@style]
    (interior.south west) rectangle ([xshift={-\kvtcb@boxrule},yshift={-\kvtcb@boxrule}]frame.north east);
    \path[left color=\kvtcb@colframe!75!white,right color=\kvtcb@colframe!75!white!25!\kvtcb@colback,interior@style]
    (interior.north east)--(interior.north west)[rounded corners=\kvtcb@arc]
      -- ([xshift={\kvtcb@boxrule},yshift={-\kvtcb@boxrule}]frame.north west)--([xshift={-\kvtcb@boxrule},yshift={-\kvtcb@boxrule}]frame.north east)[sharp corners]
      -- cycle;},
  interior code={%
    \path[fill=\kvtcb@colback,rounded corners=\kvtcb@arc,interior@style]
    (interior.south west) rectangle (interior.north east);},
  segmentation code={%
    \path[left color=\kvtcb@colframe!75!white,right color=\kvtcb@colframe!75!white!25!\kvtcb@colback,segmentation@style]
    ([yshift={-\kvtcb@middle/4}]segmentation.west) rectangle ([yshift={\kvtcb@middle/4}]segmentation.east);}%
}}

