\mode<presentation>
\RequirePackage{tikz}
% Control of shadows for blocks
\def\beamer@themeTELECOMBretagne@shadow{true}
\newcommand{\withoutshadow}{\def\beamer@themeTELECOMBretagne@shadow{false}}

\newcommand{\insertdocumentref}{}

% Basic colors for the theme
\RequirePackage{TBcolors}

\setbeamercolor{structure}{fg=Vert}
\setbeamercolor*{alerted text}{fg=RougeBrique}
\setbeamercolor*{example text}{fg=Vert!90!black}

\setbeamercolor*{palette primary}{fg=white}
\setbeamercolor*{palette secondary}{fg=Vert}
\setbeamercolor*{palette tertiary}{fg=Vert}
\setbeamercolor*{palette quaternary}{fg=RougeBrique}


% ITEMIZE
\setbeamercolor*{itemize item}{fg=Vert}
\setbeamercolor*{itemize subitem}{fg=Vert}
\setbeamercolor*{itemize subsubitem}{fg=Vert}

\setbeamercolor*{itemize/enumerate body}{parent=normal text}
\setbeamercolor*{itemize/enumerate subbody}{parent=normal text}
\setbeamercolor*{itemize/enumerate subsubbody}{parent=normal text}

\defbeamertemplate{itemize item}{bigsquare}{\hbox{\vrule width 1ex height 1ex}}
\defbeamertemplate{itemize subitem}{smallcircle}{\tikz[baseline=-0.85mm]{\fill[inner sep=0mm] circle (0.6mm);}}
\defbeamertemplate{itemize subsubitem}{dash}{{\small-}}
\setbeamertemplate{itemize item}[bigsquare]
\setbeamertemplate{itemize subitem}[smallcircle]
\setbeamertemplate{itemize subsubitem}[dash]

% NAVIGATION SYMBOLS
\setbeamercolor*{navigation symbols}{fg=Vert}
\setbeamercolor*{navigation symbols dimmed}{use=navigation symbols,fg=navigation symbols.fg!40!bg}
\setbeamertemplate{navigation symbols}{}

% BLOCKS
\setbeamercolor{block title}{use=structure,fg=white,bg=structure.fg}
\setbeamercolor{block title alerted}{use=alerted text,fg=white,bg=alerted text.fg}
\setbeamercolor{block title example}{use=example text,fg=white,bg=example text.fg!75!black}

\setbeamercolor{block body}{parent=normal text,use=block title,bg=block title.bg!10!bg}
\setbeamercolor{block body alerted}{parent=normal text,use=block title alerted,bg=block title alerted.bg!10!bg}
\setbeamercolor{block body example}{parent=normal text,use=block title example,bg=block title example.bg!40!bg}

\setbeamerfont{block title}{size={}}
\setbeamertemplate{blocks}[rounded][shadow=\beamer@themeTELECOMBretagne@shadow]

\setbeamersize{text margin left=2em,text margin right=1em}

% TITLE PAGE
\RequirePackage{xkeyval}
\RequirePackage{ifthen}	
\newboolean{beamer@tb@title}
\setboolean{beamer@tb@title}{false}
\define@boolkey{beamerframe}{title}[true]{
  \def\beamer@tb@background{title}
  \setboolean{beamer@tb@title}{#1}%
  %option t from beamer
  \beamer@frametopskip=.2cm plus .5\paperheight\relax%
  \beamer@framebottomskip=0pt plus 1fill\relax%
  \beamer@frametopskipautobreak=\beamer@frametopskip\relax%
  \beamer@framebottomskipautobreak=\beamer@framebottomskip\relax%
  \def\beamer@initfirstlineunskip{%
    \def\beamer@firstlineitemizeunskip{%
      \vskip-\partopsep\vskip-\topsep\vskip-\parskip%
      \global\let\beamer@firstlineitemizeunskip=\relax}%
    \everypar{\global\let\beamer@firstlineitemizeunskip=\relax}}
}
\presetkeys{beamerframe}{title=false}{}
\setbeamercolor*{titlelike}{fg=white}
\setbeamercolor*{author}{fg=white}
\setbeamercolor*{institute}{fg=white}
\setbeamercolor*{date}{fg=white}

\setbeamerfont{title}{size=\LARGE}
\setbeamerfont{subtitle}{size=\Large}
\setbeamerfont{author}{size=\normalsize}
\setbeamerfont{documentref}{size=\normalsize}
\setbeamerfont{date}{size=\small}

\defbeamertemplate*{title page}{TELECOMBretagne theme}[1][]{
  \vbox{}
%  \vfill
%  \begin{centering}
    \vskip3.4em
    \begin{beamercolorbox}[sep=2pt,center,leftskip=2.8cm,#1]{title}
      \usebeamerfont{title}\inserttitle\par%
      \ifx\insertsubtitle\@empty%
      \else%
        \vskip0.25cm%
        {\usebeamerfont{subtitle}\insertsubtitle\par}%
      \fi%
      \ifx\insertauthor\@empty%
      \else%
        \vskip0.25cm%\par
        {\usebeamerfont{author}\insertauthor\par}%
      \fi
      \usebeamerfont{documentref}%
      \ifx\insertdocumentref\@empty%
      \else%
        \insertdocumentref\par%
      \fi%
      \usebeamerfont{date}\insertdate%
    \end{beamercolorbox}%
}
%\setbeamertemplate{title page}[TELECOMBretagne theme][colsep=-4bp,rounded=true,shadow=\beamer@themeTELECOMBretagne@shadow]

% PART PAGE
% Exemple : 
% \AtBeginPart{%
%  \begin{frame}<beamer>[background=page_3]
%    \partpage
%  \end{frame}
% }%
\setbeamercolor*{part name}{fg=white}
\setbeamercolor*{part title}{fg=Vert}
\defbeamertemplate*{part page}{TELECOMBretagne theme}[1][]{
  % \setbeamertemplate{background}{\pgfuseimage{background_page_3}}
  \vskip3.5ex\hskip10em\par
  {\usebeamerfont{part name}\usebeamercolor[fg]{part name}\partname}
  \begin{centering}
    \vskip16ex\par
    \begin{beamercolorbox}[sep=8pt,center,#1]{part title}
      \usebeamerfont{part title}\insertpart\par
    \end{beamercolorbox}
  \end{centering}
}
\setbeamertemplate{part page}[TELECOMBretagne theme][colsep=-4bp,rounded=true,shadow=\beamer@themeTELECOMBretagne@shadow]

\setbeamertemplate{sections/subsections in toc}[ball]


% FOOTLINE
\newcommand{\firstfoot}{\insertframenumber{} / \inserttotalframenumber}
\newcommand{\secondfoot}{\insertshortauthor}
\newcommand{\thirdfoot}{\insertshorttitle}

\setbeamercolor{firstfoot}{fg=white}
\setbeamercolor{secondfoot}{fg=white}
\setbeamercolor{thirdfoot}{fg=black}

\setbeamerfont{firstfoot}{size=\scriptsize}
\setbeamerfont{secondfoot}{size=\scriptsize}
\setbeamerfont{thirdfoot}{size=\scriptsize}

\defbeamertemplate*{footline}{TELECOMBretagne theme}{%
  \ifthenelse{\boolean{beamer@tb@title}}{%
  }{%
    \leavevmode%
    \hbox{
      \begin{beamercolorbox}[wd=.15\paperwidth,ht=5ex,dp=2.25ex,leftskip=.3cm plus1fill,rightskip=.3cm]{firstfoot}%
        \usebeamerfont{firstfoot}%
        \firstfoot%
      \end{beamercolorbox}%
      \begin{beamercolorbox}[wd=.3\paperwidth,ht=5ex,dp=2.25ex,leftskip=.5cm,rightskip=.3cm plus1fill]{secondfoot}%
        \usebeamerfont{secondfoot}
        \secondfoot%
      \end{beamercolorbox}%
      \begin{beamercolorbox}[wd=.4\paperwidth,ht=5ex,dp=2.25ex,leftskip=.2cm,rightskip=.3cm plus1fill]{thirdfoot}%
        \usebeamerfont{thirdfoot}
        \thirdfoot%
      \end{beamercolorbox}%
    }%
    \vskip3.6pt%
  }
}
\newcommand{\GreenOnWhiteStyle}{
  \renewcommand{\backgroundtype}{2}
  \renewcommand{\defaulttitlecolor}{VertClair}
}
% BACKGROUND
\newcommand{\backgroundtype}{1}
\define@key{beamerframe}{background}{\def\beamer@tb@background{#1}}%
\presetkeys{beamerframe}{background=page_\backgroundtype}{}
\pgfdeclareimage[height=\paperheight,width=\paperwidth]{background_title}{n_fond_titre}
\pgfdeclareimage[height=\paperheight,width=\paperwidth]{background_page_1}{n_fond_page_1}
\pgfdeclareimage[height=\paperheight,width=\paperwidth]{background_page_2}{n_fond_page_2}
\pgfdeclareimage[height=\paperheight,width=\paperwidth]{background_page_3}{n_fond_page_3}
\setbeamertemplate{background}{
  \pgfuseimage{background_\beamer@tb@background}%
}

% FRAMETITLE
\newcommand{\defaulttitlecolor}{white}
\define@key{beamerframe}{title color}{\def\beamer@tb@titlecolor{#1}}%
\presetkeys{beamerframe}{title color=\defaulttitlecolor}{}
\setbeamercolor{frametitle}{fg=\beamer@tb@titlecolor}
\setbeamerfont{frametitle}{size=\large}
\defbeamertemplate*{frametitle}{TELECOMBretagne theme}{%
  \vskip0.07\paperheight% % Je me d\'ecale de la hauteur du bandeau \'Ecole...
  \nointerlineskip%
  \vskip-2pt%
  \hbox{\leavevmode
%    \advance\beamer@leftmargin by -12bp%
%    \advance\beamer@rightmargin by -12bp%
    \beamer@tempdim=\textwidth%
    \advance\beamer@tempdim by \beamer@leftmargin%
    \advance\beamer@tempdim by \beamer@rightmargin%
    \hskip-\Gm@lmargin\hbox{%
      \setbox\beamer@tempbox=\hbox{\begin{minipage}[b]{\paperwidth}%
          \vbox{}\vskip-.65ex%
%          \leftskip0.3cm%
          \leftskip0.16\paperwidth % Largeur du dessin de la charte \`a gauche
          \rightskip0.3cm plus1fil\leavevmode
          \ifx\insertframetitle\@empty%
          \else%
            {\usebeamerfont*{frametitle}\insertframetitle\strut\par}%
          \fi%
          \nointerlineskip
          \vbox{}%
          \end{minipage}}%
      \beamer@tempdim=\ht\beamer@tempbox%
      \advance\beamer@tempdim by 2pt%
       \begin{pgfpicture}{0pt}{0pt}{\paperwidth}{\beamer@tempdim}
%         \usebeamercolor{frametitle right}
%         \pgfpathrectangle{\pgfpointorigin}{\pgfpoint{\paperwidth}{\beamer@tempdim}}
%         \pgfusepath{clip}
         \pgftext[left,base]{} % C'est manifestement \c{c}a qui place le texte
       \end{pgfpicture}
      \hskip-\paperwidth%
      \box\beamer@tempbox%
    }%
    \hskip-\Gm@rmargin%
  }%
  \nointerlineskip
  \vskip-0.2pt
}

\mode
<all>
