%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                               %
%        na-box.sty V1.0    encodage : UTF8                     %
%                                                               %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% Licence
% -------
% 
% This program can be redistributed and/or modified under the terms
% of the LaTeX Project Public License Distributed from CTAN
% archives in directory macros/latex/base/lppl.txt. 

%    
% Informations générales
%حزمة خاصة برسم الاطارات معدلة اعتمادا على الحزمة  pas-cours 

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{na-box}[2017/08/10]
% crée par PROF:naam mohamed,lycee lazharia ,tissemsilt
%% Chargement des packages nécessaires
\RequirePackage{xkeyval}
\RequirePackage{xstring}
\RequirePackage{amssymb}
\@ifpackageloaded{tikz}{}{\RequirePackage{tikz}}
\usetikzlibrary{calc,arrows,fadings}
\RequirePackage{enumitem}

\newif\if@normal
\newif\if@everytoc
\DeclareOption{normal}{\@normaltrue}
\DeclareOption{everytoc}{\@everytoctrue}
\ProcessOptions

\newenvironment{ant}{
\if@normal
\fontseries{bx}\fontshape{sc}\selectfont
\else
\fontfamily{anttlc}\selectfont
\fi
}

% Définition des couleurs

\definecolor{defi}{rgb}{1.00,0.00,0.50}
\definecolor{ex}{rgb}{0.00,1.00,1.00}
\definecolor{exe}{rgb}{0.564,0.21,0.87}
\definecolor{rem}{rgb}{0.44,0.00,0.87}
\definecolor{thm}{rgb}{1.00,0.50,0.00}
\definecolor{naam}{rgb}{0.87,0.87,0.00}
% Fichier comprenant les macros de styles

% \env : environnement de couleurs
% Synthaxe : \env[style=nom de l'environnement,pluriel (option)]{texte}

\define@cmdkey [PAS] {env} {style}{}
\define@cmdkey [PAS] {env} {name}{}
\define@cmdkey [PAS] {env} {color}{}
\define@cmdkey [PAS] {env} {title}{}
\define@cmdkey [PAS] {env} {symb}{}
\define@boolkey[PAS] {env} {toc}[true]{} 
\define@boolkey[PAS] {env} {notoc}[true]{} 
\define@boolkey[PAS] {env} {pluriel}[true]{} 
\define@boolkey[PAS] {env} {endsymb}[true]{} 
\define@boolkey[PAS] {env} {degrade}[true]{} 
\define@boolkey[PAS] {env} {notitle}[true]{} 
\define@boolkey[PAS] {env} {notitlebreak}[true]{}
\presetkeys    [PAS] {env} {style= , name=\textarabic{} , title= ,pluriel = false, color=, symb = $\blacksquare$, degrade = false, toc=false, notoc=false, notitle=false, notitlebreak=false, endsymb=false}{}

\newcommand*{\env}[1][]{\pasEnv[#1]}

\long\def\pasEnv[#1]#2{
   \setkeys[PAS]{env}{#1}
	\if@everytoc
   	\ifx\cmdPAS@env@name\@empty
   	\else
   		\ifPAS@env@notoc
   		\else
				\phantomsection
				\addcontentsline{toc}{section}{\cmdPAS@env@name}
			\fi
   	\fi
   \else
		\ifPAS@env@toc
			\phantomsection
			\addcontentsline{toc}{section}{\cmdPAS@env@name}
		\fi
	\fi
	%
   \IfStrEq{\cmdPAS@env@style}{xwas}
   {%
   \ifPAS@env@pluriel
   	\def\texte{\textarabic{خواص}}
   \else
   	\def\texte{\textarabic{خاصية}}
   \fi
   \def\couleur{exe}%
   }{}
   \IfStrEq{\cmdPAS@env@style}{borhan}
   {%
   \ifPAS@env@pluriel
   	\def\texte{\textarabic{البراهين}}
   \else
   	\def\texte{\textarabic{البرهان}}
   \fi
   \def\couleur{naam}%
   }{}
   \IfStrEq{\cmdPAS@env@style}{molahadt}
   {%
   \ifPAS@env@pluriel
   \def\texte{\textarabic{ملاحظات}}
   \else
   \def\texte{\textarabic{ملاحظة}}
   \fi
   \def\couleur{rem}
   }{}
   \IfStrEq{\cmdPAS@env@style}{ta3ryf}
	{%
		\ifPAS@env@pluriel
			\def\texte{\textarabic{تعاريف}}
		\else
			\def\texte{\textarabic{ تعريف}}
		\fi
		\def\couleur{defi}
	}{}
	\IfStrEq{\cmdPAS@env@style}{mbarhanat}
	{%
	\ifPAS@env@pluriel
	\def\texte{\textarabic{مبرهنات}}
	\else
	\def\texte{\textarabic{مبرهنة}}
	\fi
	\def\couleur{blue!50!black}
	}{}
	\IfStrEq{\cmdPAS@env@style}{ntyjt}
	{%
	\ifPAS@env@pluriel
	\def\texte{\textarabic{نتائج}}
	\else
	\def\texte{\textarabic{نتيجة}}
	\fi
	\def\couleur{green}
	}{}
   \IfStrEq{\cmdPAS@env@style}{mital}
   {%
   \ifPAS@env@pluriel
   \def\texte{\textarabic{أمثلة}}
   \else
   \def\texte{\textarabic{مثال}}
   \fi
   \def\couleur{ex}
   }{}
   \IfStrEq{\cmdPAS@env@style}{tamryn}
   {%
   \ifPAS@env@pluriel
   \def\texte{\textarabic{تمارين}}
   \else
   \def\texte{\textarabic{تمرين}}
   \fi
   \def\couleur{exe}
   }{}
   \IfStrEq{\cmdPAS@env@style}{nachat}
   {%
   \ifPAS@env@pluriel\def\texte{\textarabic{أنشطة}}
   \else
   \def\texte{\textarabic{نشاط}}
   \fi
   \def\couleur{orange}
   }{}
	\IfStrEq{\cmdPAS@env@style}{tryqt}
	{%
	\ifPAS@env@pluriel\def\texte{\textarabic{طرائق}}
	\else
	\def\texte{\textarabic{طريقة}}
	\fi
	\def\couleur{brown}
	}{}
	\IfStrEq{\cmdPAS@env@title}{}{}{\def\texte{\textarabic{\cmdPAS@env@title}}}
	\IfStrEq{\cmdPAS@env@color}{}{}{\def\couleur{\cmdPAS@env@color}}
	\ifPAS@env@degrade
		\tikzstyle{noeud} = [rectangle,inner sep=10pt,fill=\couleur!8,path fading=west]
	\else
		\tikzstyle{noeud} = [rectangle,inner sep=10pt,fill=\couleur!8]
	\fi
	\itemclass{\couleur}
   \noindent
   \begin{tikzpicture}
   	\node [noeud] (box)
   	{%
      	\begin{minipage}{0.96\textwidth}
			\textarabic{#2
			\ifPAS@env@endsymb
				\hfill \cmdPAS@env@symb
			\fi\\}
      	\end{minipage}
   	};
   	\ifPAS@env@notitle\else
   		\node[text=white,fill=\couleur,rectangle, shading=ball, ball color=\couleur, above left] (title) at ($(box.north east)+(0.03,0)$)
   		{\begin{ant}\textarabic{\texte}\end{ant}};
   	\fi
   	\draw[color=\couleur!50!black,very thick] (box.north east)--(box.south east)--(box.south west);
   	\node[right,color=\couleur] at (box.north west) {\emph{\textarabic{\cmdPAS@env@name}}};
   \end{tikzpicture}   
   \vspace{0.5cm}
}

% Environnement "pasbox"

\newsavebox{\pas@box}
%
\newcounter{suite@box}
\newenvironment*{nabox}[1][]
{%
   \setcounter{suite@box}{0}
   \setkeys[PAS]{env}{#1}
   \if@everytoc
   	\ifx\cmdPAS@env@name\@empty\else
   		\ifPAS@env@notoc\else
				\phantomsection
				\addcontentsline{toc}{section}{\cmdPAS@env@name}
			\fi
   	\fi
   \else
		\ifPAS@env@toc
			\phantomsection
			\addcontentsline{toc}{section}{\cmdPAS@env@name}
		\fi
	\fi
	\IfStrEq{\cmdPAS@env@style}{xwas}
   {%
   \ifPAS@env@pluriel
   	\def\texte{خواص}
   \else
   	\def\texte{خاصية}
   \fi
   \def\couleur{exe}%
   }{}
   \IfStrEq{\cmdPAS@env@style}{borhan}
   {%
   \ifPAS@env@pluriel
   	\def\texte{البراهين}
   \else
   	\def\texte{البرهان}
   \fi
   \def\couleur{naam}%
   }{}
   \IfStrEq{\cmdPAS@env@style}{molahadt}
   {%
   \ifPAS@env@pluriel
   \def\texte{ملاحظات}
   \else
   \def\texte{ملاحظة}
   \fi
   \def\couleur{rem}
   }{}
   \IfStrEq{\cmdPAS@env@style}{ta3ryf}
	{%
		\ifPAS@env@pluriel
			\def\texte{تعاريف}
		\else
			\def\texte{ تعريف}
		\fi
		\def\couleur{defi}
	}{}
	\IfStrEq{\cmdPAS@env@style}{mbarhanat}
	{%
	\ifPAS@env@pluriel
	\def\texte{مبرهنات}
	\else
	\def\texte{مبرهنة}
	\fi
	\def\couleur{blue!50!black}
	}{}
	\IfStrEq{\cmdPAS@env@style}{ntyjt}
	{%
	\ifPAS@env@pluriel
	\def\texte{نتائج}
	\else
	\def\texte{نتيجة}
	\fi
	\def\couleur{green}
	}{}
   \IfStrEq{\cmdPAS@env@style}{mital}
   {%
   \ifPAS@env@pluriel
   \def\texte{أمثلة}
   \else
   \def\texte{مثال}
   \fi
   \def\couleur{ex}
   }{}
   \IfStrEq{\cmdPAS@env@style}{tamryn}
   {%
   \ifPAS@env@pluriel
   \def\texte{تمارين}
   \else
   \def\texte{تمرين}
   \fi
   \def\couleur{exe}
   }{}
   \IfStrEq{\cmdPAS@env@style}{nachat}
   {%
   \ifPAS@env@pluriel\def\texte{أنشطة}
   \else
   \def\texte{نشاط}
   \fi
   \def\couleur{orange}
   }{}
	\IfStrEq{\cmdPAS@env@style}{tryqt}
	{%
	\ifPAS@env@pluriel\def\texte{طرائق}
	\else
	\def\texte{طريقة}
	\fi
	\def\couleur{brown}
	}{}
	\IfStrEq{\cmdPAS@env@title}{}{}{\def\texte{\cmdPAS@env@title}}
	\IfStrEq{\cmdPAS@env@color}{}{}{\def\couleur{\cmdPAS@env@color}}
	\ifPAS@env@degrade
		\tikzstyle{noeud} = [rectangle,inner sep=10pt,fill=\couleur!10,path fading=west]
	\else
		\tikzstyle{noeud} = [rectangle,inner sep=10pt,fill=\couleur!10]
	\fi
	\itemclass{\couleur}
	\begin{lrbox}{\pas@box}
		\begin{minipage}{0.96\linewidth}
}
{
		\ifPAS@env@endsymb
			\hfill \cmdPAS@env@symb
		\fi
    		\end{minipage}
	\end{lrbox}
	\begin{tikzpicture}
   	\node [noeud] (box)
   	{%
		\usebox{\pas@box}
   	};
   	\ifnum\thesuite@box=1
   		\edef\texte{\texte~(تابع)}
   		\ifPAS@env@notitlebreak\else\ifPAS@env@notitle\else
   			\node[text=white,fill=\couleur,rectangle, shading=ball, ball color=\couleur, above left] (title) at ($(box.north east)+(0.03,0)$)
   			{\begin{ant}\textarabic{\texte}\end{ant}};
   		\fi\fi
   	\else
   		\ifPAS@env@notitle\else
   			\node[text=white,fill=\couleur,rectangle, shading=ball, ball color=\couleur, above left] (title) at ($(box.north east)+(0.03,0)$)
   			{\begin{ant}\textarabic{\texte}\end{ant}};
   		\fi
   	\fi
   		\draw[color=\couleur!50!black,very thick] (box.north east)--(box.south east)--(box.south west);
   		\node[right,color=\couleur] at (box.north west) {\emph{\cmdPAS@env@name}};
   		\end{tikzpicture}   
   		\vspace{0.5cm}
}

% \breakbox

\newcommand*{\breakbox}
{%
	\end{minipage}
	\end{lrbox}
	\stepcounter{suite@box}
	\begin{tikzpicture}
   	\node [noeud] (box)
   	{%
		\usebox{\pas@box}
   	};
   	\ifPAS@env@notitle\else
   	\node[text=white,fill=\couleur,rectangle, shading=ball, ball color=\couleur, above left] (title) at ($(box.north east)+(0.03,0)$)
   		{\begin{ant}\textarabic{\texte}\end{ant}};
   	\fi
   		\draw[color=\couleur!50!black,very thick] (box.north east)--(box.south east)--(box.south west);
   		\node[right,color=\couleur] at (box.north west) {\emph{\cmdPAS@env@name}};
   		\node[rounded corners=0.7pt,draw=\couleur!50!black,very thick,right,fill=yellow!20] at ($(box.south west)+(0.5,0)$) {\textarabic{ يتبع}};
   	\end{tikzpicture}
   	\par 
   	\begin{lrbox}{\pas@box} 
\begin{minipage}{0.96\linewidth}
}



%%%%%%%%%%%% Définition d'un mot

\newcommand{\definmot}[1]{\texttt{\textbf{\textcolor{defi}{\textarabic{#1}}}}}

% Itemclass

\newcommand{\itemclass}[1] % #1 = هو اللون
{
	\setlist[itemize,1]{label={\color{#1}\textbullet}}
	\setlist[itemize,2]{label={\color{#1}$\leftarrow$}}
	\setlist[enumerate,1]
	{%
		label=\fcolorbox{#1}
		{#1}
		{\color{#1!20}\normalsize\bfseries  \arabic*}
	}
	\setlist[enumerate,2]{label=\textcolor{#1}{\normalsize\bfseries\alph*.}}
}
\itemclass{black}{}


\def\titreFONT{\fontfamily{phv}\fontseries{bx}\selectfont} % pb6
\def\tocFONT{\fontfamily{phv}\fontseries{m}\selectfont}




\endinput
