
\ProvidesPackage{ptbposter-tcb}[2020/02/19 v0.1e ptbposter/tcolorbox (RN)]

\newcommand*\PTB@posterSet{%
  columns=3,rows=5,spacing=\PTB@texthsep,showframe=false,}
\newcommand*\posterSet[1]{%
  \g@addto@macro\PTB@posterSet{#1}%
}

\RequirePackage{kvoptions}[2009/07/17]
\SetupKeyvalOptions{%                                                  
  family=ptbposter-tcb,%
  prefix=PTB@,%
}

\DeclareStringOption[2]{boxlayout}

\ProcessKeyvalOptions*\relax

\newcommand*\PTB@boxesSet{}

\ifcase \PTB@boxlayout
    % 0
  \g@addto@macro\PTB@boxesSet{enhanced jigsaw,sharp corners=downhill,arc=.8ex}
\or % 1
  \g@addto@macro\PTB@boxesSet{enhanced jigsaw,sharp corners=uphill,arc=.8ex}
\or % 2
  \g@addto@macro\PTB@boxesSet{enhanced jigsaw,arc=.8ex}
\or % 3
  \g@addto@macro\PTB@boxesSet{arc=0pt}
\fi

\RequirePackage[most]{tcolorbox}
\tcbuselibrary{poster}
\usetikzlibrary{shadings,arrows.meta}
 
\colorlet{backgroundTop}{Goldenrod2!20}
\colorlet{backgroundBottom}{Goldenrod2!90}
\colorlet{boxBackground}{white}

\renewcommand*\backgroundContent{%
  \begin{tikzpicture}%
    \shade[top color=backgroundTop, bottom color=backgroundBottom,%
      shading angle=\ifPTBlandscape 64.07\else 41.55\fi](0,0)%
      % Winkel auf Basis von \PTB@framewidth und \PTB@frameheight
      rectangle(\PTB@framewidth,\PTB@frameheight);%
  \end{tikzpicture}%  
}

\tcbposterset{%    
  coverage={%
    height=\textheight,
    width=\textwidth,
    interior style={opacity=0},
    top=0pt,bottom=0pt,left=0pt,right=0pt
  }%
}% 

\g@addto@macro\PTB@boxesSet{
  arc=0.012\PTB@scale@base,
  boxrule=\PTB@framethickness,
  boxsep=0pt,
  top=1ex,bottom=1ex,left=1ex,right=1ex,
  toptitle=.6ex,bottomtitle=.6ex,lefttitle=1ex,righttitle=1ex,
  %before title pre=\strut, 
  colback=boxBackground,
  %opacityback=0.75,% ????
  colframe=PTBcolor,
  coltitle=white,
  fonttitle=\sffamily\bfseries\centering,
  title style={PTBcolor},
  valign=top% center
}

\tcbset{% scheint so günstiger
  adjusted title/.style={title={\raisebox{0pt}[\height][0pt]{#1}}}
}

\AtBeginDocument{%
  \protected@edef\PTB@tempa{\noexpand\tcbposterset{poster={\PTB@posterSet},%
    boxes={\PTB@boxesSet}}}%
  \PTB@tempa
  \begin{tcbposter}%
}
\AtEndDocument{%
  \end{tcbposter}%
}

\endinput
