%% This is file `beamerthemeNantes.sty',
%%  
%% Copyright 2008 by Alain Camanes
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Public License.
%
% See the file doc/licenses/LICENSE for more details.
%v 0.1 12/11/2008

\ProvidesPackage{beamerthemeNantes.sty}[2008/11/12]

\DeclareOptionBeamer{hideothersubsections}{\PassOptionsToPackage{hideothersubsections=#1}{beamerouterthemesidebar}}
\DeclareOptionBeamer{hideallsubsections}{\PassOptionsToPackage{hideallsubsections=#1}{beamerouterthemesidebar}}

\DeclareOptionBeamer{width}{\PassOptionsToPackage{width=#1}{beamerouterthemesidebar}}
\DeclareOptionBeamer{left}{\PassOptionsToPackage{left}{beamerouterthemesidebar}}
\DeclareOptionBeamer{right}{\PassOptionsToPackage{right}{beamerouterthemesidebar}}
\ProcessOptionsBeamer


\mode<all>

%Utilisation du thème extérieur : sidebar (barre de menu latérale)
\useoutertheme[left]{sidebar}

%Utilisation du thème intérieur : rounded (blocks aux bords arrondis + ombragés)
\useinnertheme[shadow=true]{rounded}

%Deux nouvelles commandes : insertion du nom de l'événement et du mail
\def\email{\@dblarg\beamer@email}
\long\def\beamer@email[#1]#2{%
  \def\beamer@temp{#2}%
  \ifx\beamer@temp\@empty
    \def\insertemail{}
  \else
    \def\insertemail{{\tiny{\texttt{#2}}}}%
  \fi
  }
\email{}

\def\event{\@dblarg\beamer@event}
\long\def\beamer@event[#1]#2{%
  \def\beamer@temp{#2}%
  \ifx\beamer@temp\@empty
    \def\insertevent{}
  \else
    \def\insertevent{#2}%
  \fi
  \def\beamer@shortevent{#1}
  }
\event{}

%Redéfinition de la barre de titre : titre centré en mode plain
\setbeamerfont{date}{shape=\itshape}
\setbeamertemplate{title page}
{%
 \vfill%
 \hskip-0.5\beamer@sidebarwidth\vbox{%
 \begin{center}
   \begin{beamercolorbox}[rounded=true,center,shadow=true]{block body}
    \usebeamerfont{title}\inserttitle\par%
     \ifx\insertsubtitle\@empty%
     \else%
       \vskip0.5em%
       {\usebeamerfont{subtitle}\usebeamercolor[fg]{subtitle}\insertsubtitle\par}%
     \fi%
   \end{beamercolorbox}


   \vskip1.5em\par
   \usebeamerfont{author}\insertauthor

   \ifx\insertemail\@empty%
   \else%
   \insertemail
   \fi

   \vskip1.5em\par
   \ifx\insertinstitute\@empty%
   \else%
   \usebeamerfont{institute}\insertinstitute%
   \fi%

   \vskip1.5em\par
   \ifx\insertevent\@empty%
   \else%
   \usebeamerfont{date}\insertevent%
   \fi

   \ifx\insertdate\@empty%
   \else%
   \usebeamerfont{date}\insertdate
   \fi
  \end{center}
  }
 \vfill
}



%Redéfinition de la taille de la barre de titre de chacune des frames (rajout d'une barre horizontale)
\setbeamertemplate{frametitle}
  {%
    \nointerlineskip%
    \vskip-\beamer@headheight%
    \vbox to \beamer@headheight{%
      \vfil
      \leftskip=-\beamer@leftmargin%
      \advance\leftskip by0.3cm%
      \rightskip=-\beamer@rightmargin%
      \advance\rightskip by0.3cm plus1fil%
      {\usebeamercolor[fg]{frametitle}\usebeamerfont{frametitle}\insertframetitle\par}%
      {\usebeamercolor[fg]{framesubtitle}\usebeamerfont{framesubtitle}\insertframesubtitle\par}%
      \vbox{}%
      \vskip-2.5em%
      \vfil
    {\usebeamercolor[black!20!red]{}
    \raisebox{0.4pt}{\vrule depth 0pt height 0.4pt width 0.5\paperwidth}}
    }%
}
\beamer@headheight=1.5\baselineskip

%Redéfinition de la barre de navigation : événement/auteur/nbre de frames
\setbeamertemplate{navigation symbols}{
 \ifnum\c@framenumber=1%
 \else%
 \color{black}\insertevent\hskip15em \insertframenumber/\inserttotalframenumber%
 \fi%
}


%Gestion des couleurs
\usecolortheme[named=black]{structure}
\setbeamercolor{sidebar}{fg=black}
\setbeamercolor{sidebar}{bg=white}
\setbeamercolor{logo}{bg=white}
\setbeamercolor{block title}{bg=black,fg=white}
\setbeamercolor{block body}{bg=black!20!white}
\setbeamercolor{title in sidebar}{fg=black!20!red}
\setbeamercolor{author in sidebar}{fg=black!20!blue}
\setbeamercolor{section in sidebar}{fg=black,bg=black!20!white}
\setbeamercolor{subsection in sidebar}{fg=black,bg=black!20!white}
\setbeamertemplate{sidebar canvas left}[horizontal shading]%
[left=white,middle=white,right=black!20!white]
% \defbeamertemplate{itemize item}{\usebeamercolor[blue]{}$\Rightarrow$}
% \setbeamertemplate{itemize items}[circle]
\setbeamercolor{item}{fg=black!50!white}