%			PCE DOCUMENTATION STYLE

\newcommand{\pceversion}{5.1.0, March 2001}

\makeatletter

% ProWindows/XPCE generation

\newcommand{\system}{xpce}
\newcommand{\makepw}{\renewcommand{\system}{pw3}}
\newcommand{\ifpw}[2]{\ifthenelse{\equal{\system}{pw3}}{#1}{#2}}

\newlength{\arrowwidth}
\settowidth{\arrowwidth}{$\leftarrow$}
\newcommand{\botharrow}{\raisebox{1pt}{$\leftarrow$}\hspace*{-\arrowwidth}\raisebox{-2pt}{$\rightarrow$}}

%	Rules

\newcommand{\hr}{\begin{trivlist}%
		 \topsep 0pt \parskip 0pt \partopsep 0pt%
		 \baselineskip 0pt%
		 \item[]\hrule%\rule[0pt]{\linewidth}{0.2pt}%
		 \end{trivlist}}

%	Running text indication of behaviour

\newcommand{\send}[1]{%                 % send behaviour
        \ifmmode\rightarrow\!\!\reffont #1\:%
        \else\mbox{$\rightarrow$\reffont #1}\fi}
\newcommand{\get}[1]{%                  % get behaviour
        \ifmmode\leftarrow\!\!\reffont #1\:%
        \else\mbox{$\leftarrow$\reffont #1}\fi}
\newcommand{\both}[1]{%                 % both behaviour
        \ifmmode\mbox{\botharrow\!\!\reffont #1\:}%
        \else\mbox{\botharrow\reffont #1}\fi}
\newcommand{\classsend}[2]{%		% class ->method
	\ifmmode\mbox{\reffont #1 \rightarrow!\! #2\:}%
        \else\mbox{\reffont #1 $\rightarrow$ #2}\fi}
\newcommand{\classget}[2]{%		% class <-method
	\ifmmode\mbox{\reffont #1 \leftarrow\!\! #2\:}%
        \else\mbox{\reffont #1 $\leftarrow$ #2}\fi}
\newcommand{\classboth}[2]{%		% class <->method
	\ifmmode\mbox{\reffont #1 \botharrow\!\! #2\:}%
        \else\mbox{\reffont #1 $\botharrow$ #2}\fi}
\newcommand{\classvar}[2]{%		% class.classvar
        \mbox{\reffont #1.#2}}
\newcommand{\nameof}[1]{\{{\tt #1}\}}

%	Descriptions (definitions) of various things

\providecommand{\definition}[1]{%
	\item[\mbox{#1}]\mbox{}\\}
\providecommand{\emptydefinition}[1]{%
	\makebox[-\leftmargin]{\mbox{}}\mbox{\bf #1}\\}

\newcommand{\emptydescription}{\vspace{-.8cm}}

\newcommand{\pceexpanded}[3]{%
	\definition{#1({\it #3})}%
	\index{#1/#2}}
\def\bothmethod{\@ifstar{\@emptybothmethod}{\@bothmethod}}
\def\sendmethod{\@ifstar{\@emptysendmethod}{\@sendmethod}}
\def\getmethod{\@ifstar{\@emptygetmethod}{\@getmethod}}

\newcommand{\@methodarg}[1]{\ifthenelse{\equal{}{#1}}{}{: #1}}

\newcommand{\@argline}[1]{\parbox[t]{0.6\linewidth}{\raggedright#1}}

\def\@emptybothmethod#1#2#3{%
	\emptydefinition{#1 $\botharrow$ #2\@methodarg{#3}}%
			 \index{#1,\string\both{#2}}\ignorespaces}
\def\@bothmethod#1#2#3{%
	\definition{#1 $\botharrow$ #2\@methodarg{#3}}%
		    \index{#1,\string\both{#2}}\ignorespaces}
\def\@emptysendmethod#1#2#3{%
	\emptydefinition{#1 $\rightarrow$ #2\@methodarg{#3}}%
			 \index{#1,\string\send{#2}}\ignorespaces}
\def\@sendmethod#1#2#3{%
	\definition{#1 $\rightarrow$ #2\@argline{\@methodarg{#3}}}%
		    \index{#1,\string\send{#2}}\ignorespaces}
\def\@emptygetmethod#1#2#3#4{%
	\emptydefinition{#1 $\leftarrow$ #2\@methodarg{#3} $\rightarrow$ #4}%
			 \index{#1,\string\get{#2}}\ignorespaces}
\def\@getmethod#1#2#3#4{%
	\definition{#1 $\leftarrow$ #2\@argline{\@methodarg{#3} $\rightarrow$ #4}}%
	\index{#1,\string\get{#2}}\ignorespaces}

\renewcommand{\arg}[1]{{\em #1}}

\def\class{}
\def\classs{}
\renewcommand{\class}[1]{{\reffont #1}\index{#1 \string\idxtype{class}}}
\renewcommand{\classs}[1]{{\reffont #1s}\index{#1 \string\idxtype{class}}}
\newcommand{\lib}[1]{library({\tt #1})\index{#1 \string\idxtype{library}}}

\newlength{\clwidth}
\newlength{\clhwidth}
\newcommand{\classheader}[2]{%
	\settowidth{\clwidth}{#1}%
	\setlength{\clhwidth}{\textwidth}%
	\addtolength{\clhwidth}{-\clwidth}%
	#1\parbox[t]{\clhwidth}{\hyphenpenalty1000\raggedright({\it #2})}}

\def\classsummary{\@ifstar{\xemptysummary}{\xsummary}}
\def\xemptysummary#1#2#3{\emptydefinition{\classheader{#1}{#2}}}
\def\xsummary#1#2#3{%
    \definition{%
	\makebox[0pt][l]{\parbox{\textwidth}{%
	    \hrule height 2pt \@width \textwidth
	    \includegraphics{class/#3}
	    \hrule height 0.5pt \@width \textwidth
	    \vskip 0.8ex\classheader{#1}{#2}}}}}
\newcommand{\manualtool}[2]{%
	\definition{%
	    \makebox[0pt][l]{\parbox{\textwidth}{%
		\bf #1 \hfill\sf #2}}}}

\renewcommand{\line}[1]{\begin{quote}\tt #1\end{quote}}

%	notes

\newenvironment{note}{%
  \begin{description}
      \item[note]\mbox{}\\ \it}{%
  \end{description}}
\newcommand{\incompatible}[1]{}

\newcommand{\fnm}[1]{\makebox[0pt][l]{$^{\mbox{\footnotesize $#1$}}$}}

%	Running text indication of objects

\newcommand{\objectname}[1]{\mbox{\reffont @#1}}

%	Code segments

\newenvironment{pcecode}{%
	\begin{trivlist}\parindent 0pt\parskip 0pt\listparindent 0pt\parsep 0pt%
	\item[]\small\obeylines}{%
	\end{trivlist}}

\newcommand{\lineno}[1]{\makebox[0pt][r]{\makebox[1.5em][l]{\tiny #1}}}

% The "enum" environemnt is an "enumerate" with no extra
% white space between items.

\newenvironment{enum}{%
        \begin{enumerate}%
            \setlength{\parsep}{0pt}
            \setlength{\itemsep}{0pt}}{%
        \end{enumerate}}

%	headers

\newcommand{\header}[1]{\subsubsection*{#1}}

%	compatibility

\providecommand{\tick}[1]{\item {#1}\\\ignorespaces}

\makeatother
